RESILIENCE Items taken from what Herb Marsh has identified as working as part of PERMA.
RES.1 , RES.2 , RES.3
Two factors Consitency and preseverence
library(lavaan)
## This is lavaan 0.5-18
## lavaan is BETA software! Please report any bugs.
library(semPlot)
library(dplyr)
##
## Attaching package: 'dplyr'
##
## The following objects are masked from 'package:stats':
##
## filter, lag
##
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(GPArotation)
library(psych)
library(car)
##
## Attaching package: 'car'
##
## The following object is masked from 'package:psych':
##
## logit
library(ggplot2)
##
## Attaching package: 'ggplot2'
##
## The following object is masked from 'package:psych':
##
## %+%
library(GGally)
##
## Attaching package: 'GGally'
##
## The following object is masked from 'package:dplyr':
##
## nasa
all_surveys<-read.csv("allsurveysYT1.csv")
all_surveys<-tbl_df(all_surveys)
all_surveys
## Source: local data frame [1,160 x 124]
##
## X Dataset First.Name Last.Name Gender Age Grade ASDQII_1 ASDQII_2
## 1 1 ASCGW1 Charmie Vang 2 5 10 6 6
## 2 2 ASCGW1 malorie mauthe 2 4 10 5 5
## 3 3 ASCGW1 Roi Stern 1 6 12 4 3
## 4 4 ASCGW1 Mattan Yedidya 1 5 12 5 5
## 5 5 ASCGW1 Harrison Smithling 1 3 9 5 4
## 6 6 ASCGW1 Emma Mason 2 3 7 5 5
## 7 7 ASCGW1 Dovi Brackman 1 2 7 5 3
## 8 8 ASCGW1 Lexi Markowitz 2 5 10 4 4
## 9 9 ASCGW1 Yarden Mor 2 3 9 6 5
## 10 10 ASCGW1 Amalia Kamlet 2 4 9 5 1
## .. .. ... ... ... ... ... ... ... ...
## Variables not shown: ASDQII_3 (int), ASDQII_4 (int), ASDQII_5 (int),
## ASDQII_6 (int), ASDQII_7 (int), ASDQII_8 (int), ASDQII_9 (int),
## ASDQII_10 (int), ASDQII_11 (int), ASDQII_12 (int), ASDQII_13 (int),
## ASDQII_14 (int), ASDQII_15 (int), ASDQII_16 (int), ASDQII_17 (int),
## ASDQII_18 (int), ASDQII_19 (int), ASDQII_20 (int), CPS_1 (int), CPS_2
## (int), CPS_3 (int), CPS_4 (int), CPS_5 (int), CPS_6 (int), CPS_7 (int),
## CPS_8 (int), CPS_9 (int), CPS_10 (int), MLQ_1 (int), MLQ_2 (int), MLQ_3
## (int), MLQ_4 (int), MLQ_5 (int), MLQ_6 (int), MLQ_7 (int), MLQ_8 (int),
## MLQ_9 (int), MLQ_10 (int), LET_1 (int), LET_2 (int), LET_3 (int), LET_4
## (int), LET_5 (int), LET_6 (int), PWB_1 (int), PWB_2 (int), PWB_3 (int),
## PWB_4 (int), PWB_5 (int), PWB_6 (int), PWB_7 (int), PWB_8 (int), PWB_9
## (int), APSI_1 (int), APSI_2 (int), APSI_3 (int), APSI_4 (int), APSI_5
## (int), APSI_6 (int), APSI_7 (int), APSI_8 (int), HAPPI.1_1 (int),
## HAPPI.2_1 (int), HAPPI.3_1 (int), HAPPI.4_1 (int), RES.1 (int), RES.2
## (int), RES.3 (int), SDQI_1 (int), SDQI_2 (int), SDQI_3 (int), SDQI_4
## (int), SDQI_5 (int), SDQI_6 (int), SDQI_7 (int), SDQI_8 (int), SDQI_9
## (int), SDQI_10 (int), LOT.R_1 (int), LOT.R_2 (int), LOT.R_3 (int),
## LOT.R_4 (int), LOT.R_5 (int), LOT.R_6 (int), LOT.R_7 (int), LOT.R_8
## (int), LOT.R_9 (int), LOT.R_10 (int), LS_1 (int), LS_2 (int), LS_3
## (int), LS_4 (int), LS_5 (int), CPS1 (lgl), PNA_1 (int), PNA_2 (int),
## PNA_3 (int), PNA_4 (int), PNA_5 (int), PNA_6 (int), PNA_7 (int), PNA_8
## (int), PNA_9 (int), PNA_10 (int), PNA_11 (int), PNA_12 (int), PNA_13
## (int), PNA_14 (int), PNA_15 (int), PNA_16 (int), PNA_17 (int), PNA_18
## (int), PNA_19 (int), PNA_20 (int), Q46_11 (int)
RES<-select(all_surveys, RES.1 , RES.2 , RES.3)
RES<- data.frame(apply(RES,2, as.numeric))
RES<-tbl_df(RES)
RES
## Source: local data frame [1,160 x 3]
##
## RES.1 RES.2 RES.3
## 1 8 8 8
## 2 8 9 9
## 3 7 7 7
## 4 11 9 9
## 5 8 7 7
## 6 8 9 8
## 7 7 6 7
## 8 12 11 11
## 9 10 8 9
## 10 4 5 6
## .. ... ... ...
One factor Model
one.factor = 'RES =~ RES.1 + RES.2 + RES.3
'
one.fit=cfa(one.factor, data=RES, missing = "fiml", std.lv = T)
## Warning in lav_data_full(data = data, group = group, group.label = group.label, : lavaan WARNING: some cases are empty and will be removed:
## 17 22 23 24 28 29 43 45 78 79 80 81 84 85 86 87 93 94 95 110 111 112 116 121 122 123 124 125 128 129 130 131 133 135 137 138 140 147 151 152 155 156 162 166 169 170 171 172 173 174 176 177 179 180 183 184 186 187 188 189 192 194 195 197 200 202 203 204 207 208 210 212 214 215 217 220 222 223 224 226 227 228 229 230 234 238 240 243 245 246 247 249 252 255 256 265 266 267 268 270 271 274 275 280 281 282 284 286 287 289 291 292 298 300 304 309 310 311 312 315 316 317 320 322 325 327 330 333 334 336 339 340 344 348 350 351 352 354 355 357 360 361 362 364 365 366 367 368 369 370 371 372 373 374 375 376 377 379 380 381 384 385 386 389 390 397 398 399 400 401 402 403 404 405 406 407 408 410 416 417 418 419 420 421 422 423 424 425 427 428 429 430 431 432 434 436 444 445 446 447 448 452 453 454 455 456 457 459 460 462 463 464 465 467 468 470 472 473 474 475 476 478 481 482 485 486 490 491 493 495 539 540 541 542 543 544 545 546 547 548 549 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 662 679 687 723 756 760 782 783 784 785 809 810 829 903 904 906 907 909 910 911 1109 1110 1111 1112 1113 1114 1116 1117 1120 1121 1122 1125 1126 1127 1128 1129 1130 1131 1132 1134 1136 1137 1138 1139 1140 1142 1143 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1157 1158 1159 1160
summary(one.fit, standardized = TRUE, rsquare=TRUE)
## lavaan (0.5-18) converged normally after 17 iterations
##
## Used Total
## Number of observations 797 1160
##
## Number of missing patterns 1
##
## Estimator ML
## Minimum Function Test Statistic 0.000
## Degrees of freedom 0
## Minimum Function Value 0.0000000000000
##
## Parameter estimates:
##
## Information Observed
## Standard Errors Standard
##
## Estimate Std.err Z-value P(>|z|) Std.lv Std.all
## Latent variables:
## RES =~
## RES.1 2.300 0.078 29.437 0.000 2.300 0.860
## RES.2 1.925 0.060 32.000 0.000 1.925 0.909
## RES.3 1.930 0.066 29.409 0.000 1.930 0.860
##
## Intercepts:
## RES.1 7.794 0.095 82.307 0.000 7.794 2.915
## RES.2 7.471 0.075 99.586 0.000 7.471 3.528
## RES.3 7.404 0.080 93.118 0.000 7.404 3.298
## RES 0.000 0.000 0.000
##
## Variances:
## RES.1 1.859 0.135 1.859 0.260
## RES.2 0.779 0.079 0.779 0.174
## RES.3 1.316 0.095 1.316 0.261
## RES 1.000 1.000 1.000
##
## R-Square:
##
## RES.1 0.740
## RES.2 0.826
## RES.3 0.739
correl.1 = residuals(one.fit, type="cor")
correl.1
## $type
## [1] "cor.bollen"
##
## $cor
## RES.1 RES.2 RES.3
## RES.1 0
## RES.2 0 0
## RES.3 0 0 0
##
## $mean
## RES.1 RES.2 RES.3
## 0 0 0
modindices(one.fit, sort. = TRUE, minimum.value = 3.84)
## [1] lhs op rhs mi epc sepc.lv sepc.all sepc.nox
## <0 rows> (or 0-length row.names)
fitmeasures(one.fit)
## npar fmin chisq
## 9.000 0.000 0.000
## df pvalue baseline.chisq
## 0.000 NA 1596.740
## baseline.df baseline.pvalue cfi
## 3.000 0.000 1.000
## tli nnfi rfi
## 1.000 1.000 1.000
## nfi pnfi ifi
## 1.000 0.000 1.000
## rni logl unrestricted.logl
## 1.000 -4620.531 -4620.531
## aic bic ntotal
## 9259.062 9301.190 797.000
## bic2 rmsea rmsea.ci.lower
## 9272.610 0.000 0.000
## rmsea.ci.upper rmsea.pvalue rmr
## 0.000 1.000 0.000
## rmr_nomean srmr srmr_bentler
## 0.000 0.000 0.000
## srmr_bentler_nomean srmr_bollen srmr_bollen_nomean
## 0.000 0.000 0.000
## srmr_mplus srmr_mplus_nomean cn_05
## 0.000 0.000 1.000
## cn_01 gfi agfi
## 1.000 1.000 1.000
## pgfi mfi ecvi
## 0.000 1.000 NA
Target Rotation
``` CFI
1-((out_targetQ$STATISTIC - out_targetQ$dof)/(out_targetQ$null.chisq- out_targetQ$null.dof))
## [1] 1