library(processR)
library(lavaan)
fit=lm(justify ~ frame*skeptic,data=disaster)
labels=list(X="frame",W="skeptic",Y="justify")
pmacroModel(1,labels=labels)
statisticalDiagram(1,labels=labels)
modelsSummaryTable(list(fit),labels=labels)
Consequent | ||||
Y(justify) | ||||
Antecedent | Coef | SE | t | p |
X(frame) | -0.562 | 0.218 | -2.581 | .011 |
W(skeptic) | 0.105 | 0.038 | 2.756 | .006 |
X:W(frame:skeptic) | 0.201 | 0.055 | 3.640 | <.001 |
Constant | 2.452 | 0.149 | 16.449 | <.001 |
Observations | 211 | |||
R2 | 0.246 | |||
Adjusted R2 | 0.235 | |||
Residual SE | 0.813 ( df = 207) | |||
F statistic | F(3,207) = 22.543, p < .001 | |||
condPlot(fit,rangemode=2,xpos=0.7,labels=c("Climate change(X=1)","Natural causes(X=0)"))
condPlot(fit,mode=2,xpos=0.6)
condPlot(fit,mode=3,rangemode=2,xpos=0.5,ypos=c(0,2))
jnPlot(fit,plot=FALSE)
JOHNSON-NEYMAN INTERVAL
When skeptic is OUTSIDE the interval [1.171, 3.934], the slope of
frame is p < .05.
Note: The range of observed values of skeptic is [1.000, 9.000]
moderator=list(name="skeptic",site=list("c"))
model=tripleEquation(labels=labels,moderator=moderator)
cat(model)
semfit=sem(model=model,data=disaster)
summary(semfit)
justify~c1*frame+c2*skeptic+c3*frame:skeptic
skeptic ~ skeptic.mean*1
skeptic ~~ skeptic.var*skeptic
direct :=c1+c3*skeptic.mean
direct.below:=c1+c3*(skeptic.mean-sqrt(skeptic.var))
direct.above:=c1+c3*(skeptic.mean+sqrt(skeptic.var))
lavaan 0.6-3 ended normally after 24 iterations
Optimization method NLMINB
Number of free parameters 12
Number of observations 211
Estimator ML
Model Fit Test Statistic 136.428
Degrees of freedom 2
P-value (Chi-square) 0.000
Parameter Estimates:
Information Expected
Information saturated (h1) model Structured
Standard Errors Standard
Regressions:
Estimate Std.Err z-value P(>|z|)
justify ~
frame (c1) -0.562 0.175 -3.211 0.001
skeptic (c2) 0.105 0.027 3.844 0.000
frm:skptc (c3) 0.201 0.040 5.077 0.000
Covariances:
Estimate Std.Err z-value P(>|z|)
frame ~~
frame:skeptic 0.854 0.096 8.890 0.000
Intercepts:
Estimate Std.Err z-value P(>|z|)
skeptic (skp.) 3.378 0.140 24.196 0.000
.justify 2.452 0.120 20.416 0.000
frame 0.479 0.034 13.919 0.000
frm:skp 1.637 0.152 10.771 0.000
Variances:
Estimate Std.Err z-value P(>|z|)
skeptic (skp.) 4.113 0.400 10.271 0.000
.justify 0.648 0.063 10.271 0.000
frame 0.250 0.024 10.271 0.000
frm:skp 4.877 0.475 10.271 0.000
Defined Parameters:
Estimate Std.Err z-value P(>|z|)
direct 0.117 0.114 1.023 0.306
direct.below -0.291 0.142 -2.045 0.041
direct.above 0.525 0.140 3.743 0.000
statisticalDiagram(1,labels=labels,fit=semfit,whatLabel = "est")
labels=list(X="negemot",Y="govact",W="age",C1="posemot",C2="ideology",C3="sex")
moderator=list(name="age",site=list("c"))
covar=list(name=c("posemot","ideology","sex"),site=list("Y","Y","Y"))
pmacroModel(1,labels=labels,covar=covar)
statisticalDiagram(1,labels=labels,covar=covar)
fit=lm(govact~negemot*age+ideology+sex,data=glbwarm)
modelsSummaryTable(list(fit),labels=labels)
Consequent | ||||
Y(govact) | ||||
Antecedent | Coef | SE | t | p |
X(negemot) | 0.114 | 0.082 | 1.388 | .165 |
W(age) | -0.024 | 0.006 | -4.044 | <.001 |
C2(ideology) | -0.211 | 0.027 | -7.883 | <.001 |
C3(sex) | -0.016 | 0.076 | -0.212 | .832 |
X:W(negemot:age) | 0.006 | 0.002 | 4.145 | <.001 |
Constant | 5.132 | 0.334 | 15.371 | <.001 |
Observations | 815 | |||
R2 | 0.400 | |||
Adjusted R2 | 0.397 | |||
Residual SE | 1.057 ( df = 809) | |||
F statistic | F(5,809) = 108.033, p < .001 | |||
condPlot(fit,xmode=2,pred.values=c(30,70),hjust=c(-0.1,-0.1,1.1))
condPlot(fit,xmode=2,mode=2,pred.values=c(30,50,70),xpos=0.2)
condPlot(fit,xmode=2,modx.values=2:5,mode=3,xpos=0.6,hjust=c(-0.1,-0.1,-0.1,1.1))
jnPlot(fit,plot=FALSE)
JOHNSON-NEYMAN INTERVAL
When age is OUTSIDE the interval [-80.462, 5.112], the slope of
negemot is p < .05.
Note: The range of observed values of age is [17.000, 87.000]
model=tripleEquation(labels=labels,moderator=moderator,covar=covar)
cat(model)
govact ~ c1*negemot+c2*age+c3*negemot:age + g1*posemot + g2*ideology + g3*sex
age ~ age.mean*1
age ~~ age.var*age
direct :=c1+c3*age.mean
direct.below:=c1+c3*(age.mean-sqrt(age.var))
direct.above:=c1+c3*(age.mean+sqrt(age.var))
semfit=sem(model=model,data=glbwarm)
summary(semfit)
lavaan 0.6-3 ended normally after 24 iterations
Optimization method NLMINB
Number of free parameters 30
Number of observations 815
Estimator ML
Model Fit Test Statistic 1580.004
Degrees of freedom 5
P-value (Chi-square) 0.000
Parameter Estimates:
Information Expected
Information saturated (h1) model Structured
Standard Errors Standard
Regressions:
Estimate Std.Err z-value P(>|z|)
govact ~
negemot (c1) 0.120 0.041 2.942 0.003
age (c2) -0.024 0.002 -10.572 0.000
negemot:g (c3) 0.006 0.001 10.498 0.000
posemot (g1) -0.021 0.028 -0.772 0.440
ideology (g2) -0.212 0.026 -7.987 0.000
sex (g3) -0.011 0.076 -0.148 0.883
Covariances:
Estimate Std.Err z-value P(>|z|)
negemot ~~
negemot:age 113.943 6.562 17.363 0.000
posemot 0.263 0.073 3.622 0.000
ideology -0.805 0.086 -9.402 0.000
sex -0.090 0.027 -3.327 0.001
negemot:age ~~
posemot 15.197 4.620 3.290 0.001
ideology -24.533 5.223 -4.697 0.000
sex 0.163 1.705 0.096 0.924
posemot ~~
ideology -0.060 0.071 -0.838 0.402
sex 0.050 0.024 2.115 0.034
ideology ~~
sex 0.100 0.027 3.761 0.000
Intercepts:
Estimate Std.Err z-value P(>|z|)
age (ag.m) 49.536 0.572 86.649 0.000
.govact 5.174 0.217 23.807 0.000
negemot 3.558 0.054 66.497 0.000
negmt:g 174.831 3.410 51.268 0.000
posemot 3.132 0.047 66.446 0.000
ideolgy 4.083 0.053 77.159 0.000
sex 0.488 0.018 27.890 0.000
Variances:
Estimate Std.Err z-value P(>|z|)
age (ag.v) 266.367 13.195 20.187 0.000
.govact 1.108 0.055 20.187 0.000
negemot 2.333 0.116 20.187 0.000
negmt:g 9477.578 469.498 20.187 0.000
posemot 1.811 0.090 20.187 0.000
ideolgy 2.283 0.113 20.187 0.000
sex 0.250 0.012 20.187 0.000
Defined Parameters:
Estimate Std.Err z-value P(>|z|)
direct 0.433 0.026 16.446 0.000
direct.below 0.330 0.029 11.496 0.000
direct.above 0.537 0.028 19.320 0.000
estimatesTable2(semfit,vanilla=TRUE)
Variables | Predictors | B | SE | z | p | β |
govact | negemot | 0.12 | 0.04 | 2.94 | 0.003 | 0.13 |
govact | age | -0.02 | 0.00 | -10.57 | < 0.001 | -0.27 |
govact | negemot:age | 0.01 | 0.00 | 10.50 | < 0.001 | 0.43 |
govact | posemot | -0.02 | 0.03 | -0.77 | 0.440 | -0.02 |
govact | ideology | -0.21 | 0.03 | -7.99 | < 0.001 | -0.22 |
govact | sex | -0.01 | 0.08 | -0.15 | 0.883 | -0.00 |
corTable2(semfit)
rowname | govact | negemot | age | negemot.age | posemot | ideology | sex |
govact | 1 | ||||||
negemot | 0.58*** | 1 | |||||
age | -0.10** | -0.06 | 1 | ||||
negemot.age | 0.44*** | 0.77*** | 0.55*** | 1 | |||
posemot | 0.04 | 0.13*** | 0.04 | 0.12** | 1 | ||
ideology | -0.42*** | -0.35*** | 0.21*** | -0.17*** | -0.03 | 1 | |
sex | -0.10** | -0.12** | 0.17*** | 0.00 | 0.07* | 0.13*** | 1 |
corPlot(semfit)
modelFitTable2(semfit,vanilla=TRUE)
chisq | df | x2df | p | CFI | GFI | AGFI | TLI | RMR | SRMR | RMSEA(95% CI) | AIC | BIC |
1580.00 | 5.00 | 316.00 | 0.00 | 0.21 | 0.99 | 0.90 | -0.74 | 147.37 | 0.11 | 0.62(0.6-0.65) | 28160.94 | 28302.03 |
modelFitGuideTable2(vanilla=TRUE)
x2df | p | CFI | GFI | AGFI | TLI | RMR | SRMR | RMESA | AIC | BIC |
< 3 | > 0.05 | > 0.9 | > 0.9 | > 0.9 | > 0.9 | < 0.05 | < 0.05 | < 0.1(< 0.05) | the lower, the better | the lower, the better |
statisticalDiagram(1,labels=labels,covar=covar,fit=semfit,whatLabel = "est")