recall_lmer_longform <- read_delim("C:/Users/dasil/Dropbox/SCnegimages/Analysis_filesupdated/recall_lmer_longform.txt", "\t", escape_double = FALSE, trim_ws = TRUE)
Parsed with column specification:
cols(
subID = col_integer(),
JF = col_integer(),
variable = col_character(),
value = col_integer(),
sociality = col_character(),
valence = col_character()
)
recall_lmer_longform <- within(recall_lmer_longform, {
SubID <- factor(subID)
variable <- as.factor(variable)
sociality <- as.factor(sociality)
valence <- as.factor(valence)
})
negSocVSall<-c(-.2,1,-.2,-.2,-.2,-.2)
#contrasts(jf_neg_items$variable) <- cbind(negSocVSall)
negNSvsotherNS<-c(1,0,-.5,0,-.5,0)
#contrasts(jf_neg_items$variable) <- cbind(negNSvsotherNS)
contrasts(recall_lmer_longform$variable)<-cbind(negSocVSall,negNSvsotherNS )
compare the models and note differences between gaussian and binomial models:
m.old<-lmer(value~variable*scale(JF)+(1|subID),data=recall_lmer_longform) ###orignal model
summary(m.old)
Linear mixed model fit by REML
t-tests use Satterthwaite approximations to degrees of freedom ['lmerMod']
Formula: value ~ variable * scale(JF) + (1 | subID)
Data: recall_lmer_longform
REML criterion at convergence: 1390.3
Scaled residuals:
Min 1Q Median 3Q Max
-2.36257 -0.70489 -0.01487 0.65663 2.53505
Random effects:
Groups Name Variance Std.Dev.
subID (Intercept) 0.3196 0.5654
Residual 1.4033 1.1846
Number of obs: 414, groups: subID, 69
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 2.41787 0.08957 67.00000 26.996 < 2e-16 ***
variablenegSocVSall 1.04589 0.13018 335.00000 8.034 1.64e-14 ***
variablenegNSvsotherNS 0.69565 0.11644 335.00000 5.974 5.90e-09 ***
variable -0.41322 0.14261 335.00000 -2.898 0.00401 **
variable 0.70615 0.14261 335.00000 4.952 1.17e-06 ***
variable 0.02156 0.14261 335.00000 0.151 0.87992
scale(JF) -0.16585 0.08967 67.00000 -1.849 0.06881 .
variablenegSocVSall:scale(JF) -0.35037 0.13034 335.00000 -2.688 0.00755 **
variablenegNSvsotherNS:scale(JF) -0.11226 0.11658 335.00000 -0.963 0.33626
variable:scale(JF) 0.22722 0.14278 335.00000 1.591 0.11246
variable:scale(JF) -0.11061 0.14278 335.00000 -0.775 0.43908
variable:scale(JF) 0.01442 0.14278 335.00000 0.101 0.91961
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) vrbSVS vrNSNS varibl varibl varibl sc(JF) vSVS:( vNSNS: v:(JF) v:(JF)
vrblngScVSl 0.000
vrblngNSvNS 0.000 0.000
variable 0.000 0.000 0.000
variable 0.000 0.000 0.000 0.000
variable 0.000 0.000 0.000 0.000 0.000
scale(JF) 0.000 0.000 0.000 0.000 0.000 0.000
vrbSVS:(JF) 0.000 0.000 0.000 0.000 0.000 0.000 0.000
vrNSNS:(JF) 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
vrbl:sc(JF) 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
vrbl:sc(JF) 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
vrbl:sc(JF) 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
recall_lmer_longform$weight<-rep(8,414) ###create weights in denominator
recall_lmer_longform$prop<-recall_lmer_longform$value/recall_lmer_longform$weight #create proportion correct
m.old.g<-glmer(prop~variable*scale(JF)+(1|subID),weights=weight,family=binomial,data=recall_lmer_longform)#### from .007 to .03
summary(m.old.g)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: prop ~ variable * scale(JF) + (1 | subID)
Data: recall_lmer_longform
Weights: weight
AIC BIC logLik deviance df.resid
1376.4 1428.8 -675.2 1350.4 401
Scaled residuals:
Min 1Q Median 3Q Max
-2.0570 -0.6575 -0.0103 0.5978 2.5613
Random effects:
Groups Name Variance Std.Dev.
subID (Intercept) 0.103 0.3209
Number of obs: 414, groups: subID, 69
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.890534 0.055524 -16.039 < 2e-16 ***
variablenegSocVSall 0.609999 0.081851 7.453 9.16e-14 ***
variablenegNSvsotherNS 0.431787 0.076194 5.667 1.45e-08 ***
variable -0.250792 0.102618 -2.444 0.0145 *
variable 0.478652 0.100123 4.781 1.75e-06 ***
variable 0.046569 0.097109 0.480 0.6315
scale(JF) -0.090647 0.055407 -1.636 0.1018
variablenegSocVSall:scale(JF) -0.179936 0.081908 -2.197 0.0280 *
variablenegNSvsotherNS:scale(JF) -0.052769 0.075943 -0.695 0.4871
variable:scale(JF) 0.151332 0.104248 1.452 0.1466
variable:scale(JF) -0.059043 0.099958 -0.591 0.5547
variable:scale(JF) 0.002757 0.097010 0.028 0.9773
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) vrbSVS vrNSNS varibl varibl varibl sc(JF) vSVS:( vNSNS: v:(JF) v:(JF)
vrblngScVSl -0.065
vrblngNSvNS -0.066 0.044
variable 0.026 -0.017 0.061
variable -0.071 0.048 0.086 0.052
variable -0.019 0.013 0.065 0.004 0.068
scale(JF) 0.010 0.002 -0.002 -0.020 0.002 0.002
vrbSVS:(JF) 0.004 0.025 0.000 0.014 -0.002 -0.001 -0.063
vrNSNS:(JF) -0.001 0.000 0.032 0.001 -0.001 0.001 -0.064 0.044
vrbl:sc(JF) -0.021 0.014 0.001 -0.031 0.005 0.008 0.036 -0.025 0.062
vrbl:sc(JF) 0.003 -0.002 -0.001 0.005 0.030 -0.001 -0.072 0.049 0.088 0.050
vrbl:sc(JF) 0.002 -0.001 0.001 0.008 -0.001 0.027 -0.021 0.014 0.067 -0.001 0.071