options(width=200)
library(tidyverse)
gpt <- rio::import("~/Downloads/tmp3.csv")
items <- tibble(var=c(str_c("ipipc", 1:10), str_c("grit", 1:10)),
label = names(gpt)[-1])
knitr::kable(items)
var | label |
---|---|
ipipc1 | I am always prepared. |
ipipc2 | I pay attention to details. |
ipipc3 | I get chores done right away. |
ipipc4 | I carry out my plans. |
ipipc5 | I make plans and stick to them. |
ipipc6 | I waste my time. |
ipipc7 | I find it difficult to get down to work. |
ipipc8 | I do just enough work to get by. |
ipipc9 | I don’t see things through. |
ipipc10 | I shirk my duties. |
grit1 | When I set myself an objective, I continue until I achieve it. |
grit2 | I do what I set out to do |
grit3 | I am consistent in my interests |
grit4 | I am clear about my objectives. |
grit5 | Even though the results seem far off, I persist in the task. |
grit6 | I work hard every day to get closer to my goals. |
grit7 | When I have a project in mind I do everything possible to get it done. |
grit8 | I spend as much time and energy as I can on reaching my goals. |
grit9 | If I set myself something to do, I will work on it until I achieve it. |
grit10 | I finish what I start. |
gptnr <- gpt
gptnr$V1 <- NULL
names(gptnr) <- c(str_c("ipipc", 1:10), str_c("grit", 1:10))
rownames(gptnr) <- c(str_c("ipipc", 1:10), str_c("grit", 1:10))
gptnr <- as.matrix(gptnr)
library(lavaan)
#> This is lavaan 0.6-14
#> lavaan is FREE software! Please report any bugs.
lcor <- cfa("ipipc =~ ipipc1 + ipipc2 + ipipc3 + ipipc4 + ipipc5 +
ipipc6 + ipipc7 + ipipc8 + ipipc9 + ipipc10
gritc =~ grit1 + grit2 + grit3 + grit4 + grit5 + grit6 +
grit7 + grit8 + grit9 + grit10",
sample.cov = gptnr, sample.nobs = 1000)
summary(lcor, standardized = T, ci=T)
#> lavaan 0.6.14 ended normally after 29 iterations
#>
#> Estimator ML
#> Optimization method NLMINB
#> Number of model parameters 41
#>
#> Number of observations 1000
#>
#> Model Test User Model:
#>
#> Test statistic 2262.642
#> Degrees of freedom 169
#> P-value (Chi-square) 0.000
#>
#> Parameter Estimates:
#>
#> Standard errors Standard
#> Information Expected
#> Information saturated (h1) model Structured
#>
#> Latent Variables:
#> Estimate Std.Err z-value P(>|z|) ci.lower ci.upper Std.lv Std.all
#> ipipc =~
#> ipipc1 1.000 1.000 1.000 0.652 0.653
#> ipipc2 0.507 0.053 9.546 0.000 0.403 0.611 0.331 0.331
#> ipipc3 0.860 0.055 15.546 0.000 0.752 0.969 0.561 0.562
#> ipipc4 1.213 0.059 20.582 0.000 1.098 1.329 0.792 0.792
#> ipipc5 1.125 0.058 19.454 0.000 1.012 1.239 0.734 0.735
#> ipipc6 -0.847 0.055 -15.329 0.000 -0.955 -0.738 -0.552 -0.553
#> ipipc7 -0.734 0.054 -13.490 0.000 -0.841 -0.627 -0.479 -0.479
#> ipipc8 -0.755 0.055 -13.845 0.000 -0.862 -0.648 -0.493 -0.493
#> ipipc9 -0.257 0.052 -4.917 0.000 -0.359 -0.154 -0.167 -0.167
#> ipipc10 -0.845 0.055 -15.308 0.000 -0.954 -0.737 -0.552 -0.552
#> gritc =~
#> grit1 1.000 1.000 1.000 0.842 0.842
#> grit2 0.875 0.032 27.009 0.000 0.812 0.938 0.736 0.737
#> grit3 0.556 0.036 15.277 0.000 0.485 0.627 0.468 0.468
#> grit4 0.792 0.034 23.538 0.000 0.726 0.858 0.667 0.667
#> grit5 0.607 0.036 16.923 0.000 0.537 0.678 0.511 0.512
#> grit6 0.959 0.031 30.966 0.000 0.898 1.019 0.807 0.807
#> grit7 0.853 0.033 26.040 0.000 0.789 0.917 0.718 0.718
#> grit8 0.938 0.031 29.936 0.000 0.877 0.999 0.789 0.790
#> grit9 1.034 0.030 35.003 0.000 0.976 1.092 0.870 0.871
#> grit10 0.397 0.038 10.555 0.000 0.323 0.471 0.334 0.334
#>
#> Covariances:
#> Estimate Std.Err z-value P(>|z|) ci.lower ci.upper Std.lv Std.all
#> ipipc ~~
#> gritc 0.414 0.029 14.159 0.000 0.357 0.472 0.755 0.755
#>
#> Variances:
#> Estimate Std.Err z-value P(>|z|) ci.lower ci.upper Std.lv Std.all
#> .ipipc1 0.573 0.029 19.903 0.000 0.517 0.630 0.573 0.574
#> .ipipc2 0.890 0.041 21.958 0.000 0.810 0.969 0.890 0.891
#> .ipipc3 0.684 0.033 20.842 0.000 0.620 0.748 0.684 0.685
#> .ipipc4 0.372 0.022 16.751 0.000 0.329 0.416 0.372 0.373
#> .ipipc5 0.460 0.025 18.458 0.000 0.411 0.509 0.460 0.460
#> .ipipc6 0.694 0.033 20.911 0.000 0.629 0.759 0.694 0.695
#> .ipipc7 0.770 0.036 21.381 0.000 0.699 0.840 0.770 0.771
#> .ipipc8 0.756 0.035 21.304 0.000 0.687 0.826 0.756 0.757
#> .ipipc9 0.971 0.044 22.266 0.000 0.886 1.056 0.971 0.972
#> .ipipc10 0.695 0.033 20.918 0.000 0.630 0.760 0.695 0.696
#> .grit1 0.291 0.016 18.370 0.000 0.260 0.322 0.291 0.291
#> .grit2 0.457 0.022 20.430 0.000 0.413 0.500 0.457 0.457
#> .grit3 0.780 0.036 21.907 0.000 0.710 0.850 0.780 0.781
#> .grit4 0.555 0.026 21.061 0.000 0.503 0.606 0.555 0.555
#> .grit5 0.738 0.034 21.788 0.000 0.671 0.804 0.738 0.738
#> .grit6 0.348 0.018 19.305 0.000 0.313 0.383 0.348 0.348
#> .grit7 0.484 0.023 20.631 0.000 0.438 0.530 0.484 0.484
#> .grit8 0.376 0.019 19.656 0.000 0.338 0.413 0.376 0.376
#> .grit9 0.241 0.014 17.219 0.000 0.214 0.269 0.241 0.242
#> .grit10 0.887 0.040 22.157 0.000 0.809 0.966 0.887 0.888
#> ipipc 0.426 0.039 10.950 0.000 0.349 0.502 1.000 1.000
#> gritc 0.708 0.044 16.216 0.000 0.623 0.794 1.000 1.000
rownames(gptnr) <- colnames(gptnr) <- str_sub(names(gpt)[-1], 3, 10)
round(gptnr,2)
#> am alway pay atte get chor carry ou make pla waste my find it do just don't se shirk my en I set do what am consi am clear en thoug work har en I hav spend as I set m finish w
#> am alway 1.00 0.32 0.41 0.54 0.48 -0.35 -0.28 -0.28 -0.15 -0.38 0.32 0.33 0.24 0.36 0.17 0.32 0.34 0.27 0.40 0.20
#> pay atte 0.32 1.00 0.15 0.26 0.21 -0.17 -0.06 -0.14 -0.14 -0.19 0.19 0.18 0.20 0.19 0.30 0.24 0.31 0.20 0.20 0.12
#> get chor 0.41 0.15 1.00 0.44 0.38 -0.37 -0.30 -0.27 -0.07 -0.35 0.24 0.29 0.20 0.31 0.13 0.32 0.32 0.25 0.35 0.22
#> carry ou 0.54 0.26 0.44 1.00 0.69 -0.36 -0.32 -0.28 -0.06 -0.32 0.55 0.64 0.31 0.54 0.31 0.45 0.49 0.39 0.58 0.31
#> make pla 0.48 0.21 0.38 0.69 1.00 -0.31 -0.26 -0.25 -0.07 -0.32 0.53 0.49 0.31 0.45 0.30 0.47 0.41 0.40 0.58 0.18
#> waste my -0.35 -0.17 -0.37 -0.36 -0.31 1.00 0.41 0.45 0.14 0.51 -0.27 -0.26 -0.18 -0.31 -0.14 -0.33 -0.27 -0.21 -0.31 -0.21
#> find it -0.28 -0.06 -0.30 -0.32 -0.26 0.41 1.00 0.45 0.13 0.38 -0.23 -0.26 -0.20 -0.31 -0.13 -0.27 -0.26 -0.31 -0.27 -0.20
#> do just -0.28 -0.14 -0.27 -0.28 -0.25 0.45 0.45 1.00 0.19 0.49 -0.25 -0.22 -0.19 -0.22 -0.21 -0.39 -0.27 -0.39 -0.31 -0.10
#> don't se -0.15 -0.14 -0.07 -0.06 -0.07 0.14 0.13 0.19 1.00 0.21 -0.07 -0.03 -0.04 -0.04 -0.07 -0.08 -0.05 -0.10 -0.08 -0.04
#> shirk my -0.38 -0.19 -0.35 -0.32 -0.32 0.51 0.38 0.49 0.21 1.00 -0.27 -0.23 -0.21 -0.31 -0.11 -0.33 -0.25 -0.30 -0.30 -0.15
#> en I set 0.32 0.19 0.24 0.55 0.53 -0.27 -0.23 -0.25 -0.07 -0.27 1.00 0.63 0.42 0.66 0.48 0.65 0.56 0.65 0.74 0.35
#> do what 0.33 0.18 0.29 0.64 0.49 -0.26 -0.26 -0.22 -0.03 -0.23 0.63 1.00 0.39 0.51 0.38 0.55 0.46 0.51 0.69 0.35
#> am consi 0.24 0.20 0.20 0.31 0.31 -0.18 -0.20 -0.19 -0.04 -0.21 0.42 0.39 1.00 0.57 0.26 0.31 0.32 0.33 0.33 0.19
#> am clear 0.36 0.19 0.31 0.54 0.45 -0.31 -0.31 -0.22 -0.04 -0.31 0.66 0.51 0.57 1.00 0.25 0.47 0.46 0.48 0.52 0.22
#> en thoug 0.17 0.30 0.13 0.31 0.30 -0.14 -0.13 -0.21 -0.07 -0.11 0.48 0.38 0.26 0.25 1.00 0.44 0.42 0.39 0.41 0.24
#> work har 0.32 0.24 0.32 0.45 0.47 -0.33 -0.27 -0.39 -0.08 -0.33 0.65 0.55 0.31 0.47 0.44 1.00 0.55 0.81 0.70 0.23
#> en I hav 0.34 0.31 0.32 0.49 0.41 -0.27 -0.26 -0.27 -0.05 -0.25 0.56 0.46 0.32 0.46 0.42 0.55 1.00 0.61 0.68 0.19
#> spend as 0.27 0.20 0.25 0.39 0.40 -0.21 -0.31 -0.39 -0.10 -0.30 0.65 0.51 0.33 0.48 0.39 0.81 0.61 1.00 0.68 0.19
#> I set m 0.40 0.20 0.35 0.58 0.58 -0.31 -0.27 -0.31 -0.08 -0.30 0.74 0.69 0.33 0.52 0.41 0.70 0.68 0.68 1.00 0.23
#> finish w 0.20 0.12 0.22 0.31 0.18 -0.21 -0.20 -0.10 -0.04 -0.15 0.35 0.35 0.19 0.22 0.24 0.23 0.19 0.19 0.23 1.00
Created on 2023-02-10 by the reprex package (v2.0.1)