1. I live one day at a time and don’t really think about the future. (rs)
  2. I tend to focus on the present, because the future always brings me problems. (rs)
  3. My daily activities often seem trivial and unimportant to me. (rs)
  4. I don’t have a good sense of what it is that I am trying to accomplish in my life. (rs)
  5. I used to set goals for myself, but that now seems a waste of time. (rs)
  6. I enjoy making plans for the future and working to make them a reality.
  7. I am an active person in carrying out the plans I set for myself.
  8. Some people wander aimlessly through life, but I am not one of them.
  9. I sometimes feel as if I’ve done all there is to do in life. (rs)

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

loadthedata

data <- read.csv("~/Psychometric_study_data/allsurveysYT1.csv")
data<-tbl_df(data)
PWB<-select(data, PWB_1, PWB_2, PWB_3, PWB_4, PWB_5, PWB_6,PWB_7, PWB_8, PWB_9)
PWB$PWB_1  <-  7- PWB$PWB_1
PWB$PWB_2  <-  7- PWB$PWB_2
PWB$PWB_3  <-  7- PWB$PWB_3
PWB$PWB_4  <-  7- PWB$PWB_4
PWB$PWB_9  <-  7- PWB$PWB_9
PWB<-tbl_df(PWB)
PWB
## Source: local data frame [1,160 x 9]
## 
##    PWB_1 PWB_2 PWB_3 PWB_4 PWB_5 PWB_6 PWB_7 PWB_8 PWB_9
## 1      4     3     5     2     4     5     4     3     6
## 2      4     5     5     2     2     5     3     2     5
## 3      5     6     5     6     1     4     6     3     6
## 4      2     2     4     4     3     4     5     4     4
## 5      2     2     3     3     4     3     2     3     4
## 6      5     4     6     5     3     4     3     4     6
## 7      2     2     5     2     1     4     3     3     3
## 8      6     6     5     1     2     4     4     4     6
## 9      5     5     5     5     1     5     5     5     6
## 10     6     6     3     3     2     6     6     3     6
## ..   ...   ...   ...   ...   ...   ...   ...   ...   ...

create plots

#ggpairs(PWB, columns = 1:15, title="Big 5 Marsh" )

create the models

two.model= ' Factor1  =~ PWB_1 +  PWB_3  + PWB_4 + PWB_5 + PWB_6 + PWB_9   
              Factor2 =~   PWB_2+ PWB_7 + PWB_8
'  #Models two factors:Positive and Negative     
              

one.model= 'PWB =~ PWB_1 +  PWB_2  + PWB_3 + PWB_4 + PWB_5 + PWB_6 + PWB_7 + PWB_8 + PWB_9' #Models as a single purpose factor

Second order models

second.model = '  F1  =~ PWB_1 +  PWB_3  + PWB_5 + PWB_6   
                F2 =~   PWB_4 + PWB_7 + PWB_8 
                F3 =~ PWB_2 + PWB_9 
' #Second order models as Purpose being the higher factor made up of Purpose and Positive

Bifactor (like model 7 in Marsh, Scalas & Nagengast, 2010)

bifactor.negative.model = 'Negative =~ PWB_1 +  PWB_2  + PWB_3 + PWB_4 + PWB_5 + PWB_9  
                                     PWB =~ PWB_1 +  PWB_2  + PWB_3 + PWB_4 + PWB_5 + PWB_6 + PWB_7 + PWB_8 + PWB_9 
'#Models bifactor as the negatively worded item as a factor uncorolated with the main factor

bifactor.model1 = 'PWB =~ PWB_1 +  PWB_2  + PWB_3 + PWB_4 + PWB_5 + PWB_6 + PWB_7 + PWB_8 + PWB_9
                Negative  =~ PWB_1 +  PWB_2  + PWB_3 + PWB_4 + PWB_5 + PWB_9   
              Positive =~   PWB_6 + PWB_7 + PWB_8
                PWB ~~ 0*Negative
                PWB ~~ 0*Positive
                Negative~~0*Positive
'#Models bifactor with Positive and Purpose as factors uncorolated with the main factor

bifactor.model2 = 'PWB =~ PWB_1 +  PWB_2  + PWB_3 + PWB_4 + PWB_5 + PWB_6 + PWB_7 + PWB_8 + PWB_9
                F1  =~ PWB_1 +  PWB_3  + PWB_5 + PWB_6   
                F2 =~   PWB_4 + PWB_7 + PWB_8 
                F3 =~ PWB_2 + PWB_9 
                PWB ~~ 0*F1
                PWB ~~ 0*F2
                PWB ~~ 0*F3
                F1~~0*F2
                F1~~0*F3
                F2~~0*F3
'#Models bifactor with Positive and Purpose as factors uncorolated with the main factor

run the models

