Data Preperation on April, 2nd 2014 - these are preliminary results with on 22 people in the intervention group reporting.

Purpose Study “Next Stage Purpose” Results

Happiness taken from Subjective Happiness (Lyubomirsky & Lepper, 1999)

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)
# HAPPI leaving out the searching for purpose
data$T1HAPPI <- apply(data[, c("HAPPI1.x", "HAPPI2.x", "HAPPI3.x")], 1, mean, 
    na.rm = TRUE)
data$T2HAPPI <- apply(data[, c("HAPPI1.y", "HAPPI2.y", "HAPPI3.y")], 1, mean, 
    na.rm = TRUE)

plot(data$T1HAPPI, data$T2HAPPI, ylab = "Pre", xlab = "Post", main = "HAPPI")

plot of chunk unnamed-chunk-1

# pre test plots
bwplot(GROUP.x ~ T1HAPPI, ylab = "GROUP", xlab = "HAPPI", main = "Pre test", 
    data = data)

plot of chunk unnamed-chunk-1

# post test plots
bwplot(GROUP.x ~ T2HAPPI, ylab = "Group", xlab = "HAPPI", main = "Post test", 
    data = data)

plot of chunk unnamed-chunk-1

# Pre test
t.test(T1HAPPI ~ GROUP.x, data = data)
## 
##  Welch Two Sample t-test
## 
## data:  T1HAPPI by GROUP.x
## t = -0.0444, df = 64.68, p-value = 0.9647
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.5884  0.5628
## sample estimates:
## mean in group 0 mean in group 1 
##           5.248           5.260
t.test(T2HAPPI ~ GROUP.x, data = data)
## 
##  Welch Two Sample t-test
## 
## data:  T2HAPPI by GROUP.x
## t = -1.41, df = 42.83, p-value = 0.1657
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.9318  0.1650
## sample estimates:
## mean in group 0 mean in group 1 
##           5.410           5.794
# Ancova, Model for HAPPI
HAPPI_ANCOVA <- lm(T2HAPPI ~ as.factor(GROUP.x) + T1HAPPI, data = data)
# check assumptions visually
plot(HAPPI_ANCOVA)

plot of chunk unnamed-chunk-1 plot of chunk unnamed-chunk-1 plot of chunk unnamed-chunk-1 plot of chunk unnamed-chunk-1

Number 15 is an outlier so I will run this again without 15 to see if it makes a difference.

# see results
summary(HAPPI_ANCOVA)
## 
## Call:
## lm(formula = T2HAPPI ~ as.factor(GROUP.x) + T1HAPPI, data = data)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -1.140 -0.303 -0.008  0.378  1.025 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           1.4401     0.3602    4.00  0.00024 ***
## as.factor(GROUP.x)1   0.4675     0.1446    3.23  0.00233 ** 
## T1HAPPI               0.7286     0.0637   11.44    9e-15 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.492 on 44 degrees of freedom
##   (22 observations deleted due to missingness)
## Multiple R-squared:  0.758,  Adjusted R-squared:  0.747 
## F-statistic:   69 on 2 and 44 DF,  p-value: 2.74e-14

Running again without number 15

# Ancova, Model for HAPPI
HAPPI_ANCOVA1 <- lm(T2HAPPI ~ as.factor(GROUP.x) + T1HAPPI, data = data, -15)
# check assumptions visually
plot(HAPPI_ANCOVA1)

plot of chunk unnamed-chunk-3 plot of chunk unnamed-chunk-3 plot of chunk unnamed-chunk-3 plot of chunk unnamed-chunk-3

# see results
summary(HAPPI_ANCOVA1)
## 
## Call:
## lm(formula = T2HAPPI ~ as.factor(GROUP.x) + T1HAPPI, data = data, 
##     subset = -15)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -1.069 -0.361  0.116  0.402  0.976 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           1.9003     0.3740    5.08  7.8e-06 ***
## as.factor(GROUP.x)1   0.4040     0.1366    2.96    0.005 ** 
## T1HAPPI               0.6543     0.0651   10.06  7.3e-13 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.458 on 43 degrees of freedom
##   (22 observations deleted due to missingness)
## Multiple R-squared:  0.708,  Adjusted R-squared:  0.695 
## F-statistic: 52.2 on 2 and 43 DF,  p-value: 3.12e-12