Data analysis of basic parenting values/attitudes survey.
Preliminaries.
## [1] "dplyr" "langcog" "tidyr" "ggplot2" "lme4"
##
## Attaching package: 'langcog'
## The following object is masked from 'package:base':
##
## scale
## Warning: package 'ggplot2' was built under R version 3.2.3
##
## Attaching package: 'psych'
## The following objects are masked from 'package:ggplot2':
##
## %+%, alpha
## Loading required package: MASS
## Loading required package: boot
##
## Attaching package: 'boot'
## The following object is masked from 'package:psych':
##
## logit
## Loading required package: lattice
##
## Attaching package: 'lattice'
## The following object is masked from 'package:boot':
##
## melanoma
##
## Attaching package: 'nFactors'
## The following object is masked from 'package:lattice':
##
## parallel
##
## Attaching package: 'dplyr'
## The following object is masked from 'package:MASS':
##
## select
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
## Loading required package: Matrix
##
## Attaching package: 'Matrix'
## The following object is masked from 'package:tidyr':
##
## expand
Read in files and consolidate to the same directory.
files <- dir("../production-results/e8/")
d.raw <- data.frame()
for (f in files) {
jf <- paste("../production-results/e8/",f,sep="")
jd <- fromJSON(paste(readLines(jf), collapse=""))
# clean up instruction trial
sent <- jd$answers$data$sentence
rating <- as.numeric(jd$answers$data$rating)
trial_type <- jd$answer$data$trial_type
sent <- sent[trial_type != "2afc_instructions"]
trial_type <- trial_type[trial_type != "2afc_instructions"]
#left out race because not sure yet how to deal with list format
id <- data.frame(workerid = jd$WorkerId,
sent = sent,
rating = rating,
children = jd$answers$data$children,
language = jd$answer$data$homelang,
ses = jd$answer$data$ladder,
gender = jd$answer$data$gender,
age = jd$answer$data$age,
education = jd$answer$data$education,
ethnicity = jd$answer$data$ethnicity,
childAgeYoung = jd$answer$data$childAgeYoung,
childAgeOld = jd$answer$data$childAgeOld
)
d.raw <- bind_rows(d.raw, id)
}
Map on question short forms so that we can use these instead.
labels <- read.csv("sent_forms_e8.csv")
labels$sent <- as.character(labels$sent)
Clean up labels.
d.raw$sent <- as.character(d.raw$sent)
d.raw$sent <- str_replace_all(d.raw$sent, "'", "")
d.raw$sent <- str_replace_all(d.raw$sent, "’", "")
d.raw$sent <- str_replace_all(d.raw$sent, "“", "")
d.raw$sent <- str_replace_all(d.raw$sent, "”", "")
d.raw$sent <- str_replace_all(d.raw$sent, "‘", "")
d.raw$sent <- str_replace_all(d.raw$sent, "â", "")
Merge.
d <- left_join(d.raw, labels)
d$rating[d$reverse_code == 1] <- 6 - d$rating[d$reverse_code == 1]
Plot demographic info.
subinfo <- d %>%
group_by(workerid) %>%
select(workerid, age, gender, children, ses, education, language,
ethnicity, childAgeYoung, childAgeOld) %>%
dplyr::rename(youngestChildAge = childAgeYoung,
oldestChildAge = childAgeOld) %>%
distinct
# summarise(age = age[1],
# gender = gender[1],
# children = children[1],
# ses = ses[1],
# education = education[1],
# language = language[1],
# ethnicity = ethnicity[1],
# youngestChildAge = childAgeYoung[1],
# oldestChildAge = childAgeOld[1]
# )
subinfo$education <- factor(subinfo$education, levels = c("highSchool","someCollege","4year","someGrad","Grad"))
subinfo$gender <- str_replace_all(subinfo$gender, "female|FEMALE|F$|f$|Femal$|Females|Females","Female")
subinfo$gender <- str_replace_all(subinfo$gender, "^male|^Male|^MALE|^M$|^m$|^Maleq|Make", "Male")
subinfo$gender <- str_replace_all(subinfo$gender, "29|24|25|28|32|33|45", "")
subinfo$gender <- str_replace_all(subinfo$gender, "males", "male")
subinfo$gender <- str_replace_all(subinfo$gender, " ", "")
subinfo$language <- str_replace_all(subinfo$language, "english|eNGLISH|Engliah|ENGLISH|^eng$|Enlgish", "English")
subinfo$language <- str_replace_all(subinfo$language," ", "")
subinfo$language <- str_replace_all(subinfo$language,"arabic", "Arabic")
subinfo$language <- str_replace_all(subinfo$language,"chinese", "Chinese")
subinfo$language <- str_replace_all(subinfo$language,"german", "German")
subinfo$language <- str_replace_all(subinfo$language,"tagalog", "Tagalog")
subinfo$youngestChildAge <- factor(subinfo$youngestChildAge, levels = c("","0to6mo","7to12mo","1y","2y","3y","4y","5y","6y","7y","8y","9y","10y","olderthan10"))
subinfo$oldestChildAge <- factor(subinfo$oldestChildAge, levels = c("","0to6mo","7to12mo","1y","2y","3y","4y","5y","6y","7y","8y","9y","10y","olderthan10"))
qplot(ses, data=subinfo)
qplot(children, data=subinfo)
qplot(gender, data=subinfo)
qplot(education, data=subinfo)
qplot(age, data=subinfo)
qplot(language, data=subinfo)
qplot(ethnicity, data=subinfo)
qplot(youngestChildAge, data=subinfo)
qplot(oldestChildAge, data=subinfo)
Now look at mean ratings across sentences.
rating_count <- table(d$rating)
rating_count
##
## 0 1 2 3 4 5 6
## 136 209 273 632 866 1255 2629
prop.table(rating_count)
##
## 0 1 2 3 4 5
## 0.02266667 0.03483333 0.04550000 0.10533333 0.14433333 0.20916667
## 6
## 0.43816667
ms <- d %>%
group_by(category, instrument, short_sent, reverse_code) %>%
multi_boot_standard(col = "rating") %>%
arrange(instrument, category, desc(mean))
ms$short_sent_ord <- factor(ms$short_sent,
levels = ms$short_sent)
Plot attitude.
qplot(short_sent_ord, mean, col = category,
ymin = ci_lower, ymax = ci_upper, pch = factor(reverse_code),
geom = "pointrange",
data = filter(ms, instrument == "attitudes")) +
theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = .5)) +
xlab("") +
ylab("Mean Rating") +
ylim(c(0,6)) +
scale_colour_solarized()
Plot mean subscale scores.
mc <- d %>%
group_by(category) %>%
multi_boot_standard(col = "rating") %>%
arrange(category, desc(mean))
ggplot(mc, aes(x = category, y = mean)) +
geom_bar(stat = "identity", position = "dodge") +
geom_linerange(aes(ymin = ci_lower, ymax = ci_upper),
position = position_dodge(width = .9))
mcl <- d %>%
group_by(category, workerid) %>%
multi_boot_standard(col = "rating") %>%
arrange(category, desc(mean))%>%
spread(category, mean)
wide.attitudes <- d %>%
filter(instrument == "attitudes") %>%
select(workerid, short_sent, rating) %>%
spread(short_sent, rating)
alpha.mat <- as.matrix(select(wide.attitudes, -workerid))
alpha(x = alpha.mat)
##
## Reliability analysis
## Call: alpha(x = alpha.mat)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd
## 0.85 0.86 0.9 0.21 6.3 0.018 4.7 0.67
##
## lower alpha upper 95% confidence boundaries
## 0.81 0.85 0.88
##
## Reliability if an item is dropped:
## raw_alpha std.alpha
## allowed to make decisions 0.84 0.86
## be grateful to parents 0.85 0.86
## become spoiled with too much attention 0.84 0.86
## can learn about good and bad behavior 0.84 0.86
## can teach themselves by playing 0.84 0.85
## children emotionally close to parents 0.83 0.85
## children should be given comfort 0.84 0.86
## children should express emotions 0.84 0.86
## dont need to learn math before school 0.84 0.86
## good bond with parents for future friendships 0.84 0.86
## learn before speaking 0.83 0.85
## learn to control impulses 0.84 0.86
## learn to respect adults 0.84 0.86
## let children know when break rule 0.84 0.86
## new experiences and sensations 0.84 0.85
## not helpful to explain reasons for rules 0.83 0.85
## not punished for breaking small rules 0.84 0.86
## parents act like friends to children 0.85 0.87
## parents should follow childrens lead 0.84 0.86
## pay attention to childrens desires 0.84 0.86
## reading not helpful before they can speak 0.83 0.85
## repetetive behaviors to explore cause and effect 0.86 0.87
## too much affection can make a child weak 0.84 0.86
## worry if child misbehaves 0.84 0.86
## G6(smc) average_r S/N
## allowed to make decisions 0.90 0.21 6.2
## be grateful to parents 0.90 0.22 6.3
## become spoiled with too much attention 0.89 0.21 6.2
## can learn about good and bad behavior 0.89 0.20 5.9
## can teach themselves by playing 0.89 0.20 5.9
## children emotionally close to parents 0.89 0.20 5.9
## children should be given comfort 0.89 0.21 6.0
## children should express emotions 0.89 0.21 6.0
## dont need to learn math before school 0.89 0.20 5.9
## good bond with parents for future friendships 0.89 0.21 6.1
## learn before speaking 0.89 0.20 5.9
## learn to control impulses 0.89 0.21 6.1
## learn to respect adults 0.89 0.21 6.3
## let children know when break rule 0.89 0.20 5.9
## new experiences and sensations 0.89 0.20 5.9
## not helpful to explain reasons for rules 0.89 0.20 5.9
## not punished for breaking small rules 0.89 0.21 6.1
## parents act like friends to children 0.90 0.22 6.5
## parents should follow childrens lead 0.89 0.21 6.1
## pay attention to childrens desires 0.90 0.21 6.1
## reading not helpful before they can speak 0.89 0.20 5.8
## repetetive behaviors to explore cause and effect 0.90 0.23 6.7
## too much affection can make a child weak 0.89 0.21 6.1
## worry if child misbehaves 0.89 0.21 5.9
## alpha se
## allowed to make decisions 0.018
## be grateful to parents 0.018
## become spoiled with too much attention 0.018
## can learn about good and bad behavior 0.019
## can teach themselves by playing 0.018
## children emotionally close to parents 0.019
## children should be given comfort 0.018
## children should express emotions 0.018
## dont need to learn math before school 0.019
## good bond with parents for future friendships 0.018
## learn before speaking 0.019
## learn to control impulses 0.018
## learn to respect adults 0.018
## let children know when break rule 0.019
## new experiences and sensations 0.019
## not helpful to explain reasons for rules 0.019
## not punished for breaking small rules 0.018
## parents act like friends to children 0.017
## parents should follow childrens lead 0.018
## pay attention to childrens desires 0.018
## reading not helpful before they can speak 0.019
## repetetive behaviors to explore cause and effect 0.017
## too much affection can make a child weak 0.018
## worry if child misbehaves 0.019
##
## Item statistics
## n raw.r std.r r.cor
## allowed to make decisions 250 0.43 0.40 0.361
## be grateful to parents 250 0.34 0.35 0.317
## become spoiled with too much attention 250 0.45 0.41 0.391
## can learn about good and bad behavior 250 0.55 0.58 0.557
## can teach themselves by playing 250 0.55 0.59 0.575
## children emotionally close to parents 250 0.63 0.61 0.603
## children should be given comfort 250 0.49 0.52 0.489
## children should express emotions 250 0.52 0.56 0.536
## dont need to learn math before school 250 0.58 0.57 0.553
## good bond with parents for future friendships 250 0.46 0.49 0.460
## learn before speaking 250 0.63 0.62 0.610
## learn to control impulses 250 0.45 0.46 0.433
## learn to respect adults 250 0.36 0.38 0.355
## let children know when break rule 250 0.57 0.59 0.569
## new experiences and sensations 250 0.58 0.62 0.606
## not helpful to explain reasons for rules 250 0.63 0.62 0.601
## not punished for breaking small rules 250 0.49 0.47 0.445
## parents act like friends to children 250 0.23 0.21 0.151
## parents should follow childrens lead 250 0.49 0.46 0.431
## pay attention to childrens desires 250 0.41 0.44 0.409
## reading not helpful before they can speak 250 0.67 0.68 0.672
## repetetive behaviors to explore cause and effect 250 0.13 0.13 0.063
## too much affection can make a child weak 250 0.51 0.47 0.454
## worry if child misbehaves 250 0.57 0.56 0.544
## r.drop mean sd
## allowed to make decisions 0.337 3.7 1.69
## be grateful to parents 0.255 4.5 1.43
## become spoiled with too much attention 0.350 3.5 1.93
## can learn about good and bad behavior 0.508 5.4 0.96
## can teach themselves by playing 0.515 5.5 0.83
## children emotionally close to parents 0.565 5.0 1.62
## children should be given comfort 0.436 5.2 1.06
## children should express emotions 0.478 5.4 0.84
## dont need to learn math before school 0.512 5.1 1.49
## good bond with parents for future friendships 0.399 5.2 1.17
## learn before speaking 0.569 5.2 1.43
## learn to control impulses 0.384 4.8 1.29
## learn to respect adults 0.295 5.0 1.23
## let children know when break rule 0.522 5.1 1.13
## new experiences and sensations 0.534 5.4 0.96
## not helpful to explain reasons for rules 0.562 4.8 1.65
## not punished for breaking small rules 0.409 3.5 1.68
## parents act like friends to children 0.124 3.4 1.81
## parents should follow childrens lead 0.407 3.8 1.61
## pay attention to childrens desires 0.343 4.8 1.17
## reading not helpful before they can speak 0.623 5.3 1.35
## repetetive behaviors to explore cause and effect 0.032 3.9 1.62
## too much affection can make a child weak 0.415 4.4 1.79
## worry if child misbehaves 0.501 4.7 1.42
##
## Non missing response frequency for each item
## 0 1 2 3 4
## allowed to make decisions 0.05 0.08 0.08 0.22 0.22
## be grateful to parents 0.02 0.02 0.04 0.16 0.18
## become spoiled with too much attention 0.07 0.14 0.12 0.14 0.18
## can learn about good and bad behavior 0.00 0.01 0.00 0.05 0.08
## can teach themselves by playing 0.00 0.00 0.00 0.04 0.06
## children emotionally close to parents 0.03 0.04 0.04 0.05 0.07
## children should be given comfort 0.01 0.00 0.00 0.07 0.10
## children should express emotions 0.00 0.00 0.00 0.04 0.08
## dont need to learn math before school 0.02 0.03 0.03 0.06 0.14
## good bond with parents for future friendships 0.01 0.01 0.01 0.06 0.11
## learn before speaking 0.01 0.04 0.03 0.06 0.07
## learn to control impulses 0.01 0.01 0.04 0.08 0.18
## learn to respect adults 0.00 0.00 0.04 0.09 0.14
## let children know when break rule 0.00 0.01 0.02 0.09 0.13
## new experiences and sensations 0.00 0.00 0.01 0.04 0.08
## not helpful to explain reasons for rules 0.04 0.04 0.05 0.06 0.12
## not punished for breaking small rules 0.05 0.10 0.07 0.25 0.22
## parents act like friends to children 0.08 0.10 0.12 0.21 0.19
## parents should follow childrens lead 0.04 0.04 0.12 0.19 0.24
## pay attention to childrens desires 0.00 0.00 0.02 0.16 0.18
## reading not helpful before they can speak 0.02 0.02 0.04 0.03 0.08
## repetetive behaviors to explore cause and effect 0.05 0.04 0.08 0.22 0.20
## too much affection can make a child weak 0.03 0.08 0.08 0.11 0.16
## worry if child misbehaves 0.01 0.03 0.04 0.06 0.24
## 5 6 miss
## allowed to make decisions 0.17 0.18 0
## be grateful to parents 0.27 0.30 0
## become spoiled with too much attention 0.13 0.22 0
## can learn about good and bad behavior 0.24 0.62 0
## can teach themselves by playing 0.26 0.64 0
## children emotionally close to parents 0.15 0.63 0
## children should be given comfort 0.32 0.51 0
## children should express emotions 0.27 0.60 0
## dont need to learn math before school 0.10 0.62 0
## good bond with parents for future friendships 0.26 0.54 0
## learn before speaking 0.13 0.67 0
## learn to control impulses 0.27 0.40 0
## learn to respect adults 0.24 0.49 0
## let children know when break rule 0.27 0.48 0
## new experiences and sensations 0.23 0.63 0
## not helpful to explain reasons for rules 0.20 0.50 0
## not punished for breaking small rules 0.16 0.14 0
## parents act like friends to children 0.15 0.15 0
## parents should follow childrens lead 0.18 0.18 0
## pay attention to childrens desires 0.30 0.34 0
## reading not helpful before they can speak 0.14 0.68 0
## repetetive behaviors to explore cause and effect 0.23 0.18 0
## too much affection can make a child weak 0.14 0.41 0
## worry if child misbehaves 0.21 0.40 0
wide.rules_respect <- d %>%
filter(category == "rules_respect") %>%
select(workerid, short_sent, rating) %>%
spread(short_sent, rating)
alpha.rr <- as.matrix(select(wide.rules_respect, -workerid))
alpha(x = alpha.rr)
##
## Reliability analysis
## Call: alpha(x = alpha.rr)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd
## 0.8 0.81 0.81 0.35 4.3 0.03 4.4 0.94
##
## lower alpha upper 95% confidence boundaries
## 0.74 0.8 0.86
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc)
## allowed to make decisions 0.80 0.80 0.80
## be grateful to parents 0.78 0.79 0.78
## learn to control impulses 0.77 0.78 0.78
## learn to respect adults 0.78 0.79 0.78
## let children know when break rule 0.77 0.78 0.78
## not punished for breaking small rules 0.77 0.78 0.78
## parents should follow childrens lead 0.78 0.80 0.79
## worry if child misbehaves 0.78 0.79 0.79
## average_r S/N alpha se
## allowed to make decisions 0.37 4.1 0.033
## be grateful to parents 0.35 3.8 0.034
## learn to control impulses 0.34 3.6 0.035
## learn to respect adults 0.34 3.7 0.034
## let children know when break rule 0.34 3.5 0.035
## not punished for breaking small rules 0.34 3.5 0.035
## parents should follow childrens lead 0.36 3.9 0.034
## worry if child misbehaves 0.35 3.7 0.035
##
## Item statistics
## n raw.r std.r r.cor r.drop mean
## allowed to make decisions 250 0.60 0.57 0.47 0.42 3.7
## be grateful to parents 250 0.62 0.63 0.58 0.48 4.5
## learn to control impulses 250 0.67 0.69 0.64 0.56 4.8
## learn to respect adults 250 0.64 0.67 0.62 0.53 5.0
## let children know when break rule 250 0.67 0.70 0.65 0.57 5.1
## not punished for breaking small rules 250 0.72 0.70 0.65 0.58 3.5
## parents should follow childrens lead 250 0.64 0.61 0.53 0.49 3.8
## worry if child misbehaves 250 0.66 0.66 0.59 0.53 4.7
## sd
## allowed to make decisions 1.7
## be grateful to parents 1.4
## learn to control impulses 1.3
## learn to respect adults 1.2
## let children know when break rule 1.1
## not punished for breaking small rules 1.7
## parents should follow childrens lead 1.6
## worry if child misbehaves 1.4
##
## Non missing response frequency for each item
## 0 1 2 3 4 5 6
## allowed to make decisions 0.05 0.08 0.08 0.22 0.22 0.17 0.18
## be grateful to parents 0.02 0.02 0.04 0.16 0.18 0.27 0.30
## learn to control impulses 0.01 0.01 0.04 0.08 0.18 0.27 0.40
## learn to respect adults 0.00 0.00 0.04 0.09 0.14 0.24 0.49
## let children know when break rule 0.00 0.01 0.02 0.09 0.13 0.27 0.48
## not punished for breaking small rules 0.05 0.10 0.07 0.25 0.22 0.16 0.14
## parents should follow childrens lead 0.04 0.04 0.12 0.19 0.24 0.18 0.18
## worry if child misbehaves 0.01 0.03 0.04 0.06 0.24 0.21 0.40
## miss
## allowed to make decisions 0
## be grateful to parents 0
## learn to control impulses 0
## learn to respect adults 0
## let children know when break rule 0
## not punished for breaking small rules 0
## parents should follow childrens lead 0
## worry if child misbehaves 0
wide.affection <- d %>%
filter(category == "affection") %>%
select(workerid, short_sent, rating) %>%
spread(short_sent, rating)
alpha.af <- as.matrix(select(wide.affection, -workerid))
alpha(x = alpha.af)
##
## Reliability analysis
## Call: alpha(x = alpha.af)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd
## 0.71 0.74 0.75 0.26 2.8 0.038 4.6 0.84
##
## lower alpha upper 95% confidence boundaries
## 0.63 0.71 0.78
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc)
## become spoiled with too much attention 0.65 0.70 0.69
## children emotionally close to parents 0.68 0.72 0.73
## children should be given comfort 0.67 0.69 0.71
## children should express emotions 0.68 0.69 0.71
## good bond with parents for future friendships 0.69 0.72 0.74
## parents act like friends to children 0.74 0.75 0.76
## pay attention to childrens desires 0.68 0.71 0.72
## too much affection can make a child weak 0.63 0.69 0.68
## average_r S/N alpha se
## become spoiled with too much attention 0.25 2.3 0.046
## children emotionally close to parents 0.26 2.5 0.043
## children should be given comfort 0.24 2.2 0.044
## children should express emotions 0.24 2.2 0.043
## good bond with parents for future friendships 0.27 2.6 0.042
## parents act like friends to children 0.30 3.1 0.038
## pay attention to childrens desires 0.26 2.4 0.042
## too much affection can make a child weak 0.24 2.2 0.047
##
## Item statistics
## n raw.r std.r r.cor r.drop
## become spoiled with too much attention 250 0.72 0.64 0.61 0.53
## children emotionally close to parents 250 0.58 0.57 0.47 0.39
## children should be given comfort 250 0.60 0.66 0.59 0.49
## children should express emotions 250 0.59 0.67 0.61 0.50
## good bond with parents for future friendships 250 0.49 0.55 0.43 0.34
## parents act like friends to children 250 0.44 0.39 0.23 0.19
## pay attention to childrens desires 250 0.52 0.59 0.50 0.38
## too much affection can make a child weak 250 0.74 0.67 0.66 0.57
## mean sd
## become spoiled with too much attention 3.5 1.93
## children emotionally close to parents 5.0 1.62
## children should be given comfort 5.2 1.06
## children should express emotions 5.4 0.84
## good bond with parents for future friendships 5.2 1.17
## parents act like friends to children 3.4 1.81
## pay attention to childrens desires 4.8 1.17
## too much affection can make a child weak 4.4 1.79
##
## Non missing response frequency for each item
## 0 1 2 3 4
## become spoiled with too much attention 0.07 0.14 0.12 0.14 0.18
## children emotionally close to parents 0.03 0.04 0.04 0.05 0.07
## children should be given comfort 0.01 0.00 0.00 0.07 0.10
## children should express emotions 0.00 0.00 0.00 0.04 0.08
## good bond with parents for future friendships 0.01 0.01 0.01 0.06 0.11
## parents act like friends to children 0.08 0.10 0.12 0.21 0.19
## pay attention to childrens desires 0.00 0.00 0.02 0.16 0.18
## too much affection can make a child weak 0.03 0.08 0.08 0.11 0.16
## 5 6 miss
## become spoiled with too much attention 0.13 0.22 0
## children emotionally close to parents 0.15 0.63 0
## children should be given comfort 0.32 0.51 0
## children should express emotions 0.27 0.60 0
## good bond with parents for future friendships 0.26 0.54 0
## parents act like friends to children 0.15 0.15 0
## pay attention to childrens desires 0.30 0.34 0
## too much affection can make a child weak 0.14 0.41 0
wide.active_learning <- d %>%
filter(category == "active_learning") %>%
select(workerid, short_sent, rating) %>%
spread(short_sent, rating)
alpha.al <- as.matrix(select(wide.active_learning, -workerid))
alpha(x = alpha.al)
##
## Reliability analysis
## Call: alpha(x = alpha.al)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd
## 0.75 0.78 0.79 0.31 3.6 0.035 5.1 0.8
##
## lower alpha upper 95% confidence boundaries
## 0.68 0.75 0.82
##
## Reliability if an item is dropped:
## raw_alpha std.alpha
## can learn about good and bad behavior 0.73 0.76
## can teach themselves by playing 0.72 0.75
## dont need to learn math before school 0.71 0.75
## learn before speaking 0.69 0.74
## new experiences and sensations 0.71 0.74
## not helpful to explain reasons for rules 0.71 0.75
## reading not helpful before they can speak 0.70 0.74
## repetetive behaviors to explore cause and effect 0.81 0.82
## G6(smc) average_r S/N
## can learn about good and bad behavior 0.77 0.31 3.2
## can teach themselves by playing 0.75 0.30 3.0
## dont need to learn math before school 0.76 0.30 3.0
## learn before speaking 0.74 0.29 2.9
## new experiences and sensations 0.74 0.29 2.9
## not helpful to explain reasons for rules 0.75 0.30 3.0
## reading not helpful before they can speak 0.74 0.29 2.8
## repetetive behaviors to explore cause and effect 0.81 0.40 4.7
## alpha se
## can learn about good and bad behavior 0.038
## can teach themselves by playing 0.039
## dont need to learn math before school 0.040
## learn before speaking 0.042
## new experiences and sensations 0.040
## not helpful to explain reasons for rules 0.040
## reading not helpful before they can speak 0.041
## repetetive behaviors to explore cause and effect 0.031
##
## Item statistics
## n raw.r std.r r.cor
## can learn about good and bad behavior 250 0.57 0.62 0.528
## can teach themselves by playing 250 0.63 0.69 0.630
## dont need to learn math before school 250 0.68 0.66 0.592
## learn before speaking 250 0.73 0.71 0.677
## new experiences and sensations 250 0.67 0.71 0.671
## not helpful to explain reasons for rules 250 0.71 0.67 0.615
## reading not helpful before they can speak 250 0.73 0.72 0.693
## repetetive behaviors to explore cause and effect 250 0.29 0.25 0.071
## r.drop mean sd
## can learn about good and bad behavior 0.46 5.4 0.96
## can teach themselves by playing 0.54 5.5 0.83
## dont need to learn math before school 0.52 5.1 1.49
## learn before speaking 0.60 5.2 1.43
## new experiences and sensations 0.57 5.4 0.96
## not helpful to explain reasons for rules 0.54 4.8 1.65
## reading not helpful before they can speak 0.60 5.3 1.35
## repetetive behaviors to explore cause and effect 0.04 3.9 1.62
##
## Non missing response frequency for each item
## 0 1 2 3 4
## can learn about good and bad behavior 0.00 0.01 0.00 0.05 0.08
## can teach themselves by playing 0.00 0.00 0.00 0.04 0.06
## dont need to learn math before school 0.02 0.03 0.03 0.06 0.14
## learn before speaking 0.01 0.04 0.03 0.06 0.07
## new experiences and sensations 0.00 0.00 0.01 0.04 0.08
## not helpful to explain reasons for rules 0.04 0.04 0.05 0.06 0.12
## reading not helpful before they can speak 0.02 0.02 0.04 0.03 0.08
## repetetive behaviors to explore cause and effect 0.05 0.04 0.08 0.22 0.20
## 5 6 miss
## can learn about good and bad behavior 0.24 0.62 0
## can teach themselves by playing 0.26 0.64 0
## dont need to learn math before school 0.10 0.62 0
## learn before speaking 0.13 0.67 0
## new experiences and sensations 0.23 0.63 0
## not helpful to explain reasons for rules 0.20 0.50 0
## reading not helpful before they can speak 0.14 0.68 0
## repetetive behaviors to explore cause and effect 0.23 0.18 0
Create a data frame that has subscale scores.
ss <- d %>%
dplyr::group_by(workerid, category) %>%
dplyr::summarise(rating = mean(rating))
ss <- left_join(ss, subinfo)
correlation of subscale scores.
ss_wide <- ss %>%
spread(category, rating)%>%
select(active_learning, affection, rules_respect)
cor(ss_wide, y = NULL, use = "everything",
method = c("pearson", "kendall", "spearman"))
## active_learning affection rules_respect
## active_learning 1.0000000 0.6401797 0.3925027
## affection 0.6401797 1.0000000 0.1921928
## rules_respect 0.3925027 0.1921928 1.0000000
ms <- ss %>%
filter(ses != "") %>%
mutate(ses.level = cut(as.numeric(ses), c(0,3,6,10))) %>%
group_by(ses.level, category) %>%
multi_boot_standard(col = "rating")
ggplot(ms, aes(category, mean, fill=ses.level)) +
geom_bar(stat="identity", position = "dodge") +
geom_linerange(aes(ymin = ci_lower, ymax = ci_upper),
position = position_dodge(width = .9)) +
scale_fill_solarized()
ms <- ss %>%
filter(gender %in% c("Male","Female")) %>%
group_by(gender, category) %>%
multi_boot_standard(col = "rating")
ggplot(ms, aes(category, mean, fill=gender)) +
geom_bar(stat="identity", position = "dodge") +
geom_linerange(aes(ymin = ci_lower, ymax = ci_upper),
position = position_dodge(width = .9)) +
scale_fill_solarized()
knitr::kable(coef(summary(lmer(rating ~ category * gender + (1|workerid),
data = ss %>% filter(gender %in% c("Male","Female"))))), digits = 2)
| Estimate | Std. Error | t value | |
|---|---|---|---|
| (Intercept) | 5.25 | 0.08 | 68.35 |
| categoryaffection | -0.43 | 0.09 | -4.97 |
| categoryrules_respect | -0.77 | 0.09 | -8.85 |
| genderMale | -0.34 | 0.11 | -3.15 |
| categoryaffection:genderMale | -0.04 | 0.12 | -0.32 |
| categoryrules_respect:genderMale | 0.22 | 0.12 | 1.79 |
ms <- ss %>%
filter(!is.na(children), children != "") %>%
mutate(parent = children != "0") %>%
group_by(parent, category) %>%
multi_boot_standard(col = "rating")
ggplot(ms, aes(category, mean, fill=parent)) +
geom_bar(stat="identity", position = "dodge") +
geom_linerange(aes(ymin = ci_lower, ymax = ci_upper),
position = position_dodge(width = .9)) +
scale_fill_solarized()
knitr::kable(coef(summary(lmer(rating ~ category * parent + (1|workerid),
data = ss %>%
filter(!is.na(children), children != "") %>%
mutate(parent = children != "0")))), digits = 2)
| Estimate | Std. Error | t value | |
|---|---|---|---|
| (Intercept) | 5.07 | 0.08 | 66.66 |
| categoryaffection | -0.51 | 0.08 | -6.07 |
| categoryrules_respect | -0.70 | 0.08 | -8.35 |
| parentTRUE | -0.01 | 0.11 | -0.06 |
| categoryaffection:parentTRUE | 0.12 | 0.12 | 0.97 |
| categoryrules_respect:parentTRUE | 0.08 | 0.12 | 0.66 |
Drop the sparsest groups.
ms <- ss %>%
filter(!is.na(education)) %>%
group_by(education, category) %>%
filter(n() > 5) %>%
multi_boot_standard(col = "rating")
ggplot(ms, aes(category, mean, fill=education)) +
geom_bar(stat="identity", position = "dodge") +
geom_linerange(aes(ymin = ci_lower, ymax = ci_upper),
position = position_dodge(width = .9)) +
scale_fill_solarized()
Drop the sparsest groups again.
ms <- ss %>%
filter(!is.na(age)) %>%
group_by(age, category) %>%
filter(n() > 5) %>%
multi_boot_standard(col = "rating")
ggplot(ms, aes(category, mean, fill=age)) +
geom_bar(stat="identity", position = "dodge") +
geom_linerange(aes(ymin = ci_lower, ymax = ci_upper),
position = position_dodge(width = .9)) +
scale_fill_solarized()
ms <- ss %>%
filter(!is.na(children)) %>%
group_by(children, category) %>%
filter(n() > 5) %>%
multi_boot_standard(col = "rating")
ggplot(ms, aes(category, mean, fill=children)) +
geom_bar(stat="identity", position = "dodge") +
geom_linerange(aes(ymin = ci_lower, ymax = ci_upper),
position = position_dodge(width = .9)) +
scale_fill_solarized()
ms <- ss %>%
filter(ethnicity != "") %>%
group_by(ethnicity, category) %>%
filter(n() > 5) %>%
multi_boot_standard(col = "rating")
ggplot(ms, aes(category, mean, fill=ethnicity)) +
geom_bar(stat="identity", position = "dodge") +
geom_linerange(aes(ymin = ci_lower, ymax = ci_upper),
position = position_dodge(width = .9)) +
scale_fill_solarized()
Get eigenvalues for determining number of factors.
att.mat <- select(wide.attitudes, -workerid)
ev <- eigen(cor(x=att.mat)) # get eigenvalues
ap <- parallel(subject=nrow(att.mat), var=ncol(att.mat),
rep=100,cent=.05)
nS <- nScree(x=ev$values, aparallel=ap$eigen$qevpea)
plotnScree(nS)
Now plot factor analysis
n.factors <- 3
af <- factanal(x=att.mat, factors = n.factors, scores = "regression")
loadings <- data.frame(af$loadings[,1:n.factors]) %>%
mutate(item = rownames(af$loadings)) %>%
gather(factor, loading, starts_with("Factor"))
loadings$item <- factor(loadings$item)
labels$item <- labels$short_sent
loadings <- left_join(loadings, labels, by = "item")
qplot(factor, item, fill=loading, geom="tile", data = loadings) +
scale_fill_continuous(low="#000000", high="#FFFFFF") +
facet_grid(category ~ ., scales = "free_y")
qplot(factor, item, fill=loading > .35, geom="tile", data = loadings) +
scale_fill_solarized() +
facet_grid(category ~ ., scales = "free_y")
Merge back in subject id info.
a.scores <- af$scores %>%
data.frame %>%
mutate(workerid = as.character(wide.attitudes$workerid)) %>%
left_join(subinfo)
a.factor.names <- c("Early Learning","Affection and Attachment", "Rules and Respect")
mf <- a.scores %>%
gather(factor, score, starts_with("Factor")) %>%
filter(ses != "") %>%
mutate(ses.level = cut(as.numeric(ses), c(0,3,6,10)),
factor.num = as.numeric(str_replace(factor,"Factor","")),
factor.name = a.factor.names[factor.num]) %>%
group_by(ses.level, factor.name) %>%
multi_boot_standard(col = "score")
ggplot(mf, aes(factor.name, mean, fill=ses.level)) +
geom_bar(stat="identity", position = "dodge") +
geom_linerange(aes(ymin = ci_lower, ymax = ci_upper),
position = position_dodge(width = .9)) +
scale_fill_solarized()
mf <- a.scores %>%
gather(factor, score, starts_with("Factor")) %>%
filter(gender %in% c("Male","Female")) %>%
mutate(factor.num = as.numeric(str_replace(factor,"Factor","")),
factor.name = a.factor.names[factor.num]) %>%
group_by(gender, factor.name) %>%
multi_boot_standard(col = "score")
ggplot(mf, aes(factor.name, mean, fill=gender)) +
geom_bar(stat="identity", position = "dodge") +
geom_linerange(aes(ymin = ci_lower, ymax = ci_upper),
position = position_dodge(width = .9)) +
scale_fill_solarized()
mf <- a.scores %>%
gather(factor, score, starts_with("Factor")) %>%
filter(education != "") %>%
mutate(factor.num = as.numeric(str_replace(factor,"Factor","")),
factor.name = a.factor.names[factor.num]) %>%
group_by(education, factor.name) %>%
multi_boot_standard(col = "score")
ggplot(mf, aes(factor.name, mean, fill=education)) +
geom_bar(stat="identity", position = "dodge") +
geom_linerange(aes(ymin = ci_lower, ymax = ci_upper),
position = position_dodge(width = .9)) +
scale_fill_solarized()
mf <- a.scores %>%
gather(factor, score, starts_with("Factor")) %>%
filter(age != "") %>%
mutate(factor.num = as.numeric(str_replace(factor,"Factor","")),
factor.name = a.factor.names[factor.num]) %>%
group_by(age, factor.name) %>%
multi_boot_standard(col = "score")
ggplot(mf, aes(factor.name, mean, fill=age)) +
geom_bar(stat="identity", position = "dodge") +
geom_linerange(aes(ymin = ci_lower, ymax = ci_upper),
position = position_dodge(width = .9)) +
scale_fill_solarized()
Do you have children?
mf <- a.scores %>%
gather(factor, score, starts_with("Factor")) %>%
filter(children != "") %>%
mutate(children = children %in% c("1","2","3","4","5","morethan5"),
factor.num = as.numeric(str_replace(factor,"Factor","")),
factor.name = a.factor.names[factor.num]) %>%
group_by(children, factor.name) %>%
multi_boot_standard(col = "score")
ggplot(mf, aes(factor.name, mean, fill=children)) +
geom_bar(stat="identity", position = "dodge") +
geom_linerange(aes(ymin = ci_lower, ymax = ci_upper),
position = position_dodge(width = .9)) +
scale_fill_solarized()
How many?
mf <- a.scores %>%
gather(factor, score, starts_with("Factor")) %>%
filter(children != "") %>%
mutate(n.children = children,
factor.num = as.numeric(str_replace(factor,"Factor","")),
factor.name = a.factor.names[factor.num]) %>%
group_by(n.children, factor.name) %>%
multi_boot_standard(col = "score")
ggplot(mf, aes(factor.name, mean, fill=n.children)) +
geom_bar(stat="identity", position = "dodge") +
geom_linerange(aes(ymin = ci_lower, ymax = ci_upper),
position = position_dodge(width = .9)) +
scale_fill_solarized()
mf <- a.scores %>%
gather(factor, score, starts_with("Factor")) %>%
filter(ethnicity != "") %>%
mutate(hispanic = ethnicity== "Hispanic",
factor.num = as.numeric(str_replace(factor,"Factor","")),
factor.name = a.factor.names[factor.num]) %>%
group_by(hispanic, factor.name) %>%
multi_boot_standard(col = "score")
ggplot(mf, aes(factor.name, mean, fill=hispanic)) +
geom_bar(stat="identity", position = "dodge") +
geom_linerange(aes(ymin = ci_lower, ymax = ci_upper),
position = position_dodge(width = .9)) +
scale_fill_solarized()
Chronbach’s alpha for Rules and Respect is up to .8 from .69; Affection and attachment is .71 down from .75; Early Learning is down to .75 from .76.
Parallel analysis revealed 3 factors, and the items load somewhat well onto the factors. Rules and Respect items are all on one factor which is nice; Affection and Attachment and Early Learning are cross-loading. …