two.fit=cfa(two.model, data=PWB, 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 85 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 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 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 782 783 784 785 809 810 829 903 906 907 909 911 1110 1112 1113 1114 1116 1117 1120 1121 1122 1125 1126 1128 1129 1130 1131 1132 1134 1136 1137 1138 1139 1140 1143 1145 1146 1147 1150 1151 1152 1154 1155 1159 1160
one.fit=cfa(one.model, data=PWB, 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 85 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 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 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 782 783 784 785 809 810 829 903 906 907 909 911 1110 1112 1113 1114 1116 1117 1120 1121 1122 1125 1126 1128 1129 1130 1131 1132 1134 1136 1137 1138 1139 1140 1143 1145 1146 1147 1150 1151 1152 1154 1155 1159 1160
second.fit=cfa(second.model, data=PWB, 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 85 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 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 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 782 783 784 785 809 810 829 903 906 907 909 911 1110 1112 1113 1114 1116 1117 1120 1121 1122 1125 1126 1128 1129 1130 1131 1132 1134 1136 1137 1138 1139 1140 1143 1145 1146 1147 1150 1151 1152 1154 1155 1159 1160
bifactor1.fit=cfa(bifactor.model1, data=PWB, 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 85 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 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 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 782 783 784 785 809 810 829 903 906 907 909 911 1110 1112 1113 1114 1116 1117 1120 1121 1122 1125 1126 1128 1129 1130 1131 1132 1134 1136 1137 1138 1139 1140 1143 1145 1146 1147 1150 1151 1152 1154 1155 1159 1160
bifactor2.fit=cfa(bifactor.model2, data=PWB, 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 85 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 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 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 782 783 784 785 809 810 829 903 906 907 909 911 1110 1112 1113 1114 1116 1117 1120 1121 1122 1125 1126 1128 1129 1130 1131 1132 1134 1136 1137 1138 1139 1140 1143 1145 1146 1147 1150 1151 1152 1154 1155 1159 1160
bifactor.negative.fit=cfa(bifactor.negative.model, data=PWB, 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 85 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 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 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 782 783 784 785 809 810 829 903 906 907 909 911 1110 1112 1113 1114 1116 1117 1120 1121 1122 1125 1126 1128 1129 1130 1131 1132 1134 1136 1137 1138 1139 1140 1143 1145 1146 1147 1150 1151 1152 1154 1155 1159 1160

create pictures

semPaths(two.fit, whatLabels = "std", layout = "tree")

semPaths(one.fit, whatLabels = "std", layout = "tree")

semPaths(second.fit, whatLabels = "std", layout = "tree")

semPaths(bifactor1.fit, whatLabels = "std", layout = "tree")

semPaths(bifactor2.fit, whatLabels = "std", layout = "tree")

semPaths(bifactor.negative.fit, whatLabels = "std", layout = "tree")

#summaries

summary(two.fit, standardized = TRUE, rsquare=TRUE)
## lavaan (0.5-18) converged normally after  32 iterations
## 
##                                                   Used       Total
##   Number of observations                           816        1160
## 
##   Number of missing patterns                         1
## 
##   Estimator                                         ML
##   Minimum Function Test Statistic              518.107
##   Degrees of freedom                                26
##   P-value (Chi-square)                           0.000
## 
## Parameter estimates:
## 
##   Information                                 Observed
##   Standard Errors                             Standard
## 
##                    Estimate  Std.err  Z-value  P(>|z|)   Std.lv  Std.all
## Latent variables:
##   Factor1 =~
##     PWB_1             0.987    0.056   17.715    0.000    0.987    0.612
##     PWB_3             1.231    0.051   23.962    0.000    1.231    0.777
##     PWB_4             0.805    0.054   14.855    0.000    0.805    0.531
##     PWB_5            -1.288    0.052  -24.761    0.000   -1.288   -0.797
##     PWB_6             0.698    0.046   15.124    0.000    0.698    0.537
##     PWB_9             0.585    0.053   11.144    0.000    0.585    0.410
##   Factor2 =~
##     PWB_2             0.327    0.063    5.151    0.000    0.327    0.227
##     PWB_7             0.891    0.065   13.766    0.000    0.891    0.694
##     PWB_8             1.020    0.073   13.929    0.000    1.020    0.732
## 
## Covariances:
##   Factor1 ~~
##     Factor2           0.269    0.047    5.746    0.000    0.269    0.269
## 
## Intercepts:
##     PWB_1             3.896    0.056   69.041    0.000    3.896    2.417
##     PWB_3             4.152    0.055   74.917    0.000    4.152    2.623
##     PWB_4             4.023    0.053   75.786    0.000    4.023    2.653
##     PWB_5             2.877    0.057   50.878    0.000    2.877    1.781
##     PWB_6             4.499    0.045   98.963    0.000    4.499    3.464
##     PWB_9             4.798    0.050   95.927    0.000    4.798    3.358
##     PWB_2             3.870    0.050   76.678    0.000    3.870    2.684
##     PWB_7             4.545    0.045  101.159    0.000    4.545    3.541
##     PWB_8             4.362    0.049   89.357    0.000    4.362    3.128
##     Factor1           0.000                               0.000    0.000
##     Factor2           0.000                               0.000    0.000
## 
## Variances:
##     PWB_1             1.625    0.092                      1.625    0.625
##     PWB_3             0.992    0.074                      0.992    0.396
##     PWB_4             1.652    0.090                      1.652    0.719
##     PWB_5             0.952    0.075                      0.952    0.365
##     PWB_6             1.200    0.065                      1.200    0.711
##     PWB_9             1.699    0.088                      1.699    0.832
##     PWB_2             1.972    0.101                      1.972    0.949
##     PWB_7             0.854    0.101                      0.854    0.518
##     PWB_8             0.903    0.131                      0.903    0.465
##     Factor1           1.000                               1.000    1.000
##     Factor2           1.000                               1.000    1.000
## 
## R-Square:
## 
##     PWB_1             0.375
##     PWB_3             0.604
##     PWB_4             0.281
##     PWB_5             0.635
##     PWB_6             0.289
##     PWB_9             0.168
##     PWB_2             0.051
##     PWB_7             0.482
##     PWB_8             0.535
summary(one.fit, standardized = TRUE, rsquare=TRUE)
## lavaan (0.5-18) converged normally after  25 iterations
## 
##                                                   Used       Total
##   Number of observations                           816        1160
## 
##   Number of missing patterns                         1
## 
##   Estimator                                         ML
##   Minimum Function Test Statistic              584.980
##   Degrees of freedom                                27
##   P-value (Chi-square)                           0.000
## 
## Parameter estimates:
## 
##   Information                                 Observed
##   Standard Errors                             Standard
## 
##                    Estimate  Std.err  Z-value  P(>|z|)   Std.lv  Std.all
## Latent variables:
##   PWB =~
##     PWB_1             1.017    0.055   18.385    0.000    1.017    0.631
##     PWB_2             0.752    0.052   14.502    0.000    0.752    0.522
##     PWB_3             1.202    0.051   23.458    0.000    1.202    0.759
##     PWB_4             0.841    0.054   15.654    0.000    0.841    0.554
##     PWB_5            -1.258    0.052  -24.240    0.000   -1.258   -0.779
##     PWB_6             0.679    0.046   14.690    0.000    0.679    0.523
##     PWB_7             0.208    0.050    4.176    0.000    0.208    0.162
##     PWB_8             0.280    0.054    5.218    0.000    0.280    0.201
##     PWB_9             0.629    0.052   12.048    0.000    0.629    0.440
## 
## Intercepts:
##     PWB_1             3.896    0.056   69.041    0.000    3.896    2.417
##     PWB_2             3.870    0.050   76.678    0.000    3.870    2.684
##     PWB_3             4.152    0.055   74.917    0.000    4.152    2.623
##     PWB_4             4.023    0.053   75.786    0.000    4.023    2.653
##     PWB_5             2.877    0.057   50.879    0.000    2.877    1.781
##     PWB_6             4.499    0.045   98.964    0.000    4.499    3.464
##     PWB_7             4.545    0.045  101.159    0.000    4.545    3.541
##     PWB_8             4.362    0.049   89.357    0.000    4.362    3.128
##     PWB_9             4.798    0.050   95.927    0.000    4.798    3.358
##     PWB               0.000                               0.000    0.000
## 
## Variances:
##     PWB_1             1.564    0.090                      1.564    0.602
##     PWB_2             1.513    0.082                      1.513    0.728
##     PWB_3             1.061    0.073                      1.061    0.424
##     PWB_4             1.593    0.087                      1.593    0.693
##     PWB_5             1.027    0.074                      1.027    0.394
##     PWB_6             1.225    0.066                      1.225    0.726
##     PWB_7             1.604    0.080                      1.604    0.974
##     PWB_8             1.866    0.093                      1.866    0.960
##     PWB_9             1.646    0.086                      1.646    0.806
##     PWB               1.000                               1.000    1.000
## 
## R-Square:
## 
##     PWB_1             0.398
##     PWB_2             0.272
##     PWB_3             0.576
##     PWB_4             0.307
##     PWB_5             0.606
##     PWB_6             0.274
##     PWB_7             0.026
##     PWB_8             0.040
##     PWB_9             0.194
summary(second.fit, standardized = TRUE, rsquare=TRUE)
## lavaan (0.5-18) converged normally after  29 iterations
## 
##                                                   Used       Total
##   Number of observations                           816        1160
## 
##   Number of missing patterns                         1
## 
##   Estimator                                         ML
##   Minimum Function Test Statistic              411.420
##   Degrees of freedom                                24
##   P-value (Chi-square)                           0.000
## 
## Parameter estimates:
## 
##   Information                                 Observed
##   Standard Errors                             Standard
## 
##                    Estimate  Std.err  Z-value  P(>|z|)   Std.lv  Std.all
## Latent variables:
##   F1 =~
##     PWB_1             1.040    0.056   18.635    0.000    1.040    0.645
##     PWB_3             1.206    0.052   23.235    0.000    1.206    0.762
##     PWB_5            -1.299    0.052  -24.823    0.000   -1.299   -0.804
##     PWB_6             0.693    0.046   14.932    0.000    0.693    0.534
##   F2 =~
##     PWB_4             0.695    0.069   10.033    0.000    0.695    0.458
##     PWB_7             0.900    0.055   16.400    0.000    0.900    0.701
##     PWB_8             0.953    0.058   16.405    0.000    0.953    0.684
##   F3 =~
##     PWB_2             0.986    0.064   15.454    0.000    0.986    0.684
##     PWB_9             0.801    0.059   13.521    0.000    0.801    0.561
## 
## Covariances:
##   F1 ~~
##     F2                0.283    0.051    5.553    0.000    0.283    0.283
##     F3                0.692    0.041   16.985    0.000    0.692    0.692
##   F2 ~~
##     F3                0.367    0.058    6.332    0.000    0.367    0.367
## 
## Intercepts:
##     PWB_1             3.896    0.056   69.041    0.000    3.896    2.417
##     PWB_3             4.152    0.055   74.917    0.000    4.152    2.623
##     PWB_5             2.877    0.057   50.879    0.000    2.877    1.781
##     PWB_6             4.499    0.045   98.964    0.000    4.499    3.464
##     PWB_4             4.023    0.053   75.786    0.000    4.023    2.653
##     PWB_7             4.545    0.045  101.159    0.000    4.545    3.541
##     PWB_8             4.362    0.049   89.357    0.000    4.362    3.128
##     PWB_2             3.870    0.050   76.678    0.000    3.870    2.684
##     PWB_9             4.798    0.050   95.927    0.000    4.798    3.358
##     F1                0.000                               0.000    0.000
##     F2                0.000                               0.000    0.000
##     F3                0.000                               0.000    0.000
## 
## Variances:
##     PWB_1             1.517    0.091                      1.517    0.584
##     PWB_3             1.051    0.076                      1.051    0.419
##     PWB_5             0.922    0.077                      0.922    0.353
##     PWB_6             1.206    0.066                      1.206    0.715
##     PWB_4             1.816    0.112                      1.816    0.790
##     PWB_7             0.837    0.081                      0.837    0.508
##     PWB_8             1.035    0.091                      1.035    0.532
##     PWB_2             1.106    0.106                      1.106    0.532
##     PWB_9             1.400    0.092                      1.400    0.686
##     F1                1.000                               1.000    1.000
##     F2                1.000                               1.000    1.000
##     F3                1.000                               1.000    1.000
## 
## R-Square:
## 
##     PWB_1             0.416
##     PWB_3             0.581
##     PWB_5             0.647
##     PWB_6             0.285
##     PWB_4             0.210
##     PWB_7             0.492
##     PWB_8             0.468
##     PWB_2             0.468
##     PWB_9             0.314
summary(bifactor1.fit, standardized = TRUE, rsquare=TRUE)
## lavaan (0.5-18) converged normally after  51 iterations
## 
##                                                   Used       Total
##   Number of observations                           816        1160
## 
##   Number of missing patterns                         1
## 
##   Estimator                                         ML
##   Minimum Function Test Statistic              168.910
##   Degrees of freedom                                18
##   P-value (Chi-square)                           0.000
## 
## Parameter estimates:
## 
##   Information                                 Observed
##   Standard Errors                             Standard
## 
##                    Estimate  Std.err  Z-value  P(>|z|)   Std.lv  Std.all
## Latent variables:
##   PWB =~
##     PWB_1             0.918    0.071   12.862    0.000    0.918    0.569
##     PWB_2             0.381    0.095    4.006    0.000    0.381    0.264
##     PWB_3             1.216    0.059   20.607    0.000    1.216    0.768
##     PWB_4             0.685    0.074    9.203    0.000    0.685    0.452
##     PWB_5            -1.266    0.059  -21.479    0.000   -1.266   -0.784
##     PWB_6             0.712    0.050   14.343    0.000    0.712    0.548
##     PWB_7             0.083    0.053    1.574    0.116    0.083    0.065
##     PWB_8             0.180    0.056    3.205    0.001    0.180    0.129
##     PWB_9             0.470    0.080    5.885    0.000    0.470    0.329
##   Negative =~
##     PWB_1             0.507    0.109    4.657    0.000    0.507    0.315
##     PWB_2             1.302    0.205    6.334    0.000    1.302    0.903
##     PWB_3             0.242    0.111    2.185    0.029    0.242    0.153
##     PWB_4             0.431    0.110    3.925    0.000    0.431    0.284
##     PWB_5            -0.268    0.110   -2.438    0.015   -0.268   -0.166
##     PWB_9             0.475    0.123    3.848    0.000    0.475    0.333
##   Positive =~
##     PWB_6             0.387    0.048    8.042    0.000    0.387    0.298
##     PWB_7             0.999    0.079   12.582    0.000    0.999    0.779
##     PWB_8             0.916    0.077   11.894    0.000    0.916    0.657
## 
## Covariances:
##   PWB ~~
##     Negative          0.000                               0.000    0.000
##     Positive          0.000                               0.000    0.000
##   Negative ~~
##     Positive          0.000                               0.000    0.000
## 
## Intercepts:
##     PWB_1             3.896    0.056   69.041    0.000    3.896    2.417
##     PWB_2             3.870    0.050   76.678    0.000    3.870    2.684
##     PWB_3             4.152    0.055   74.917    0.000    4.152    2.623
##     PWB_4             4.023    0.053   75.786    0.000    4.023    2.653
##     PWB_5             2.877    0.057   50.879    0.000    2.877    1.781
##     PWB_6             4.499    0.045   98.964    0.000    4.499    3.464
##     PWB_7             4.545    0.045  101.159    0.000    4.545    3.541
##     PWB_8             4.362    0.049   89.357    0.000    4.362    3.128
##     PWB_9             4.798    0.050   95.927    0.000    4.798    3.358
##     PWB               0.000                               0.000    0.000
##     Negative          0.000                               0.000    0.000
##     Positive          0.000                               0.000    0.000
## 
## Variances:
##     PWB_1             1.498    0.087                      1.498    0.577
##     PWB_2             0.240    0.541                      0.240    0.115
##     PWB_3             0.968    0.079                      0.968    0.386
##     PWB_4             1.644    0.089                      1.644    0.715
##     PWB_5             0.936    0.080                      0.936    0.359
##     PWB_6             1.029    0.066                      1.029    0.611
##     PWB_7             0.642    0.143                      0.642    0.390
##     PWB_8             1.073    0.127                      1.073    0.552
##     PWB_9             1.595    0.099                      1.595    0.781
##     PWB               1.000                               1.000    1.000
##     Negative          1.000                               1.000    1.000
##     Positive          1.000                               1.000    1.000
## 
## R-Square:
## 
##     PWB_1             0.423
##     PWB_2             0.885
##     PWB_3             0.614
##     PWB_4             0.285
##     PWB_5             0.641
##     PWB_6             0.389
##     PWB_7             0.610
##     PWB_8             0.448
##     PWB_9             0.219
summary(bifactor2.fit, standardized = TRUE, rsquare=TRUE)
## lavaan (0.5-18) converged normally after  45 iterations
## 
##                                                   Used       Total
##   Number of observations                           816        1160
## 
##   Number of missing patterns                         1
## 
##   Estimator                                         ML
##   Minimum Function Test Statistic              189.914
##   Degrees of freedom                                18
##   P-value (Chi-square)                           0.000
## 
## Parameter estimates:
## 
##   Information                                 Observed
##   Standard Errors                             Standard
## 
##                    Estimate  Std.err  Z-value  P(>|z|)   Std.lv  Std.all
## Latent variables:
##   PWB =~
##     PWB_1             0.929    0.067   13.921    0.000    0.929    0.576
##     PWB_2             0.870    0.061   14.364    0.000    0.870    0.604
##     PWB_3             1.016    0.067   15.135    0.000    1.016    0.642
##     PWB_4             0.917    0.060   15.348    0.000    0.917    0.605
##     PWB_5            -1.015    0.068  -14.877    0.000   -1.015   -0.629
##     PWB_6             0.395    0.061    6.520    0.000    0.395    0.304
##     PWB_7             0.098    0.058    1.679    0.093    0.098    0.076
##     PWB_8             0.185    0.062    2.987    0.003    0.185    0.133
##     PWB_9             0.714    0.059   12.050    0.000    0.714    0.499
##   F1 =~
##     PWB_1             0.470    0.081    5.783    0.000    0.470    0.291
##     PWB_3             0.670    0.080    8.341    0.000    0.670    0.423
##     PWB_5            -0.805    0.085   -9.447    0.000   -0.805   -0.498
##     PWB_6             0.669    0.080    8.393    0.000    0.669    0.515
##   F2 =~
##     PWB_4             0.435    0.060    7.209    0.000    0.435    0.287
##     PWB_7             1.090    0.091   11.914    0.000    1.090    0.849
##     PWB_8             0.837    0.079   10.619    0.000    0.837    0.600
##   F3 =~
##     PWB_2             0.312       NA                      0.312    0.216
##     PWB_9             0.541       NA                      0.541    0.379
## 
## Covariances:
##   PWB ~~
##     F1                0.000                               0.000    0.000
##     F2                0.000                               0.000    0.000
##     F3                0.000                               0.000    0.000
##   F1 ~~
##     F2                0.000                               0.000    0.000
##     F3                0.000                               0.000    0.000
##   F2 ~~
##     F3                0.000                               0.000    0.000
## 
## Intercepts:
##     PWB_1             3.896    0.056   69.041    0.000    3.896    2.417
##     PWB_2             3.870    0.050   76.678    0.000    3.870    2.684
##     PWB_3             4.152    0.055   74.917    0.000    4.152    2.623
##     PWB_4             4.023    0.053   75.786    0.000    4.023    2.653
##     PWB_5             2.877    0.057   50.878    0.000    2.877    1.781
##     PWB_6             4.499    0.045   98.964    0.000    4.499    3.464
##     PWB_7             4.545    0.045  101.159    0.000    4.545    3.541
##     PWB_8             4.362    0.049   89.357    0.000    4.362    3.128
##     PWB_9             4.798    0.050   95.927    0.000    4.798    3.358
##     PWB               0.000                               0.000    0.000
##     F1                0.000                               0.000    0.000
##     F2                0.000                               0.000    0.000
##     F3                0.000                               0.000    0.000
## 
## Variances:
##     PWB_1             1.514    0.088                      1.514    0.583
##     PWB_2             1.224       NA                      1.224    0.589
##     PWB_3             1.026    0.073                      1.026    0.409
##     PWB_4             1.270    0.088                      1.270    0.552
##     PWB_5             0.931    0.085                      0.931    0.357
##     PWB_6             1.083    0.090                      1.083    0.642
##     PWB_7             0.450    0.184                      0.450    0.273
##     PWB_8             1.209    0.121                      1.209    0.622
##     PWB_9             1.239       NA                      1.239    0.607
##     PWB               1.000                               1.000    1.000
##     F1                1.000                               1.000    1.000
##     F2                1.000                               1.000    1.000
##     F3                1.000                               1.000    1.000
## 
## R-Square:
## 
##     PWB_1             0.417
##     PWB_2             0.411
##     PWB_3             0.591
##     PWB_4             0.448
##     PWB_5             0.643
##     PWB_6             0.358
##     PWB_7             0.727
##     PWB_8             0.378
##     PWB_9             0.393
summary(bifactor.negative.fit, standardized = TRUE, rsquare=TRUE)
## lavaan (0.5-18) converged normally after  33 iterations
## 
##                                                   Used       Total
##   Number of observations                           816        1160
## 
##   Number of missing patterns                         1
## 
##   Estimator                                         ML
##   Minimum Function Test Statistic              357.479
##   Degrees of freedom                                20
##   P-value (Chi-square)                           0.000
## 
## Parameter estimates:
## 
##   Information                                 Observed
##   Standard Errors                             Standard
## 
##                    Estimate  Std.err  Z-value  P(>|z|)   Std.lv  Std.all
## Latent variables:
##   Negative =~
##     PWB_1             1.427   78.748    0.018    0.986    1.427    0.885
##     PWB_2             0.972   53.658    0.018    0.986    0.972    0.675
##     PWB_3             1.543   85.122    0.018    0.986    1.543    0.974
##     PWB_4             0.936   51.666    0.018    0.986    0.936    0.617
##     PWB_5            -1.573   86.803   -0.018    0.986   -1.573   -0.974
##     PWB_9             0.828   45.708    0.018    0.986    0.828    0.580
##   PWB =~
##     PWB_1             0.929  121.082    0.008    0.994    0.929    0.577
##     PWB_2             0.916   82.505    0.011    0.991    0.916    0.635
##     PWB_3             1.253  130.883    0.010    0.992    1.253    0.792
##     PWB_4             1.222   79.442    0.015    0.988    1.222    0.806
##     PWB_5            -1.335  133.467   -0.010    0.992   -1.335   -0.826
##     PWB_6             0.480    0.055    8.778    0.000    0.480    0.370
##     PWB_7             0.970    0.056   17.221    0.000    0.970    0.756
##     PWB_8             0.953    0.058   16.452    0.000    0.953    0.683
##     PWB_9             0.734   70.280    0.010    0.992    0.734    0.513
## 
## Covariances:
##   Negative ~~
##     PWB              -0.650   48.954   -0.013    0.989   -0.650   -0.650
## 
## Intercepts:
##     PWB_1             3.896    0.056   69.041    0.000    3.896    2.417
##     PWB_2             3.870    0.050   76.678    0.000    3.870    2.684
##     PWB_3             4.152    0.055   74.917    0.000    4.152    2.623
##     PWB_4             4.023    0.053   75.786    0.000    4.023    2.653
##     PWB_5             2.877    0.057   50.879    0.000    2.877    1.781
##     PWB_9             4.798    0.050   95.927    0.000    4.798    3.358
##     PWB_6             4.499    0.045   98.964    0.000    4.499    3.464
##     PWB_7             4.545    0.045  101.159    0.000    4.545    3.541
##     PWB_8             4.362    0.049   89.357    0.000    4.362    3.128
##     Negative          0.000                               0.000    0.000
##     PWB               0.000                               0.000    0.000
## 
## Variances:
##     PWB_1             1.423    0.091                      1.423    0.548
##     PWB_2             1.453    0.080                      1.453    0.699
##     PWB_3             1.071    0.077                      1.071    0.427
##     PWB_4             1.417    0.081                      1.417    0.616
##     PWB_5             1.085    0.078                      1.085    0.416
##     PWB_9             1.607    0.085                      1.607    0.787
##     PWB_6             1.455    0.079                      1.455    0.863
##     PWB_7             0.706    0.088                      0.706    0.428
##     PWB_8             1.036    0.090                      1.036    0.533
##     Negative          1.000                               1.000    1.000
##     PWB               1.000                               1.000    1.000
## 
## R-Square:
## 
##     PWB_1             0.452
##     PWB_2             0.301
##     PWB_3             0.573
##     PWB_4             0.384
##     PWB_5             0.584
##     PWB_9             0.213
##     PWB_6             0.137
##     PWB_7             0.572
##     PWB_8             0.467

Residual correlations

correl = residuals(two.fit, type="cor")
correl
## $type
## [1] "cor.bollen"
## 
## $cor
##       PWB_1  PWB_3  PWB_4  PWB_5  PWB_6  PWB_9  PWB_2  PWB_7  PWB_8 
## PWB_1  0.000                                                        
## PWB_3 -0.001  0.000                                                 
## PWB_4 -0.051  0.024  0.000                                          
## PWB_5 -0.013 -0.004  0.028  0.000                                   
## PWB_6  0.031 -0.010 -0.035 -0.011  0.000                            
## PWB_9  0.039 -0.006  0.080  0.004 -0.112  0.000                     
## PWB_2  0.401  0.291  0.344 -0.308  0.131  0.359  0.000              
## PWB_7 -0.187 -0.105  0.190  0.068  0.167 -0.018 -0.022  0.000       
## PWB_8 -0.132 -0.062  0.148  0.039  0.161  0.029 -0.049  0.012  0.000
## 
## $mean
## PWB_1 PWB_3 PWB_4 PWB_5 PWB_6 PWB_9 PWB_2 PWB_7 PWB_8 
##     0     0     0     0     0     0     0     0     0
View(correl$cor)
correl1 = residuals(one.fit, type="cor")
correl1
## $type
## [1] "cor.bollen"
## 
## $cor
##       PWB_1  PWB_2  PWB_3  PWB_4  PWB_5  PWB_6  PWB_7  PWB_8  PWB_9 
## PWB_1  0.000                                                        
## PWB_2  0.110  0.000                                                 
## PWB_3 -0.004 -0.057  0.000                                          
## PWB_4 -0.076  0.087  0.015  0.000                                   
## PWB_5 -0.010  0.050 -0.033  0.037  0.000                            
## PWB_6  0.030 -0.109  0.011 -0.040 -0.032  0.000                     
## PWB_7 -0.176  0.051 -0.083  0.199  0.046  0.183  0.000              
## PWB_8 -0.138  0.012 -0.061  0.141  0.038  0.161  0.487  0.000       
## PWB_9  0.012  0.154 -0.022  0.053  0.020 -0.122 -0.013  0.021  0.000
## 
## $mean
## PWB_1 PWB_2 PWB_3 PWB_4 PWB_5 PWB_6 PWB_7 PWB_8 PWB_9 
##     0     0     0     0     0     0     0     0     0
View(correl1$cor)
correl0 = residuals(second.fit, type="cor")
correl0
## $type
## [1] "cor.bollen"
## 
## $cor
##       PWB_1  PWB_3  PWB_5  PWB_6  PWB_4  PWB_7  PWB_8  PWB_2  PWB_9 
## PWB_1  0.000                                                        
## PWB_3 -0.016  0.000                                                 
## PWB_5  0.017 -0.011  0.000                                          
## PWB_6  0.015  0.001 -0.010  0.000                                   
## PWB_4  0.191  0.337 -0.291  0.181  0.000                            
## PWB_7 -0.201 -0.111  0.079  0.162 -0.032  0.000                     
## PWB_8 -0.136 -0.056  0.037  0.163 -0.061  0.040  0.000              
## PWB_2  0.133 -0.022  0.025 -0.089  0.261 -0.040 -0.054  0.000       
## PWB_9  0.039  0.017 -0.010 -0.099  0.203 -0.085 -0.031  0.000  0.000
## 
## $mean
## PWB_1 PWB_3 PWB_5 PWB_6 PWB_4 PWB_7 PWB_8 PWB_2 PWB_9 
##     0     0     0     0     0     0     0     0     0
View(correl0$cor)
correl4 = residuals(bifactor1.fit, type="cor")
correl4
## $type
## [1] "cor.bollen"
## 
## $cor
##       PWB_1  PWB_2  PWB_3  PWB_4  PWB_5  PWB_6  PWB_7  PWB_8  PWB_9 
## PWB_1  0.000                                                        
## PWB_2  0.004  0.000                                                 
## PWB_3 -0.011 -0.002  0.000                                          
## PWB_4 -0.073  0.000  0.045  0.000                                   
## PWB_5 -0.003  0.000  0.004  0.006  0.000                            
## PWB_6  0.048  0.019 -0.013  0.002 -0.010  0.000                     
## PWB_7 -0.110  0.119 -0.010  0.260 -0.030  0.000  0.000              
## PWB_8 -0.085  0.083 -0.008  0.194 -0.017  0.000  0.000  0.000       
## PWB_9 -0.002 -0.004  0.009  0.054 -0.010 -0.072  0.037  0.067  0.000
## 
## $mean
## PWB_1 PWB_2 PWB_3 PWB_4 PWB_5 PWB_6 PWB_7 PWB_8 PWB_9 
##     0     0     0     0     0     0     0     0     0
View(correl4$cor)
correl5 = residuals(bifactor2.fit, type="cor")
correl5
## $type
## [1] "cor.bollen"
## 
## $cor
##       PWB_1  PWB_2  PWB_3  PWB_4  PWB_5  PWB_6  PWB_7  PWB_8  PWB_9 
## PWB_1  0.000                                                        
## PWB_2  0.091  0.000                                                 
## PWB_3 -0.018 -0.048  0.000                                          
## PWB_4 -0.074  0.011  0.048  0.000                                   
## PWB_5  0.006  0.023 -0.010 -0.015  0.000                            
## PWB_6  0.034 -0.020 -0.005  0.066  0.008  0.000                     
## PWB_7 -0.117  0.090 -0.009  0.000 -0.033  0.245  0.000              
## PWB_8 -0.087  0.037  0.006  0.000 -0.035  0.226  0.000  0.000       
## PWB_9  0.001  0.000 -0.008 -0.005 -0.008 -0.044  0.021  0.043  0.000
## 
## $mean
## PWB_1 PWB_2 PWB_3 PWB_4 PWB_5 PWB_6 PWB_7 PWB_8 PWB_9 
##     0     0     0     0     0     0     0     0     0
correl3 = residuals(bifactor.negative.fit, type="cor")
correl3
## $type
## [1] "cor.bollen"
## 
## $cor
##       PWB_1  PWB_2  PWB_3  PWB_4  PWB_5  PWB_9  PWB_6  PWB_7  PWB_8 
## PWB_1  0.000                                                        
## PWB_2  0.094  0.000                                                 
## PWB_3 -0.023 -0.071  0.000                                          
## PWB_4 -0.042  0.057  0.025  0.000                                   
## PWB_5 -0.004  0.061 -0.046  0.030  0.000                            
## PWB_9 -0.007  0.131 -0.035  0.035  0.030  0.000                     
## PWB_6  0.359  0.091  0.349  0.100 -0.368  0.057  0.000              
## PWB_7 -0.074 -0.013 -0.079 -0.016  0.065 -0.044 -0.012  0.000       
## PWB_8 -0.012 -0.017 -0.017 -0.024  0.014  0.016  0.014  0.003  0.000
## 
## $mean
## PWB_1 PWB_2 PWB_3 PWB_4 PWB_5 PWB_9 PWB_6 PWB_7 PWB_8 
##     0     0     0     0     0     0     0     0     0
View(correl3$cor)

Modification indicies

#modindices(two.fit, sort. = TRUE, minimum.value = 3.84)
modindices(one.fit, sort. = TRUE, minimum.value = 3.84)
##      lhs op   rhs      mi    epc sepc.lv sepc.all sepc.nox
## 1  PWB_7 ~~ PWB_8 210.223  0.884   0.884    0.494    0.494
## 2  PWB_4 ~~ PWB_7  53.165  0.429   0.429    0.220    0.220
## 3  PWB_1 ~~ PWB_7  49.767 -0.421  -0.421   -0.204   -0.204
## 4  PWB_6 ~~ PWB_7  41.966  0.332   0.332    0.199    0.199
## 5  PWB_2 ~~ PWB_9  37.937  0.365   0.365    0.177    0.177
## 6  PWB_6 ~~ PWB_8  33.344  0.319   0.319    0.176    0.176
## 7  PWB_1 ~~ PWB_8  31.265 -0.361  -0.361   -0.161   -0.161
## 8  PWB_1 ~~ PWB_2  29.135  0.332   0.332    0.143    0.143
## 9  PWB_4 ~~ PWB_8  26.989  0.330   0.330    0.156    0.156
## 10 PWB_6 ~~ PWB_9  24.008 -0.261  -0.261   -0.141   -0.141
## 11 PWB_2 ~~ PWB_6  22.048 -0.245  -0.245   -0.131   -0.131
## 12 PWB_3 ~~ PWB_7  18.915 -0.234  -0.234   -0.115   -0.115
## 13 PWB_3 ~~ PWB_5  18.006 -0.289  -0.289   -0.113   -0.113
## 14 PWB_2 ~~ PWB_4  14.999  0.232   0.232    0.106    0.106
## 15 PWB_1 ~~ PWB_4  14.942 -0.247  -0.247   -0.101   -0.101
## 16 PWB_2 ~~ PWB_3  14.347 -0.217  -0.217   -0.095   -0.095
## 17 PWB_2 ~~ PWB_5  12.593  0.206   0.206    0.089    0.089
## 18 PWB_3 ~~ PWB_8  10.553 -0.189  -0.189   -0.086   -0.086
## 19 PWB_4 ~~ PWB_5   7.497  0.167   0.167    0.068    0.068
## 20 PWB_5 ~~ PWB_7   6.451  0.138   0.138    0.066    0.066
## 21 PWB_5 ~~ PWB_6   5.171 -0.119  -0.119   -0.057   -0.057
## 22 PWB_4 ~~ PWB_9   4.797  0.134   0.134    0.062    0.062
## 23 PWB_5 ~~ PWB_8   4.690  0.127   0.127    0.056    0.056
modindices(bifactor1.fit, sort. = TRUE, minimum.value = 3.84)
##         lhs op      rhs     mi    epc sepc.lv sepc.all sepc.nox
## 1  Positive =~    PWB_4 61.215  0.432   0.432    0.285    0.285
## 2     PWB_4 ~~    PWB_7 36.901  0.304   0.304    0.156    0.156
## 3  Positive =~    PWB_1 30.775 -0.302  -0.302   -0.188   -0.188
## 4     PWB_1 ~~    PWB_7 23.753 -0.240  -0.240   -0.116   -0.116
## 5     PWB_1 ~~    PWB_2 22.098  1.002   1.002    0.431    0.431
## 6     PWB_1 ~~    PWB_6 20.609  0.242   0.242    0.116    0.116
## 7     PWB_2 ~~    PWB_9 17.699 -1.127  -1.127   -0.547   -0.547
## 8     PWB_1 ~~    PWB_4 15.434 -0.263  -0.263   -0.107   -0.107
## 9     PWB_6 ~~    PWB_9 14.956 -0.207  -0.207   -0.111   -0.111
## 10 Negative ~~ Positive 13.868  0.175   0.175    0.175    0.175
## 11    PWB_3 ~~    PWB_4 11.412  0.204   0.204    0.085    0.085
## 12 Positive =~    PWB_2  8.807  0.155   0.155    0.108    0.108
## 13    PWB_4 ~~    PWB_6  8.763 -0.157  -0.157   -0.080   -0.080
## 14 Negative =~    PWB_7  7.492  0.115   0.115    0.089    0.089
## 15 Negative =~    PWB_6  6.754 -0.528  -0.528   -0.406   -0.406
## 16    PWB_4 ~~    PWB_8  6.185  0.135   0.135    0.064    0.064
## 17    PWB_4 ~~    PWB_9  5.983  0.165   0.165    0.076    0.076
## 18    PWB_2 ~~    PWB_7  5.699  0.111   0.111    0.060    0.060
## 19    PWB_1 ~~    PWB_8  4.454 -0.113  -0.113   -0.050   -0.050
#modindices(bifactor.negative.fit, sort. = TRUE, minimum.value = 3.84)

Fit Measures

#fitmeasures(two.fit)#Models two factors:Positive and Negative for Purpose  
fitmeasures(one.fit) #Models as a single purpose factor
##                npar                fmin               chisq 
##              27.000               0.358             584.980 
##                  df              pvalue      baseline.chisq 
##              27.000               0.000            2040.755 
##         baseline.df     baseline.pvalue                 cfi 
##              36.000               0.000               0.722 
##                 tli                nnfi                 rfi 
##               0.629               0.629               0.618 
##                 nfi                pnfi                 ifi 
##               0.713               0.535               0.723 
##                 rni                logl   unrestricted.logl 
##               0.722          -12466.214          -12173.724 
##                 aic                 bic              ntotal 
##           24986.429           25113.448             816.000 
##                bic2               rmsea      rmsea.ci.lower 
##           25027.707               0.159               0.148 
##      rmsea.ci.upper        rmsea.pvalue                 rmr 
##               0.170               0.000               0.187 
##          rmr_nomean                srmr        srmr_bentler 
##               0.205               0.098               0.098 
## srmr_bentler_nomean         srmr_bollen  srmr_bollen_nomean 
##               0.107               0.098               0.107 
##          srmr_mplus   srmr_mplus_nomean               cn_05 
##               0.098               0.107              56.955 
##               cn_01                 gfi                agfi 
##              66.510               0.991               0.982 
##                pgfi                 mfi                ecvi 
##               0.496               0.710                  NA
fitmeasures(second.fit)#Second order models as Purpose being the higher factor made up of Purpose and Positive
##                npar                fmin               chisq 
##              30.000               0.252             411.420 
##                  df              pvalue      baseline.chisq 
##              24.000               0.000            2040.755 
##         baseline.df     baseline.pvalue                 cfi 
##              36.000               0.000               0.807 
##                 tli                nnfi                 rfi 
##               0.710               0.710               0.698 
##                 nfi                pnfi                 ifi 
##               0.798               0.532               0.808 
##                 rni                logl   unrestricted.logl 
##               0.807          -12379.435          -12173.724 
##                 aic                 bic              ntotal 
##           24818.869           24960.001             816.000 
##                bic2               rmsea      rmsea.ci.lower 
##           24864.733               0.141               0.129 
##      rmsea.ci.upper        rmsea.pvalue                 rmr 
##               0.153               0.000               0.228 
##          rmr_nomean                srmr        srmr_bentler 
##               0.250               0.103               0.103 
## srmr_bentler_nomean         srmr_bollen  srmr_bollen_nomean 
##               0.113               0.103               0.113 
##          srmr_mplus   srmr_mplus_nomean               cn_05 
##               0.103               0.113              73.225 
##               cn_01                 gfi                agfi 
##              86.245               0.994               0.985 
##                pgfi                 mfi                ecvi 
##               0.442               0.789                  NA
fitmeasures(bifactor1.fit)#Models bifactor with Positive and Purpose as factors uncorolated with the main factor
##                npar                fmin               chisq 
##              36.000               0.103             168.910 
##                  df              pvalue      baseline.chisq 
##              18.000               0.000            2040.755 
##         baseline.df     baseline.pvalue                 cfi 
##              36.000               0.000               0.925 
##                 tli                nnfi                 rfi 
##               0.849               0.849               0.834 
##                 nfi                pnfi                 ifi 
##               0.917               0.459               0.925 
##                 rni                logl   unrestricted.logl 
##               0.925          -12258.179          -12173.724 
##                 aic                 bic              ntotal 
##           24588.359           24757.717             816.000 
##                bic2               rmsea      rmsea.ci.lower 
##           24643.396               0.101               0.088 
##      rmsea.ci.upper        rmsea.pvalue                 rmr 
##               0.116               0.000               0.114 
##          rmr_nomean                srmr        srmr_bentler 
##               0.125               0.056               0.056 
## srmr_bentler_nomean         srmr_bollen  srmr_bollen_nomean 
##               0.062               0.056               0.062 
##          srmr_mplus   srmr_mplus_nomean               cn_05 
##               0.056               0.062             140.467 
##               cn_01                 gfi                agfi 
##             169.144               0.997               0.992 
##                pgfi                 mfi                ecvi 
##               0.332               0.912                  NA
fitmeasures(bifactor2.fit)#Models bifactor with Positive and Purpose as factors uncorolated with the main factor
##                npar                fmin               chisq 
##              36.000               0.116             189.914 
##                  df              pvalue      baseline.chisq 
##              18.000               0.000            2040.755 
##         baseline.df     baseline.pvalue                 cfi 
##              36.000               0.000               0.914 
##                 tli                nnfi                 rfi 
##               0.828               0.828               0.814 
##                 nfi                pnfi                 ifi 
##               0.907               0.453               0.915 
##                 rni                logl   unrestricted.logl 
##               0.914          -12268.681          -12173.724 
##                 aic                 bic              ntotal 
##           24609.362           24778.721             816.000 
##                bic2               rmsea      rmsea.ci.lower 
##           24664.399               0.108               0.095 
##      rmsea.ci.upper        rmsea.pvalue                 rmr 
##               0.122               0.000               0.108 
##          rmr_nomean                srmr        srmr_bentler 
##               0.118               0.057               0.057 
## srmr_bentler_nomean         srmr_bollen  srmr_bollen_nomean 
##               0.062               0.057               0.062 
##          srmr_mplus   srmr_mplus_nomean               cn_05 
##               0.057               0.062             125.042 
##               cn_01                 gfi                agfi 
##             150.548               0.997               0.992 
##                pgfi                 mfi                ecvi 
##               0.332               0.900                  NA
fitmeasures(bifactor.negative.fit)#Models bifactor as the negatively worded item as a factor uncorolated with the main factor
##                npar                fmin               chisq 
##              34.000               0.219             357.479 
##                  df              pvalue      baseline.chisq 
##              20.000               0.000            2040.755 
##         baseline.df     baseline.pvalue                 cfi 
##              36.000               0.000               0.832 
##                 tli                nnfi                 rfi 
##               0.697               0.697               0.685 
##                 nfi                pnfi                 ifi 
##               0.825               0.458               0.833 
##                 rni                logl   unrestricted.logl 
##               0.832          -12352.464          -12173.724 
##                 aic                 bic              ntotal 
##           24772.927           24932.877             816.000 
##                bic2               rmsea      rmsea.ci.lower 
##           24824.907               0.144               0.131 
##      rmsea.ci.upper        rmsea.pvalue                 rmr 
##               0.157               0.000               0.196 
##          rmr_nomean                srmr        srmr_bentler 
##               0.215               0.094               0.094 
## srmr_bentler_nomean         srmr_bollen  srmr_bollen_nomean 
##               0.103               0.094               0.103 
##          srmr_mplus   srmr_mplus_nomean               cn_05 
##               0.094               0.103              72.699 
##               cn_01                 gfi                agfi 
##              86.751               0.994               0.984 
##                pgfi                 mfi                ecvi 
##               0.368               0.813                  NA

Create dataset for Target rotation

all_surveys<-read.csv("allsurveysYT1.csv")
PWBTR<-select(all_surveys, PWB_1, PWB_2, PWB_3,PWB_4, PWB_5,PWB_6,PWB_9, PWB_8,PWB_7)
PWB$PWB_1  <-  7- PWB$PWB_1
PWB$PWB_2  <-  7- PWB$PWB_2
PWB$PWB_3  <-  7- PWB$PWB_3
PWB$PWB_4  <-  7- PWB$PWB_4
PWB$PWB_9  <-  7- PWB$PWB_9
PWBTR<- data.frame(apply(PWBTR,2, as.numeric))

library(GPArotation)
library(psych)
library(dplyr)

PWBTR<-tbl_df(PWBTR)
PWBTR
## Source: local data frame [1,160 x 9]
## 
##    PWB_1 PWB_2 PWB_3 PWB_4 PWB_5 PWB_6 PWB_9 PWB_8 PWB_7
## 1      3     4     2     5     4     5     1     3     4
## 2      3     2     2     5     2     5     2     2     3
## 3      2     1     2     1     1     4     1     3     6
## 4      5     5     3     3     3     4     3     4     5
## 5      5     5     4     4     4     3     3     3     2
## 6      2     3     1     2     3     4     1     4     3
## 7      5     5     2     5     1     4     4     3     3
## 8      1     1     2     6     2     4     1     4     4
## 9      2     2     2     2     1     5     1     5     5
## 10     1     1     4     4     2     6     1     3     6
## ..   ...   ...   ...   ...   ...   ...   ...   ...   ...
str(PWBTR)
## Classes 'tbl_df', 'tbl' and 'data.frame':    1160 obs. of  9 variables:
##  $ PWB_1: num  3 3 2 5 5 2 5 1 2 1 ...
##  $ PWB_2: num  4 2 1 5 5 3 5 1 2 1 ...
##  $ PWB_3: num  2 2 2 3 4 1 2 2 2 4 ...
##  $ PWB_4: num  5 5 1 3 4 2 5 6 2 4 ...
##  $ PWB_5: num  4 2 1 3 4 3 1 2 1 2 ...
##  $ PWB_6: num  5 5 4 4 3 4 4 4 5 6 ...
##  $ PWB_9: num  1 2 1 3 3 1 4 1 1 1 ...
##  $ PWB_8: num  3 2 3 4 3 4 3 4 5 3 ...
##  $ PWB_7: num  4 3 6 5 2 3 3 4 5 6 ...
colnames(PWBTR) <- c("1","2", "3", "4", "5", "6", "7", "8", "9")
#Target rotation: choose "simple structure" a priori and can be applied to oblique and orthogonal rotation based on 
#what paper says facotrs should be PWB
Targ_key <- make.keys(9,list(f1=1:6,f2=7:9))
Targ_key <- scrub(Targ_key,isvalue=1)  #fix the 0s, allow the NAs to be estimated
Targ_key <- list(Targ_key)
PWBTR_cor <- corFiml(PWBTR) # convert the raw data to correlation matrix uisng FIML
out_targetQ <- fa(PWBTR_cor,2,rotate="TargetQ",n.obs = 816,Target=Targ_key) #TargetT for orthogonal rotation
out_targetQ[c("loadings", "score.cor", "TLI", "RMSEA")]
## $loadings
## 
## Loadings:
##   MR1    MR2   
## 1  0.690  0.200
## 2  0.511       
## 3  0.777       
## 4  0.500 -0.254
## 5  0.786       
## 6 -0.478  0.222
## 7  0.437       
## 8         0.616
## 9         0.843
## 
##                  MR1   MR2
## SS loadings    2.633 1.253
## Proportion Var 0.293 0.139
## Cumulative Var 0.293 0.432
## 
## $score.cor
##            [,1]       [,2]
## [1,]  1.0000000 -0.2125741
## [2,] -0.2125741  1.0000000
## 
## $TLI
## [1] 0.8443827
## 
## $RMSEA
##      RMSEA      lower      upper confidence 
## 0.10308452 0.08936113 0.11650367 0.10000000
out_targetQ
## Factor Analysis using method =  minres
## Call: fa(r = PWBTR_cor, nfactors = 2, n.obs = 816, rotate = "TargetQ", 
##     Target = Targ_key)
## Standardized loadings (pattern matrix) based upon correlation matrix
##     MR1   MR2   h2   u2 com
## 1  0.69  0.20 0.46 0.54 1.2
## 2  0.51 -0.06 0.27 0.73 1.0
## 3  0.78  0.07 0.59 0.41 1.0
## 4  0.50 -0.25 0.36 0.64 1.5
## 5  0.79  0.04 0.61 0.39 1.0
## 6 -0.48  0.22 0.32 0.68 1.4
## 7  0.44 -0.01 0.19 0.81 1.0
## 8 -0.07  0.62 0.40 0.60 1.0
## 9  0.02  0.84 0.71 0.29 1.0
## 
##                        MR1  MR2
## SS loadings           2.65 1.27
## Proportion Var        0.29 0.14
## Cumulative Var        0.29 0.43
## Proportion Explained  0.68 0.32
## Cumulative Proportion 0.68 1.00
## 
##  With factor correlations of 
##       MR1   MR2
## MR1  1.00 -0.19
## MR2 -0.19  1.00
## 
## Mean item complexity =  1.1
## Test of the hypothesis that 2 factors are sufficient.
## 
## The degrees of freedom for the null model are  36  and the objective function was  2.5 with Chi Square of  2028.67
## The degrees of freedom for the model are 19  and the objective function was  0.23 
## 
## The root mean square of the residuals (RMSR) is  0.05 
## The df corrected root mean square of the residuals is  0.07 
## 
## The harmonic number of observations is  816 with the empirical chi square  168.14  with prob <  6.6e-26 
## The total number of observations was  816  with MLE Chi Square =  182.39  with prob <  1e-28 
## 
## Tucker Lewis Index of factoring reliability =  0.844
## RMSEA index =  0.103  and the 90 % confidence intervals are  0.089 0.117
## BIC =  55
## Fit based upon off diagonal values = 0.97
## Measures of factor score adequacy             
##                                                 MR1  MR2
## Correlation of scores with factors             0.92 0.88
## Multiple R square of scores with factors       0.84 0.77
## Minimum correlation of possible factor scores  0.68 0.54

CFI

1-((out_targetQ$STATISTIC - out_targetQ$dof)/(out_targetQ$null.chisq- out_targetQ$null.dof))
## [1] 0.9180061

Target toration as three factors - works well as three factors but with cross loadings

all_surveys<-read.csv("allsurveysYT1.csv")
PWBTR<-select(all_surveys, PWB_1, PWB_3, PWB_5,PWB_6, PWB_4,PWB_7,PWB_8, PWB_2,PWB_9)
PWB$PWB_1  <-  7- PWB$PWB_1
PWB$PWB_2  <-  7- PWB$PWB_2
PWB$PWB_3  <-  7- PWB$PWB_3
PWB$PWB_4  <-  7- PWB$PWB_4
PWB$PWB_9  <-  7- PWB$PWB_9
PWBTR<- data.frame(apply(PWBTR,2, as.numeric))

library(GPArotation)
library(psych)
library(dplyr)

PWBTR<-tbl_df(PWBTR)
PWBTR
## Source: local data frame [1,160 x 9]
## 
##    PWB_1 PWB_3 PWB_5 PWB_6 PWB_4 PWB_7 PWB_8 PWB_2 PWB_9
## 1      3     2     4     5     5     4     3     4     1
## 2      3     2     2     5     5     3     2     2     2
## 3      2     2     1     4     1     6     3     1     1
## 4      5     3     3     4     3     5     4     5     3
## 5      5     4     4     3     4     2     3     5     3
## 6      2     1     3     4     2     3     4     3     1
## 7      5     2     1     4     5     3     3     5     4
## 8      1     2     2     4     6     4     4     1     1
## 9      2     2     1     5     2     5     5     2     1
## 10     1     4     2     6     4     6     3     1     1
## ..   ...   ...   ...   ...   ...   ...   ...   ...   ...
str(PWBTR)
## Classes 'tbl_df', 'tbl' and 'data.frame':    1160 obs. of  9 variables:
##  $ PWB_1: num  3 3 2 5 5 2 5 1 2 1 ...
##  $ PWB_3: num  2 2 2 3 4 1 2 2 2 4 ...
##  $ PWB_5: num  4 2 1 3 4 3 1 2 1 2 ...
##  $ PWB_6: num  5 5 4 4 3 4 4 4 5 6 ...
##  $ PWB_4: num  5 5 1 3 4 2 5 6 2 4 ...
##  $ PWB_7: num  4 3 6 5 2 3 3 4 5 6 ...
##  $ PWB_8: num  3 2 3 4 3 4 3 4 5 3 ...
##  $ PWB_2: num  4 2 1 5 5 3 5 1 2 1 ...
##  $ PWB_9: num  1 2 1 3 3 1 4 1 1 1 ...
colnames(PWBTR) <- c("1","2", "3", "4", "5", "6", "7", "8", "9")
#Target rotation: choose "simple structure" a priori and can be applied to oblique and orthogonal rotation based on 
#what paper says facotrs should be PWB
Targ_key <- make.keys(9,list(f1=1:4,f2=5:7, f3=8:9))
Targ_key <- scrub(Targ_key,isvalue=1)  #fix the 0s, allow the NAs to be estimated
Targ_key <- list(Targ_key)
PWBTR_cor <- corFiml(PWBTR) # convert the raw data to correlation matrix uisng FIML
out_targetQ <- fa(PWBTR_cor,3,rotate="TargetQ",n.obs = 816,Target=Targ_key) #TargetT for orthogonal rotation
out_targetQ[c("loadings", "score.cor", "TLI", "RMSEA")]
## $loadings
## 
## Loadings:
##   MR1    MR2    MR3   
## 1  0.538  0.166  0.238
## 2  0.764              
## 3  0.789              
## 4 -0.684  0.228  0.274
## 5  0.258 -0.300  0.300
## 6         0.833       
## 7         0.642       
## 8        -0.130  0.703
## 9                0.471
## 
##                  MR1   MR2   MR3
## SS loadings    2.048 1.299 0.941
## Proportion Var 0.228 0.144 0.105
## Cumulative Var 0.228 0.372 0.477
## 
## $score.cor
##            [,1]       [,2]       [,3]
## [1,]  1.0000000 -0.2076056  0.4944621
## [2,] -0.2076056  1.0000000 -0.1451347
## [3,]  0.4944621 -0.1451347  1.0000000
## 
## $TLI
## [1] 0.9231504
## 
## $RMSEA
##      RMSEA      lower      upper confidence 
## 0.07247499 0.05512534 0.09016088 0.10000000
out_targetQ
## Factor Analysis using method =  minres
## Call: fa(r = PWBTR_cor, nfactors = 3, n.obs = 816, rotate = "TargetQ", 
##     Target = Targ_key)
## Standardized loadings (pattern matrix) based upon correlation matrix
##     MR1   MR2   MR3   h2   u2 com
## 1  0.54  0.17  0.24 0.48 0.52 1.6
## 2  0.76  0.05  0.03 0.60 0.40 1.0
## 3  0.79  0.02  0.01 0.63 0.37 1.0
## 4 -0.68  0.23  0.27 0.44 0.56 1.6
## 5  0.26 -0.30  0.30 0.38 0.62 2.9
## 6  0.09  0.83 -0.03 0.67 0.33 1.0
## 7 -0.02  0.64  0.00 0.42 0.58 1.0
## 8  0.02 -0.13  0.70 0.54 0.46 1.1
## 9  0.09 -0.06  0.47 0.29 0.71 1.1
## 
##                        MR1  MR2  MR3
## SS loadings           2.12 1.32 1.01
## Proportion Var        0.24 0.15 0.11
## Cumulative Var        0.24 0.38 0.49
## Proportion Explained  0.48 0.30 0.23
## Cumulative Proportion 0.48 0.77 1.00
## 
##  With factor correlations of 
##       MR1   MR2   MR3
## MR1  1.00 -0.23  0.58
## MR2 -0.23  1.00 -0.06
## MR3  0.58 -0.06  1.00
## 
## Mean item complexity =  1.4
## Test of the hypothesis that 3 factors are sufficient.
## 
## The degrees of freedom for the null model are  36  and the objective function was  2.5 with Chi Square of  2028.67
## The degrees of freedom for the model are 12  and the objective function was  0.08 
## 
## The root mean square of the residuals (RMSR) is  0.03 
## The df corrected root mean square of the residuals is  0.04 
## 
## The harmonic number of observations is  816 with the empirical chi square  37.79  with prob <  0.00017 
## The total number of observations was  816  with MLE Chi Square =  62.92  with prob <  6.6e-09 
## 
## Tucker Lewis Index of factoring reliability =  0.923
## RMSEA index =  0.072  and the 90 % confidence intervals are  0.055 0.09
## BIC =  -17.54
## Fit based upon off diagonal values = 0.99
## Measures of factor score adequacy             
##                                                 MR1  MR2  MR3
## Correlation of scores with factors             0.91 0.87 0.83
## Multiple R square of scores with factors       0.84 0.76 0.69
## Minimum correlation of possible factor scores  0.67 0.52 0.37

CFI

1-((out_targetQ$STATISTIC - out_targetQ$dof)/(out_targetQ$null.chisq- out_targetQ$null.dof))
## [1] 0.9744478