Self Efficacy Refined Report -20130917

pre.raw <- read.csv("20130614-CC2013Pre-raw.csv", na.string = c("NA", "", " "))
post.raw <- read.csv("20130614-CC2013Post-raw.csv", na.string = c("NA", "", 
    " "))


#################### create data.frame objects to store the responses for self-efficacy
SelfEff.cols <- grep("Self.Efficacy", names(pre.raw))
val.before <- c("Strongly disagree", "Disagree", "Neutral", "Agree", "Strongly agree")

SelfEff.pre <- pre.raw[, SelfEff.cols]
SelfEff.post <- post.raw[, SelfEff.cols]
for (i in 1:length(SelfEff.cols)) {
    SelfEff.pre[, i] <- as.numeric(ordered(SelfEff.pre[, i], levels = val.before))
    SelfEff.post[, i] <- as.numeric(ordered(SelfEff.post[, i], levels = val.before))
}
SelfEff.pre.matched <- SelfEff.pre[best.matches, ]
SelfEff.post.matched <- SelfEff.post
names(SelfEff.pre.matched) <- paste("Q", 1:dim(SelfEff.pre)[2], sep = "")
names(SelfEff.post.matched) <- paste("Q", 1:dim(SelfEff.post)[2], sep = "")

# make total score for self-efficacy
SelfEff.pre.matched <- data.frame(SelfEff.pre.matched, total = rowSums(SelfEff.pre.matched))
SelfEff.post.matched <- data.frame(SelfEff.post.matched, total = rowSums(SelfEff.post.matched))

######################## some descriptive statistics

(dim(SelfEff.pre.matched)[1])  #sample size
## [1] 153

boxplot(SelfEff.post.matched$total - SelfEff.pre.matched$total)

plot of chunk SelfEfficacy

hist(SelfEff.post.matched$total - SelfEff.pre.matched$total)

plot of chunk SelfEfficacy


colMeans(SelfEff.post.matched - SelfEff.pre.matched, na.rm = T)
##     Q1     Q2     Q3     Q4     Q5     Q6  total 
## 0.2593 0.1037 0.1407 0.1778 0.2222 0.3630 1.2667

####################### do Finite Population Inference, assuming missing at random responses
library(survey)
## Attaching package: 'survey'
## 
## The following object is masked from 'package:ipred':
## 
## cv
## 
## The following object is masked from 'package:graphics':
## 
## dotchart

survey.SelfEff <- svydesign(~0, data = SelfEff.post.matched - SelfEff.pre.matched, 
    fpc = rep(300, dim(SelfEff.post.matched)[1]))
confint(svymean(~total, survey.SelfEff, na.rm = T), level = 0.99, df = degf(survey.SelfEff))
##       0.5 % 99.5 %
## total 0.908  1.625

# compare with a t.test, not much difference
t.test(SelfEff.post.matched$total - SelfEff.pre.matched$total)
## 
##  One Sample t-test
## 
## data:  SelfEff.post.matched$total - SelfEff.pre.matched$total
## t = 6.447, df = 134, p-value = 1.908e-09
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
##  0.8781 1.6553
## sample estimates:
## mean of x 
##     1.267

Summary

Overall, pval<< 0.001