Purpose Study “Next Stage Purpose” Results
setwd("/Users/levibrackman/Desktop/Adult_study")
data_pre <- read.csv("pre.csv")
data_post <- read.csv("post.csv")
table(data_pre$GROUP, dnn = "group")
## group
## 0 1
## 35 32
data <- merge(data_pre, data_post, by = "ID", all = TRUE)
library(psych)
library(lattice)
# Only the Purpose questions in MLQ leaving out the searching for purpose
data$T1MLQP <- apply(data[, c("MLQ1.x", "MLQ4.x", "MLQ5.x", "MLQ6.x")], 1, mean,
na.rm = TRUE)
data$T2MLQP <- apply(data[, c("MLQ1.y", "MLQ4.y", "MLQ5.y", "MLQ6.y")], 1, mean,
na.rm = TRUE)
plot(data$T1MLQP, data$T2MLQP, ylab = "Pre", xlab = "Post", main = "Purpose")
# pre test plots
bwplot(GROUP.x ~ T1MLQP, ylab = "GROUP", xlab = "MLQ", main = "Pre test", data = data)
# post test plots
bwplot(GROUP.x ~ T2MLQP, ylab = "Group", xlab = "MLQ", main = "Post test", data = data)
# Pre test
t.test(T1MLQP ~ GROUP.x, data = data)
##
## Welch Two Sample t-test
##
## data: T1MLQP by GROUP.x
## t = 0.5601, df = 62.97, p-value = 0.5774
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.4494 0.7994
## sample estimates:
## mean in group 0 mean in group 1
## 4.800 4.625
t.test(T2MLQP ~ GROUP.x, data = data)
##
## Welch Two Sample t-test
##
## data: T2MLQP by GROUP.x
## t = -3.155, df = 43.67, p-value = 0.002907
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -1.4581 -0.3212
## sample estimates:
## mean in group 0 mean in group 1
## 5.087 5.976
# Ancova, Model for MLQ
MLQP_ANCOVA <- lm(T2MLQP ~ as.factor(GROUP.x) + T1MLQP, data = data)
# check assumptions visually
plot(MLQP_ANCOVA)
# see results
summary(MLQP_ANCOVA)
##
## Call:
## lm(formula = T2MLQP ~ as.factor(GROUP.x) + T1MLQP, data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.4109 -0.3766 0.0569 0.4157 1.2867
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.1085 0.4777 4.41 6.5e-05 ***
## as.factor(GROUP.x)1 0.9194 0.2047 4.49 5.0e-05 ***
## T1MLQP 0.5968 0.0917 6.51 6.1e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.697 on 44 degrees of freedom
## (22 observations deleted due to missingness)
## Multiple R-squared: 0.582, Adjusted R-squared: 0.563
## F-statistic: 30.6 on 2 and 44 DF, p-value: 4.66e-09