pacman::p_load(tidyverse, lavaan, psych, emmeans, arsenal)
load("C:/Users/luisf/Dropbox/Puc-Rio/Projeto - Ivan IGE competencias emocionais/R base - Ivan IGE gestao emocional.RData")
dados %>%
select(sexo_fct, idade, nivel_escolaridade, estado_fct, regiao) %>%
tableby(~., .,
test = TRUE,
control = tableby.control(
test = T,
numeric.test = "kwt",
cat.test = "chisq",
cat.stats = c("countpct", "Nmiss2"))) %>%
summary()
| Overall (N=787) | |
|---|---|
| sexo_fct | |
| Masc | 467 (59.3%) |
| Fem | 320 (40.7%) |
| N-Miss | 0 |
| idade | |
| N-Miss | 2 |
| Mean (SD) | 24.806 (11.532) |
| Range | 14.000 - 68.000 |
| nivel_escolaridade | |
| Fundamental | 183 (23.6%) |
| Médio | 382 (49.3%) |
| Superior | 210 (27.1%) |
| N-Miss | 12 |
| estado_fct | |
| africa | 1 (0.1%) |
| al | 75 (9.5%) |
| am | 2 (0.3%) |
| angola | 1 (0.1%) |
| ba | 17 (2.2%) |
| ce | 7 (0.9%) |
| df | 9 (1.1%) |
| es | 1 (0.1%) |
| go | 8 (1.0%) |
| japao | 1 (0.1%) |
| ma | 1 (0.1%) |
| mg | 165 (21.0%) |
| michoacan | 1 (0.1%) |
| ms | 3 (0.4%) |
| mt | 5 (0.6%) |
| pa | 1 (0.1%) |
| paris | 1 (0.1%) |
| pb | 1 (0.1%) |
| pe | 19 (2.4%) |
| pr | 13 (1.7%) |
| re | 1 (0.1%) |
| rj | 93 (11.8%) |
| rn | 5 (0.6%) |
| ro | 1 (0.1%) |
| rs | 5 (0.6%) |
| sc | 5 (0.6%) |
| se | 2 (0.3%) |
| sp | 343 (43.6%) |
| N-Miss | 0 |
| regiao | |
| centro oeste | 25 (3.2%) |
| nordeste | 124 (15.8%) |
| outros | 13 (1.7%) |
| sudeste | 602 (76.5%) |
| sul | 23 (2.9%) |
| N-Miss | 0 |
NA
mod_cfa <- 'f1 =~ ige_1 + ige_11 + ige_13 + ige_22 + ige_30 + ige_33 + ige_34 + ige_36 + ige_43 + ige_47 + ige_48 + ige_53
f2 =~ ige_5 + ige_8 + ige_9 + ige_10 + ige_15 + ige_16 + ige_23 + ige_25 + ige_27 + ige_29 + ige_50
f3 =~ ige_4 + ige_37 + ige_38 + ige_39 + ige_41 + ige_44 + ige_45 + ige_51 + ige_54 + ige_55
f4 =~ ige_17 + ige_18 + ige_19 + ige_24 + ige_26 + ige_31 + ige_40 + ige_46 + ige_52
f5 =~ ige_2 + ige_3 + ige_6 + ige_12 + ige_20 + ige_32 + ige_57'
cfa_1 <- cfa(model = mod_cfa,
data = ds_psych,
estimator = 'WLSM',
ordered=colnames(ds_psych))
#fitMeasures(cfa_1, c("chisq.scaled", "df.scaled", "pvalue.scaled", "cfi.scaled","tli.scaled","rmsea.scaled","srmr"))
summary(cfa_1, standardized=TRUE, fit.measures = TRUE)
lavaan 0.6-9 ended normally after 108 iterations
Estimator DWLS
Optimization method NLMINB
Number of model parameters 304
Used Total
Number of observations 699 787
Model Test User Model:
Standard Robust
Test Statistic 3866.805 5568.700
Degrees of freedom 1117 1117
P-value (Chi-square) 0.000 0.000
Scaling correction factor 0.694
Satorra-Bentler correction
Model Test Baseline Model:
Test statistic 69244.201 69244.201
Degrees of freedom 1176 1176
P-value 0.000 0.000
Scaling correction factor 1.000
User Model versus Baseline Model:
Comparative Fit Index (CFI) 0.960 0.935
Tucker-Lewis Index (TLI) 0.957 0.931
Robust Comparative Fit Index (CFI) 0.955
Robust Tucker-Lewis Index (TLI) 0.952
Root Mean Square Error of Approximation:
RMSEA 0.059 0.076
90 Percent confidence interval - lower 0.057 0.073
90 Percent confidence interval - upper 0.061 0.078
P-value RMSEA <= 0.05 0.000 0.000
Robust RMSEA 0.063
90 Percent confidence interval - lower 0.061
90 Percent confidence interval - upper 0.065
Standardized Root Mean Square Residual:
SRMR 0.069 0.069
Parameter Estimates:
Standard errors Robust.sem
Information Expected
Information saturated (h1) model Unstructured
Latent Variables:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
f1 =~
ige_1 1.000 0.639 0.639
ige_11 1.074 0.062 17.454 0.000 0.686 0.686
ige_13 0.865 0.059 14.734 0.000 0.553 0.553
ige_22 0.976 0.061 16.075 0.000 0.624 0.624
ige_30 0.782 0.068 11.537 0.000 0.500 0.500
ige_33 1.068 0.056 19.072 0.000 0.683 0.683
ige_34 1.102 0.060 18.439 0.000 0.704 0.704
ige_36 1.115 0.068 16.328 0.000 0.712 0.712
ige_43 1.061 0.075 14.189 0.000 0.678 0.678
ige_47 1.015 0.056 18.149 0.000 0.649 0.649
ige_48 1.010 0.054 18.622 0.000 0.646 0.646
ige_53 1.059 0.061 17.330 0.000 0.677 0.677
f2 =~
ige_5 1.000 0.658 0.658
ige_8 1.146 0.051 22.633 0.000 0.754 0.754
ige_9 0.335 0.059 5.687 0.000 0.220 0.220
ige_10 0.820 0.053 15.354 0.000 0.540 0.540
ige_15 0.834 0.055 15.112 0.000 0.549 0.549
ige_16 0.727 0.058 12.578 0.000 0.478 0.478
ige_23 0.784 0.058 13.567 0.000 0.516 0.516
ige_25 0.424 0.057 7.401 0.000 0.279 0.279
ige_27 1.120 0.049 23.076 0.000 0.737 0.737
ige_29 1.256 0.060 20.918 0.000 0.826 0.826
ige_50 0.902 0.057 15.878 0.000 0.594 0.594
f3 =~
ige_4 1.000 0.440 0.440
ige_37 1.546 0.130 11.868 0.000 0.681 0.681
ige_38 1.506 0.124 12.190 0.000 0.663 0.663
ige_39 1.704 0.143 11.940 0.000 0.750 0.750
ige_41 0.110 0.088 1.244 0.213 0.048 0.048
ige_44 1.736 0.137 12.652 0.000 0.764 0.764
ige_45 1.350 0.107 12.603 0.000 0.594 0.594
ige_51 1.251 0.108 11.566 0.000 0.551 0.551
ige_54 1.740 0.143 12.198 0.000 0.766 0.766
ige_55 1.651 0.130 12.659 0.000 0.727 0.727
f4 =~
ige_17 1.000 0.588 0.588
ige_18 1.025 0.070 14.726 0.000 0.603 0.603
ige_19 1.054 0.069 15.227 0.000 0.620 0.620
ige_24 1.207 0.076 15.899 0.000 0.711 0.711
ige_26 1.118 0.071 15.656 0.000 0.658 0.658
ige_31 1.055 0.071 14.859 0.000 0.621 0.621
ige_40 0.983 0.075 13.106 0.000 0.579 0.579
ige_46 1.147 0.084 13.699 0.000 0.675 0.675
ige_52 1.290 0.072 17.909 0.000 0.759 0.759
f5 =~
ige_2 1.000 0.267 0.267
ige_3 1.300 0.380 3.419 0.001 0.347 0.347
ige_6 2.628 0.659 3.990 0.000 0.701 0.701
ige_12 0.941 0.343 2.745 0.006 0.251 0.251
ige_20 0.226 0.234 0.968 0.333 0.060 0.060
ige_32 0.510 0.266 1.917 0.055 0.136 0.136
ige_57 2.583 0.675 3.828 0.000 0.689 0.689
Covariances:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
f1 ~~
f2 0.350 0.023 15.047 0.000 0.833 0.833
f3 0.211 0.021 10.044 0.000 0.749 0.749
f4 0.269 0.020 13.239 0.000 0.715 0.715
f5 -0.034 0.013 -2.713 0.007 -0.201 -0.201
f2 ~~
f3 0.222 0.021 10.505 0.000 0.767 0.767
f4 0.246 0.020 12.309 0.000 0.635 0.635
f5 -0.044 0.014 -3.187 0.001 -0.252 -0.252
f3 ~~
f4 0.202 0.021 9.592 0.000 0.780 0.780
f5 -0.033 0.010 -3.394 0.001 -0.277 -0.277
f4 ~~
f5 -0.019 0.009 -2.183 0.029 -0.119 -0.119
Intercepts:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.ige_1 0.000 0.000 0.000
.ige_11 0.000 0.000 0.000
.ige_13 0.000 0.000 0.000
.ige_22 0.000 0.000 0.000
.ige_30 0.000 0.000 0.000
.ige_33 0.000 0.000 0.000
.ige_34 0.000 0.000 0.000
.ige_36 0.000 0.000 0.000
.ige_43 0.000 0.000 0.000
.ige_47 0.000 0.000 0.000
.ige_48 0.000 0.000 0.000
.ige_53 0.000 0.000 0.000
.ige_5 0.000 0.000 0.000
.ige_8 0.000 0.000 0.000
.ige_9 0.000 0.000 0.000
.ige_10 0.000 0.000 0.000
.ige_15 0.000 0.000 0.000
.ige_16 0.000 0.000 0.000
.ige_23 0.000 0.000 0.000
.ige_25 0.000 0.000 0.000
.ige_27 0.000 0.000 0.000
.ige_29 0.000 0.000 0.000
.ige_50 0.000 0.000 0.000
.ige_4 0.000 0.000 0.000
.ige_37 0.000 0.000 0.000
.ige_38 0.000 0.000 0.000
.ige_39 0.000 0.000 0.000
.ige_41 0.000 0.000 0.000
.ige_44 0.000 0.000 0.000
.ige_45 0.000 0.000 0.000
.ige_51 0.000 0.000 0.000
.ige_54 0.000 0.000 0.000
.ige_55 0.000 0.000 0.000
.ige_17 0.000 0.000 0.000
.ige_18 0.000 0.000 0.000
.ige_19 0.000 0.000 0.000
.ige_24 0.000 0.000 0.000
.ige_26 0.000 0.000 0.000
.ige_31 0.000 0.000 0.000
.ige_40 0.000 0.000 0.000
.ige_46 0.000 0.000 0.000
.ige_52 0.000 0.000 0.000
.ige_2 0.000 0.000 0.000
.ige_3 0.000 0.000 0.000
.ige_6 0.000 0.000 0.000
.ige_12 0.000 0.000 0.000
.ige_20 0.000 0.000 0.000
.ige_32 0.000 0.000 0.000
.ige_57 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
f4 0.000 0.000 0.000
f5 0.000 0.000 0.000
Thresholds:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
ige_1|t1 -0.215 0.048 -4.494 0.000 -0.215 -0.215
ige_1|t2 0.237 0.048 4.947 0.000 0.237 0.237
ige_1|t3 0.548 0.050 10.934 0.000 0.548 0.548
ige_1|t4 0.970 0.057 17.168 0.000 0.970 0.970
ige_1|t5 1.444 0.071 20.450 0.000 1.444 1.444
ige_11|t1 0.523 0.050 10.490 0.000 0.523 0.523
ige_11|t2 1.153 0.061 18.938 0.000 1.153 1.153
ige_11|t3 1.497 0.073 20.552 0.000 1.497 1.497
ige_11|t4 1.644 0.080 20.565 0.000 1.644 1.644
ige_11|t5 1.860 0.093 19.922 0.000 1.860 1.860
ige_13|t1 0.319 0.048 6.603 0.000 0.319 0.319
ige_13|t2 0.898 0.055 16.303 0.000 0.898 0.898
ige_13|t3 1.196 0.062 19.263 0.000 1.196 1.196
ige_13|t4 1.530 0.074 20.590 0.000 1.530 1.530
ige_13|t5 1.784 0.088 20.231 0.000 1.784 1.784
ige_22|t1 -0.099 0.048 -2.078 0.038 -0.099 -0.099
ige_22|t2 0.274 0.048 5.700 0.000 0.274 0.274
ige_22|t3 0.507 0.050 10.193 0.000 0.507 0.507
ige_22|t4 0.820 0.054 15.270 0.000 0.820 0.820
ige_22|t5 1.099 0.059 18.479 0.000 1.099 1.099
ige_30|t1 0.495 0.050 9.970 0.000 0.495 0.495
ige_30|t2 0.965 0.056 17.103 0.000 0.965 0.965
ige_30|t3 1.249 0.064 19.616 0.000 1.249 1.249
ige_30|t4 1.554 0.075 20.604 0.000 1.554 1.554
ige_30|t5 1.687 0.082 20.497 0.000 1.687 1.687
ige_33|t1 0.193 0.048 4.042 0.000 0.193 0.193
ige_33|t2 0.805 0.053 15.060 0.000 0.805 0.805
ige_33|t3 1.241 0.063 19.567 0.000 1.241 1.241
ige_33|t4 1.673 0.081 20.524 0.000 1.673 1.673
ige_33|t5 2.084 0.112 18.547 0.000 2.084 2.084
ige_34|t1 0.491 0.050 9.896 0.000 0.491 0.491
ige_34|t2 0.976 0.057 17.233 0.000 0.976 0.976
ige_34|t3 1.167 0.061 19.048 0.000 1.167 1.167
ige_34|t4 1.414 0.069 20.370 0.000 1.414 1.414
ige_34|t5 1.718 0.084 20.430 0.000 1.718 1.718
ige_36|t1 0.898 0.055 16.303 0.000 0.898 0.898
ige_36|t2 1.454 0.071 20.474 0.000 1.454 1.454
ige_36|t3 1.784 0.088 20.231 0.000 1.784 1.784
ige_36|t4 1.947 0.100 19.460 0.000 1.947 1.947
ige_36|t5 2.084 0.112 18.547 0.000 2.084 2.084
ige_43|t1 0.999 0.057 17.491 0.000 0.999 0.999
ige_43|t2 1.444 0.071 20.450 0.000 1.444 1.444
ige_43|t3 1.702 0.083 20.466 0.000 1.702 1.702
ige_43|t4 1.947 0.100 19.460 0.000 1.947 1.947
ige_43|t5 2.084 0.112 18.547 0.000 2.084 2.084
ige_47|t1 0.178 0.048 3.740 0.000 0.178 0.178
ige_47|t2 0.719 0.052 13.781 0.000 0.719 0.719
ige_47|t3 1.126 0.060 18.712 0.000 1.126 1.126
ige_47|t4 1.519 0.074 20.579 0.000 1.519 1.519
ige_47|t5 1.840 0.092 20.011 0.000 1.840 1.840
ige_48|t1 -0.020 0.047 -0.416 0.678 -0.020 -0.020
ige_48|t2 0.552 0.050 11.008 0.000 0.552 0.552
ige_48|t3 0.931 0.056 16.706 0.000 0.931 0.931
ige_48|t4 1.289 0.065 19.847 0.000 1.289 1.289
ige_48|t5 1.750 0.086 20.342 0.000 1.750 1.750
ige_53|t1 0.556 0.050 11.082 0.000 0.556 0.556
ige_53|t2 1.011 0.057 17.619 0.000 1.011 1.011
ige_53|t3 1.424 0.070 20.398 0.000 1.424 1.424
ige_53|t4 1.734 0.085 20.388 0.000 1.734 1.734
ige_53|t5 2.084 0.112 18.547 0.000 2.084 2.084
ige_5|t1 -0.647 0.051 -12.623 0.000 -0.647 -0.647
ige_5|t2 -0.052 0.047 -1.096 0.273 -0.052 -0.052
ige_5|t3 0.392 0.049 8.029 0.000 0.392 0.392
ige_5|t4 0.795 0.053 14.920 0.000 0.795 0.795
ige_5|t5 1.249 0.064 19.616 0.000 1.249 1.249
ige_8|t1 -0.113 0.048 -2.381 0.017 -0.113 -0.113
ige_8|t2 0.403 0.049 8.254 0.000 0.403 0.403
ige_8|t3 0.877 0.055 16.031 0.000 0.877 0.877
ige_8|t4 1.249 0.064 19.616 0.000 1.249 1.249
ige_8|t5 1.579 0.077 20.608 0.000 1.579 1.579
ige_9|t1 -0.856 0.054 -15.756 0.000 -0.856 -0.856
ige_9|t2 -0.419 0.049 -8.553 0.000 -0.419 -0.419
ige_9|t3 -0.005 0.047 -0.113 0.910 -0.005 -0.005
ige_9|t4 0.487 0.050 9.821 0.000 0.487 0.487
ige_9|t5 0.953 0.056 16.971 0.000 0.953 0.953
ige_10|t1 -0.724 0.052 -13.853 0.000 -0.724 -0.724
ige_10|t2 -0.304 0.048 -6.302 0.000 -0.304 -0.304
ige_10|t3 -0.009 0.047 -0.189 0.850 -0.009 -0.009
ige_10|t4 0.419 0.049 8.553 0.000 0.419 0.419
ige_10|t5 0.846 0.054 15.618 0.000 0.846 0.846
ige_15|t1 -0.660 0.051 -12.841 0.000 -0.660 -0.660
ige_15|t2 -0.208 0.048 -4.344 0.000 -0.208 -0.208
ige_15|t3 0.193 0.048 4.042 0.000 0.193 0.193
ige_15|t4 0.673 0.052 13.059 0.000 0.673 0.673
ige_15|t5 1.126 0.060 18.712 0.000 1.126 1.126
ige_16|t1 -0.204 0.048 -4.268 0.000 -0.204 -0.204
ige_16|t2 0.353 0.049 7.279 0.000 0.353 0.353
ige_16|t3 0.733 0.052 13.997 0.000 0.733 0.733
ige_16|t4 1.099 0.059 18.479 0.000 1.099 1.099
ige_16|t5 1.404 0.069 20.340 0.000 1.404 1.404
ige_23|t1 -0.419 0.049 -8.553 0.000 -0.419 -0.419
ige_23|t2 0.066 0.047 1.398 0.162 0.066 0.066
ige_23|t3 0.527 0.050 10.564 0.000 0.527 0.527
ige_23|t4 1.092 0.059 18.419 0.000 1.092 1.092
ige_23|t5 1.644 0.080 20.565 0.000 1.644 1.644
ige_25|t1 -1.289 0.065 -19.847 0.000 -1.289 -1.289
ige_25|t2 -0.701 0.052 -13.493 0.000 -0.701 -0.701
ige_25|t3 -0.237 0.048 -4.947 0.000 -0.237 -0.237
ige_25|t4 0.189 0.048 3.966 0.000 0.189 0.189
ige_25|t5 0.612 0.051 12.038 0.000 0.612 0.612
ige_27|t1 -0.491 0.050 -9.896 0.000 -0.491 -0.491
ige_27|t2 0.120 0.048 2.532 0.011 0.120 0.120
ige_27|t3 0.552 0.050 11.008 0.000 0.552 0.552
ige_27|t4 0.959 0.056 17.037 0.000 0.959 0.959
ige_27|t5 1.340 0.067 20.097 0.000 1.340 1.340
ige_29|t1 0.146 0.048 3.061 0.002 0.146 0.146
ige_29|t2 0.719 0.052 13.781 0.000 0.719 0.719
ige_29|t3 1.054 0.058 18.056 0.000 1.054 1.054
ige_29|t4 1.542 0.075 20.598 0.000 1.542 1.542
ige_29|t5 1.821 0.091 20.092 0.000 1.821 1.821
ige_50|t1 -0.052 0.047 -1.096 0.273 -0.052 -0.052
ige_50|t2 0.447 0.049 9.076 0.000 0.447 0.447
ige_50|t3 0.898 0.055 16.303 0.000 0.898 0.898
ige_50|t4 1.297 0.065 19.891 0.000 1.297 1.297
ige_50|t5 1.718 0.084 20.430 0.000 1.718 1.718
ige_4|t1 -0.805 0.053 -15.060 0.000 -0.805 -0.805
ige_4|t2 -0.153 0.048 -3.212 0.001 -0.153 -0.153
ige_4|t3 0.319 0.048 6.603 0.000 0.319 0.319
ige_4|t4 0.841 0.054 15.549 0.000 0.841 0.841
ige_4|t5 1.233 0.063 19.518 0.000 1.233 1.233
ige_37|t1 0.153 0.048 3.212 0.001 0.153 0.153
ige_37|t2 0.678 0.052 13.132 0.000 0.678 0.678
ige_37|t3 1.036 0.058 17.871 0.000 1.036 1.036
ige_37|t4 1.367 0.068 20.208 0.000 1.367 1.367
ige_37|t5 1.702 0.083 20.466 0.000 1.702 1.702
ige_38|t1 -0.757 0.053 -14.354 0.000 -0.757 -0.757
ige_38|t2 -0.282 0.048 -5.851 0.000 -0.282 -0.282
ige_38|t3 0.157 0.048 3.287 0.001 0.157 0.157
ige_38|t4 0.660 0.051 12.841 0.000 0.660 0.660
ige_38|t5 1.086 0.059 18.360 0.000 1.086 1.086
ige_39|t1 0.056 0.047 1.172 0.241 0.056 0.056
ige_39|t2 0.590 0.051 11.671 0.000 0.590 0.590
ige_39|t3 0.866 0.055 15.894 0.000 0.866 0.866
ige_39|t4 1.233 0.063 19.518 0.000 1.233 1.233
ige_39|t5 1.644 0.080 20.565 0.000 1.644 1.644
ige_41|t1 -0.781 0.053 -14.708 0.000 -0.781 -0.781
ige_41|t2 -0.304 0.048 -6.302 0.000 -0.304 -0.304
ige_41|t3 0.230 0.048 4.796 0.000 0.230 0.230
ige_41|t4 0.742 0.053 14.140 0.000 0.742 0.742
ige_41|t5 1.146 0.061 18.882 0.000 1.146 1.146
ige_44|t1 -0.346 0.048 -7.129 0.000 -0.346 -0.346
ige_44|t2 0.252 0.048 5.248 0.000 0.252 0.252
[ reached getOption("max.print") -- omitted 103 rows ]
Variances:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.ige_1 0.591 0.591 0.591
.ige_11 0.529 0.529 0.529
.ige_13 0.694 0.694 0.694
.ige_22 0.611 0.611 0.611
.ige_30 0.750 0.750 0.750
.ige_33 0.534 0.534 0.534
.ige_34 0.504 0.504 0.504
.ige_36 0.492 0.492 0.492
.ige_43 0.540 0.540 0.540
.ige_47 0.579 0.579 0.579
.ige_48 0.583 0.583 0.583
.ige_53 0.542 0.542 0.542
.ige_5 0.567 0.567 0.567
.ige_8 0.431 0.431 0.431
.ige_9 0.952 0.952 0.952
.ige_10 0.709 0.709 0.709
.ige_15 0.699 0.699 0.699
.ige_16 0.771 0.771 0.771
.ige_23 0.734 0.734 0.734
.ige_25 0.922 0.922 0.922
.ige_27 0.457 0.457 0.457
.ige_29 0.317 0.317 0.317
.ige_50 0.648 0.648 0.648
.ige_4 0.806 0.806 0.806
.ige_37 0.537 0.537 0.537
.ige_38 0.560 0.560 0.560
.ige_39 0.438 0.438 0.438
.ige_41 0.998 0.998 0.998
.ige_44 0.416 0.416 0.416
.ige_45 0.647 0.647 0.647
.ige_51 0.697 0.697 0.697
.ige_54 0.413 0.413 0.413
.ige_55 0.472 0.472 0.472
.ige_17 0.654 0.654 0.654
.ige_18 0.636 0.636 0.636
.ige_19 0.615 0.615 0.615
.ige_24 0.495 0.495 0.495
.ige_26 0.568 0.568 0.568
.ige_31 0.615 0.615 0.615
.ige_40 0.665 0.665 0.665
.ige_46 0.545 0.545 0.545
.ige_52 0.424 0.424 0.424
.ige_2 0.929 0.929 0.929
.ige_3 0.880 0.880 0.880
.ige_6 0.508 0.508 0.508
.ige_12 0.937 0.937 0.937
.ige_20 0.996 0.996 0.996
.ige_32 0.981 0.981 0.981
.ige_57 0.525 0.525 0.525
f1 0.409 0.033 12.384 0.000 1.000 1.000
f2 0.433 0.033 13.001 0.000 1.000 1.000
f3 0.194 0.029 6.575 0.000 1.000 1.000
f4 0.346 0.036 9.726 0.000 1.000 1.000
f5 0.071 0.032 2.213 0.027 1.000 1.000
Scales y*:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
ige_1 1.000 1.000 1.000
ige_11 1.000 1.000 1.000
ige_13 1.000 1.000 1.000
ige_22 1.000 1.000 1.000
ige_30 1.000 1.000 1.000
ige_33 1.000 1.000 1.000
ige_34 1.000 1.000 1.000
ige_36 1.000 1.000 1.000
ige_43 1.000 1.000 1.000
ige_47 1.000 1.000 1.000
ige_48 1.000 1.000 1.000
ige_53 1.000 1.000 1.000
ige_5 1.000 1.000 1.000
ige_8 1.000 1.000 1.000
ige_9 1.000 1.000 1.000
ige_10 1.000 1.000 1.000
ige_15 1.000 1.000 1.000
ige_16 1.000 1.000 1.000
ige_23 1.000 1.000 1.000
ige_25 1.000 1.000 1.000
ige_27 1.000 1.000 1.000
ige_29 1.000 1.000 1.000
ige_50 1.000 1.000 1.000
ige_4 1.000 1.000 1.000
ige_37 1.000 1.000 1.000
ige_38 1.000 1.000 1.000
ige_39 1.000 1.000 1.000
ige_41 1.000 1.000 1.000
ige_44 1.000 1.000 1.000
ige_45 1.000 1.000 1.000
ige_51 1.000 1.000 1.000
ige_54 1.000 1.000 1.000
ige_55 1.000 1.000 1.000
ige_17 1.000 1.000 1.000
ige_18 1.000 1.000 1.000
ige_19 1.000 1.000 1.000
ige_24 1.000 1.000 1.000
ige_26 1.000 1.000 1.000
ige_31 1.000 1.000 1.000
ige_40 1.000 1.000 1.000
ige_46 1.000 1.000 1.000
ige_52 1.000 1.000 1.000
ige_2 1.000 1.000 1.000
ige_3 1.000 1.000 1.000
ige_6 1.000 1.000 1.000
ige_12 1.000 1.000 1.000
ige_20 1.000 1.000 1.000
ige_32 1.000 1.000 1.000
ige_57 1.000 1.000 1.000
library(semPlot)
Registered S3 method overwritten by 'htmlwidgets':
method from
print.htmlwidget tools:rstudio
Registered S3 method overwritten by 'data.table':
method from
print.data.table
semPaths(cfa_1,
residuals=F,
sizeMan=5,
sizeLat = 8,
"std",
intercepts = F,
posCol=c("skyblue4", "red"),
#edge.color="skyblue4",
edge.label.cex=1.2,
layout="circle2")
alpha(ds_psych, check.keys=TRUE)
Some items were negatively correlated with total scale and were automatically reversed.
This is indicated by a negative sign for the variable name.
Reliability analysis
Call: alpha(x = ds_psych, check.keys = TRUE)
lower alpha upper 95% confidence boundaries
0.9 0.91 0.92
Reliability if an item is dropped:
Item statistics
Non missing response frequency for each item
1 2 3 4 5 6 miss
ige_1 0.39 0.19 0.13 0.13 0.09 0.07 0.02
ige_2 0.14 0.16 0.21 0.18 0.13 0.18 0.01
ige_3 0.20 0.10 0.08 0.10 0.15 0.37 0.01
ige_4 0.22 0.24 0.19 0.17 0.09 0.10 0.02
ige_5 0.26 0.23 0.18 0.13 0.10 0.10 0.02
ige_6 0.12 0.10 0.16 0.17 0.16 0.29 0.01
ige_8 0.45 0.22 0.16 0.08 0.04 0.05 0.03
ige_9 0.20 0.15 0.17 0.19 0.14 0.15 0.02
ige_10 0.24 0.16 0.13 0.16 0.14 0.18 0.01
ige_11 0.70 0.18 0.06 0.02 0.02 0.03 0.07
ige_12 0.07 0.06 0.08 0.13 0.19 0.48 0.01
ige_13 0.62 0.20 0.07 0.05 0.03 0.03 0.04
ige_15 0.25 0.17 0.17 0.17 0.12 0.12 0.01
ige_16 0.41 0.22 0.14 0.10 0.05 0.07 0.04
ige_17 0.26 0.30 0.22 0.11 0.05 0.06 0.02
ige_18 0.26 0.24 0.16 0.16 0.11 0.07 0.01
ige_19 0.33 0.21 0.17 0.13 0.09 0.07 0.02
ige_20 0.11 0.08 0.13 0.17 0.21 0.30 0.00
ige_22 0.46 0.15 0.09 0.10 0.07 0.13 0.06
ige_23 0.33 0.20 0.19 0.16 0.08 0.04 0.01
ige_24 0.41 0.21 0.16 0.09 0.06 0.07 0.05
ige_25 0.09 0.14 0.17 0.19 0.17 0.24 0.01
ige_26 0.21 0.30 0.17 0.15 0.08 0.08 0.01
ige_27 0.31 0.24 0.16 0.12 0.08 0.08 0.02
ige_29 0.56 0.22 0.09 0.08 0.03 0.03 0.04
ige_30 0.68 0.14 0.07 0.05 0.01 0.04 0.06
ige_31 0.19 0.18 0.17 0.14 0.14 0.18 0.02
ige_32 0.17 0.09 0.11 0.14 0.17 0.33 0.01
ige_33 0.58 0.22 0.10 0.06 0.03 0.02 0.04
ige_34 0.68 0.15 0.05 0.05 0.03 0.04 0.08
ige_36 0.80 0.12 0.04 0.01 0.01 0.02 0.07
ige_37 0.55 0.20 0.10 0.06 0.04 0.04 0.04
ige_38 0.23 0.18 0.18 0.17 0.11 0.13 0.02
ige_39 0.52 0.22 0.08 0.08 0.06 0.05 0.04
ige_40 0.52 0.16 0.11 0.09 0.06 0.07 0.05
ige_41 0.22 0.18 0.22 0.17 0.10 0.11 0.01
ige_43 0.82 0.10 0.03 0.02 0.01 0.02 0.06
ige_44 0.37 0.24 0.14 0.11 0.06 0.08 0.04
ige_45 0.24 0.24 0.19 0.14 0.10 0.09 0.02
ige_46 0.74 0.09 0.03 0.05 0.03 0.05 0.10
ige_47 0.55 0.21 0.12 0.06 0.03 0.03 0.03
ige_48 0.49 0.23 0.12 0.08 0.06 0.04 0.03
ige_50 0.46 0.21 0.16 0.08 0.05 0.04 0.03
ige_51 0.12 0.14 0.20 0.21 0.18 0.15 0.01
ige_52 0.39 0.23 0.15 0.11 0.06 0.06 0.04
ige_53 0.70 0.14 0.09 0.03 0.02 0.02 0.05
ige_54 0.50 0.19 0.12 0.09 0.05 0.06 0.05
ige_55 0.30 0.20 0.17 0.13 0.10 0.10 0.02
ige_57 0.13 0.12 0.15 0.17 0.17 0.24 0.01
psych::splitHalf(ds_psych)
Some items were negatively correlated with total scale and were automatically reversed.
Split half reliabilities
Call: psych::splitHalf(r = ds_psych)
Maximum split half reliability (lambda 4) = 0.94
Guttman lambda 6 = 0.93
Average split half reliability = 0.91
Guttman lambda 3 (alpha) = 0.91
Guttman lambda 2 = 0.92
Minimum split half reliability (beta) = 0.85
Average interitem r = 0.18 with median = 0.19
library(semTools)
reliability(cfa_1)
For constructs with categorical indicators, Zumbo et al.`s (2007) "ordinal alpha" is calculated in addition to the standard alpha, which treats ordinal variables as numeric. See Chalmers (2018) for a critique of "alpha.ord" and the response by Zumbo & Kroc (2019). Likewise, average variance extracted is calculated from polychoric (polyserial) not Pearson correlations.
f1 f2 f3 f4 f5
alpha 0.8182011 0.7766164 0.8020904 0.8178008 0.5713324
alpha.ord 0.8906992 0.8198210 0.8349484 0.8583297 0.6295103
omega 0.8374093 0.8002272 0.8254517 0.8333609 0.4633902
omega2 0.8374093 0.8002272 0.8254517 0.8333609 0.4633902
omega3 0.8693290 0.8253321 0.8515023 0.8508998 0.3670119
avevar 0.4209350 0.3449216 0.4016277 0.4203952 0.1776979
I’ll compute test retest for each item via correlation coef. and ICC
First block: compute the correlation coefficient
correlations <- dados %>%
select(ige_1:ige_57,contains("_reteste_"), -contains("copy")) %>%
mutate_all(., as.numeric) %>%
select(-c(ige_7, ige_14, ige_21, ige_28, ige_35, ige_42, ige_49, ige_56)) %>% #get rid of validity
select(-c(ige_reteste_7, ige_reteste_14, ige_reteste_21, ige_reteste_28, ige_reteste_35, ige_reteste_42, ige_reteste_49, ige_reteste_56)) %>% #get rid of validity
{Hmisc::rcorr(as.matrix(.), type = "spearman")}
Second block: report the table
correlations <- left_join(
#correlation coefficiente
correlations$r %>%
data.frame() %>% #transform into dataframe
rownames_to_column("item") %>% #get item numbers
select(item,contains("_reteste_")) %>% #select everything
pivot_longer(-item, values_to = "r") %>% #pivot longer
mutate(item_fim=stringr::str_sub(item,start=-2)) %>%
mutate(reteste_fim=stringr::str_sub(name,start=-2)) %>%
filter(item_fim == reteste_fim),
correlations$P %>%
data.frame() %>% #transform into dataframe
rownames_to_column("item") %>% #get item numbers
select(item,contains("_reteste_")) %>% #select everything
pivot_longer(-item, values_to = "p") %>% #pivot longer
mutate(item_fim=stringr::str_sub(item,start=-2)) %>%
mutate(reteste_fim=stringr::str_sub(name,start=-2)) %>%
filter(item_fim == reteste_fim)) %>%
select(item, name, r, p)
Joining, by = c("item", "name", "item_fim", "reteste_fim")
And remove duplicate rows
correlations <- correlations %>%
filter(!str_detect(item, 'reteste'))
Now I’ll compute the ICC
First: create a dataset in which I’ll have all items
ds <- dados %>%
select(ige_1:ige_57,contains("_reteste_"), -contains("copy")) %>%
select(-c(ige_7, ige_14, ige_21, ige_28, ige_35, ige_42, ige_49, ige_56)) %>% #get rid validity
select(-c(ige_reteste_7, ige_reteste_14, ige_reteste_21, ige_reteste_28, ige_reteste_35, ige_reteste_42, ige_reteste_49, ige_reteste_56)) %>%
na.omit()
Then, compute ICC for every T1 T2
purrr::map2(ds %>% select(starts_with("ige_"), -contains("reteste")), ds %>% select(contains("_reteste_")),
function (x, y) psych::ICC(cbind(x, y))$results) %>%
do.call(rbind, .) %>%
data.frame() %>%
rownames_to_column("info") %>%
filter(type == "ICC3k") -> icc_results
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
Minor checks
ds %>% select(ige_20,ige_reteste_20) %>%
psych::ICC()
Call: psych::ICC(x = .)
Intraclass correlation coefficients
Number of subjects = 44 Number of Judges = 2
Third, add this result to correlation dataset. I double checked the order of variables!
correlations <- bind_cols(
correlations,
icc_results %>% select(ICC,p, info))
Error in select(., ICC, p, info) : object 'icc_results' not found
If numeric, round
correlations <- correlations %>%
mutate_if(is.numeric, round,2)
Remove unecessary data frames
rm(ds, icc_results)
correlations
rm(correlations)
Now ill check the summative scores
correlations2 <- dados %>%
select(ige_agressividade,ige_intolerancia,ige_impulsividade,ige_emocoesnegativas,ige_resilienciaemocio,ige_total,ige_total_ajustado,
ends_with("_t2"), -contains("copy")) %>%
{Hmisc::rcorr(as.matrix(.), type = "spearman")}
correlations2 <- bind_cols( #overall results
#correlation coefficients
bind_cols(
correlations2$r %>%
data.frame() %>% #transform into dataframe
rownames_to_column("item") %>% #get item numbers
select(item,ends_with("_t2")) %>% #report all correlations
filter(!str_detect(item, '_t2')) %>% #report only t1 and t2
select(-item) %>% #get rid of first column to get diagonals later
as.matrix(.[,-1]) %>% #get diagonals
diag() %>% # diagonals
data.frame() %>%
setNames(., c("correlacao")), #transform into dataframe
correlations2$r %>% colnames() %>% data.frame() %>% setNames(., c("fator")) %>% filter(!str_detect(fator,"_t2"))),
# p value
bind_cols(
correlations2$P %>%
data.frame() %>% #transform into dataframe
rownames_to_column("item") %>% #get item numbers
select(item,ends_with("_t2")) %>% #report all correlations
filter(!str_detect(item, '_t2')) %>% #report only t1 and t2
select(-item) %>% #get rid of first column to get diagonals later
as.matrix(.[,-1]) %>% #get diagonals
diag() %>% # diagonals
data.frame() %>%
setNames(., c("pvalor")), #transform into dataframe
correlations2$P %>% colnames() %>% data.frame() %>% setNames(., c("fator2")) %>% filter(!str_detect(fator2,"_t2")))
) %>%
select(fator, correlacao, pvalor)
the condition has length > 1 and only the first element will be usedError: Can't recycle `..1` (size 6) to match `..2` (size 7).
Run `rlang::last_error()` to see where the error occurred.
correlations2
minor checks
cor.test(dados$ige_total_ajustado, dados$ige_total_ajustado_t2, method = "spearman", use="complete.obs")
Cannot compute exact p-value with ties
Spearman's rank correlation rho
data: dados$ige_total_ajustado and dados$ige_total_ajustado_t2
S = 6997.2, p-value = 0.0004459
alternative hypothesis: true rho is not equal to 0
sample estimates:
rho
0.5068933
Now I’ll get the ICC for these same factors
purrr::map2(dados %>% select(ige_agressividade,ige_intolerancia,ige_impulsividade,ige_emocoesnegativas,ige_resilienciaemocio,ige_total, ige_total_ajustado), dados %>% select(ends_with("t2")),
function (x, y) psych::ICC(cbind(x, y))$results) %>%
do.call(rbind, .) %>%
data.frame() %>%
rownames_to_column("info") %>%
filter(type == "ICC3k") -> icc_results
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
boundary (singular) fit: see ?isSingular
And I’ll add to the correlations 2 dataframe (this dataframe reports the correlation at the factor level)
correlations2 <- cbind(correlations2, icc_results %>% select(ICC, p, info))
correlations2
minor check
ICC(cbind(dados$ige_total_ajustado, dados$ige_total_ajustado_t2))
boundary (singular) fit: see ?isSingular
Call: ICC(x = cbind(dados$ige_total_ajustado, dados$ige_total_ajustado_t2))
Intraclass correlation coefficients
Number of subjects = 787 Number of Judges = 2
Remove unnecessary vectors
rm(correlations2, icc_results)
After these procedures, a graph would make all interpretation easier.
dados %>%
select(ige_agressividade,ige_intol_ans,ige_impulsividade,ige_emocoesnegativas,ige_resilienciaemocio,ends_with("t2"), -ige_total_t2) %>%
na.omit() %>%
pivot_longer(everything()) %>%
mutate(name = str_remove_all(name, pattern = "ige_")) %>%
mutate(name = str_replace_all(name, "_t2","-T2")) %>%
ggplot(., aes(x=name, y=value)) + geom_boxplot() +
#scale_x_discrete(limits = rev) +
labs(x="Fator", y = "Valor obtido") +
theme_bw() +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=0.5))
dados %>%
select(ige_total, ige_total_t2) %>%
rename("Total T1" = ige_total,
"Total T2" = ige_total_t2) %>%
na.omit() %>%
pivot_longer(everything()) %>%
ggplot(., aes(name, y = value)) +
geom_boxplot() +
labs(x = "Tempo", y = "Resultados médios") +
ggpubr::stat_compare_means( aes(label = ..p.signif..),
label.x = 1.5, label.y = 300) +
theme_bw()
NA
dados %>%
select(ige_total, ige_total_t2) %>%
na.omit() %>%
{t.test(.$ige_total, .$ige_total_t2, paired=T,var.equal=T)}
Paired t-test
data: .$ige_total and .$ige_total_t2
t = 0.84927, df = 43, p-value = 0.4004
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-8.216487 20.171033
sample estimates:
mean of the differences
5.977273
tabela_correlacao <- function(...) {
#r
x<-dados %>%
select(ige_agressividade,ige_intolerancia,ige_impulsividade,ige_emocoesnegativas,ige_resilienciaemocio,ige_total_ajustado,...) %>%
{Hmisc::rcorr(as.matrix(.), type = "spearman")$r} %>% #get correlation between all variables
data.frame() %>% #create a dataframe with the results
select(-c(contains("ige"))) %>% #remove all columns of IGE
rownames_to_column("item") %>% #create a first row
filter(str_detect(item, 'ige')) #preserve only IGE items
#p values
y<-dados %>%
select(ige_agressividade,ige_intolerancia,ige_impulsividade,ige_emocoesnegativas,ige_resilienciaemocio,ige_total_ajustado,...) %>%
{Hmisc::rcorr(as.matrix(.), type = "spearman")$P} %>% #get correlation between all variables
data.frame() %>% #create a dataframe with the results
select(-c(contains("ige"))) %>% #remove all columns of IGE
rownames_to_column("item") %>% #create a first row
filter(str_detect(item, 'ige')) %>% #preserve just the items
rename_with(., ~ paste0(.x, "_p"), .cols=-"item") #rename variables to a further matching
z <- left_join(x, y, by = "item") %>% #create an unique dataset with correlations and p values
mutate_if(is.numeric, round, 2) %>% #round all results
select(item,sort(names(.))) #arrange in the alphabetic order
return(z)
}
tabela_correlacao(staxi_estado_raiva, staxi_traco_raiva, staxi_temperamento, staxi_reacao, staxi_raiva_dentro, staxi_raiva_fora, staxi_controle, staxi_expressao)
| item | ifp_afago | ifp_afago_p | ifp_afilia | ifp_afilia_p | ifp_agressao | ifp_agressao_p | ifp_assisten | ifp_assisten_p | ifp_autonom | ifp_autonom_p | ifp_deferen | ifp_deferen_p | ifp_deneg | ifp_deneg_p | ifp_desempen | ifp_desempen_p | ifp_dominan | ifp_dominan_p | ifp_exibi | ifp_exibi_p | ifp_heterossex | ifp_heterossex_p | ifp_intracep | ifp_intracep_p | ifp_mudanca | ifp_mudanca_p | ifp_ordem | ifp_ordem_p | ifp_persist | ifp_persist_p |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ige_agressividade | 0.06 | 0.59 | -0.17 | 0.11 | 0.58 | 0.00 | -0.23 | 0.03 | 0.34 | 0.00 | 0.01 | 0.95 | 0.18 | 0.09 | 0.26 | 0.01 | 0.30 | 0.00 | 0.37 | 0.00 | 0.31 | 0.00 | 0.07 | 0.50 | 0.11 | 0.29 | 0.00 | 0.98 | 0.16 | 0.13 |
| ige_intolerancia | 0.12 | 0.27 | -0.10 | 0.36 | 0.55 | 0.00 | -0.21 | 0.05 | 0.27 | 0.01 | -0.02 | 0.84 | 0.09 | 0.42 | 0.28 | 0.01 | 0.27 | 0.01 | 0.36 | 0.00 | 0.33 | 0.00 | 0.02 | 0.87 | 0.05 | 0.62 | 0.03 | 0.80 | 0.20 | 0.06 |
| ige_impulsividade | 0.18 | 0.08 | -0.10 | 0.34 | 0.57 | 0.00 | -0.04 | 0.71 | 0.38 | 0.00 | -0.11 | 0.29 | 0.24 | 0.02 | 0.20 | 0.05 | 0.27 | 0.01 | 0.33 | 0.00 | 0.35 | 0.00 | 0.11 | 0.30 | 0.13 | 0.21 | 0.06 | 0.55 | 0.05 | 0.62 |
| ige_emocoesnegativas | 0.14 | 0.18 | -0.16 | 0.13 | 0.50 | 0.00 | -0.17 | 0.12 | 0.27 | 0.01 | -0.06 | 0.58 | 0.43 | 0.00 | 0.17 | 0.10 | 0.17 | 0.11 | 0.21 | 0.04 | 0.20 | 0.06 | -0.01 | 0.89 | 0.12 | 0.26 | 0.12 | 0.27 | 0.09 | 0.40 |
| ige_resilienciaemocio | 0.09 | 0.40 | -0.10 | 0.33 | 0.24 | 0.02 | -0.33 | 0.00 | -0.02 | 0.85 | -0.24 | 0.02 | -0.35 | 0.00 | -0.08 | 0.43 | 0.04 | 0.69 | 0.13 | 0.24 | 0.25 | 0.02 | -0.15 | 0.15 | -0.06 | 0.55 | -0.34 | 0.00 | -0.13 | 0.23 |
| ige_total_ajustado | -0.15 | 0.16 | 0.17 | 0.11 | -0.65 | 0.00 | 0.23 | 0.03 | -0.35 | 0.00 | 0.09 | 0.39 | -0.22 | 0.04 | -0.23 | 0.03 | -0.29 | 0.00 | -0.39 | 0.00 | -0.37 | 0.00 | -0.03 | 0.79 | -0.11 | 0.29 | 0.02 | 0.88 | -0.10 | 0.33 |
minor check
cor.test(dados$ige_agressividade,dados$ifp_afago, method = "spearman")
Cannot compute exact p-value with ties
Spearman's rank correlation rho
data: dados$ige_agressividade and dados$ifp_afago
S = 118374, p-value = 0.589
alternative hypothesis: true rho is not equal to 0
sample estimates:
rho
0.05738313
tabela_correlacao(bfp_abertura, bfp_extroversao, bfp_neuroticismo, bfp_realizacao, bfp_socializacao)
Minor check
cor.test(dados$ige_total_ajustado, dados$bfp_abertura, method = "spearman", use = "complete.obs")
Cannot compute exact p-value with ties
Spearman's rank correlation rho
data: dados$ige_total_ajustado and dados$bfp_abertura
S = 161641, p-value = 0.9971
alternative hypothesis: true rho is not equal to 0
sample estimates:
rho
0.0003649477
tabela_correlacao(ihs_f1, ihs_f2, ihs_f3, ihs_f4, ihs_f5)
tabela_correlacao(ac_total)
tabela_correlacao(dor_total)
tabela_correlacao(cop, cog, cat, avd, bod,tcr)
tabela_correlacao(ihsa_dificult_total)
Resultados aproximados por conta do tamanho amostral
dados %>% select(ige_agressividade,ige_intolerancia, ige_impulsividade, ige_emocoesnegativas, ige_resilienciaemocio, ige_total_ajustado,contains("palo")) %>%
filter_at(vars(contains("palo")), any_vars(!is.na(.))) %>% #remove if paolo is na
mutate_at(vars(contains("palo")), as.factor) %>%
compareGroups(palo_margens_superior ~ ige_agressividade +
ige_intolerancia +
ige_impulsividade + ige_emocoesnegativas +
ige_resilienciaemocio + ige_total_ajustado,
data = .,
max.ylev = 17) %>%
createTable()
--------Summary descriptives table by 'palo_margens_superior'---------
___________________________________________________________________
aumentada diminuída normal p.overall
N=8 N=6 N=81
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
ige_agressividade 15.8 (5.44) 15.5 (3.94) 17.2 (6.57) 0.692
ige_intolerancia 24.9 (9.11) 34.3 (8.76) 27.1 (7.78) 0.070
ige_impulsividade 20.2 (9.08) 26.3 (7.53) 22.4 (7.88) 0.365
ige_emocoesnegativas 12.5 (4.14) 16.5 (9.97) 16.4 (6.06) 0.247
ige_resilienciaemocio 21.5 (4.50) 20.3 (6.92) 18.2 (6.64) 0.319
ige_total_ajustado 248 (22.8) 230 (19.8) 242 (24.1) 0.367
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
emmeans(lm(dados$ige_resilienciaemocio ~ dados$palo_ritmo), pairwise ~ palo_ritmo, adj = "bonferroni")
$emmeans
palo_ritmo emmean SE df lower.CL upper.CL
alto 23.1 1.795 90 19.52 26.6
baixo 19.9 1.269 90 17.40 22.4
médio 17.1 0.846 90 15.41 18.8
muito alto 24.0 4.397 90 15.27 32.7
muito baixo 14.0 3.590 90 6.87 21.1
Confidence level used: 0.95
$contrasts
contrast estimate SE df t.ratio p.value
alto - baixo 3.167 2.20 90 1.441 1.0000
alto - médio 5.991 1.98 90 3.019 0.0330
alto - muito alto -0.917 4.75 90 -0.193 1.0000
alto - muito baixo 9.083 4.01 90 2.263 0.2603
baixo - médio 2.824 1.53 90 1.851 0.6739
baixo - muito alto -4.083 4.58 90 -0.892 1.0000
baixo - muito baixo 5.917 3.81 90 1.554 1.0000
médio - muito alto -6.907 4.48 90 -1.543 1.0000
médio - muito baixo 3.093 3.69 90 0.839 1.0000
muito alto - muito baixo 10.000 5.68 90 1.762 0.8149
P value adjustment: bonferroni method for 10 tests
tableby(~ige_agressividade, data = dados) %>% summary
| Overall (N=787) | |
|---|---|
| ige_agressividade | |
| N-Miss | 86 |
| Mean (SD) | 21.944 (9.151) |
| Range | 12.000 - 72.000 |
NA
ggstatsplot::gghistostats(
data =dados, # dataframe from which variable is to be taken
x = ige_agressividade, # numeric variable whose distribution is of interest
binwidth = 1, # binwidth value (experiment)
normal.curve = TRUE, # superimpose a normal distribution curve
normal.curve.args = list(color = "red", size = 1),
results.subtitle = F,
xlab = "Agressividade"
)
ggstatsplot::gghistostats(
data =dados, # dataframe from which variable is to be taken
x = ige_intolerancia, # numeric variable whose distribution is of interest
binwidth = 1, # binwidth value (experiment)
normal.curve = TRUE, # superimpose a normal distribution curve
normal.curve.args = list(color = "red", size = 1),
results.subtitle = F,
xlab = "Intolerância"
)
ggstatsplot::gghistostats(
data = dados, # dataframe from which variable is to be taken
x = ige_impulsividade, # numeric variable whose distribution is of interest
binwidth = 1, # binwidth value (experiment)
normal.curve = TRUE, # superimpose a normal distribution curve
normal.curve.args = list(color = "red", size = 1),
results.subtitle = F,
xlab = "Impulsividade"
)
ggstatsplot::gghistostats(
data = dados, # dataframe from which variable is to be taken
x = ige_emocoesnegativas, # numeric variable whose distribution is of interest
binwidth = 1, # binwidth value (experiment)
normal.curve = TRUE, # superimpose a normal distribution curve
normal.curve.args = list(color = "red", size = 1),
results.subtitle = F,
xlab = "Emoções negativas"
)
ggstatsplot::gghistostats(
data = dados, # dataframe from which variable is to be taken
x = ige_resilienciaemocio, # numeric variable whose distribution is of interest
binwidth = 1, # binwidth value (experiment)
normal.curve = TRUE, # superimpose a normal distribution curve
normal.curve.args = list(color = "red", size = 1),
results.subtitle = F,
xlab = "Resiliência emocional"
)
ggstatsplot::gghistostats(
data = dados, # dataframe from which variable is to be taken
x = ige_total_ajustado, # numeric variable whose distribution is of interest
binwidth = 1, # binwidth value (experiment)
normal.curve = TRUE, # superimpose a normal distribution curve
normal.curve.args = list(color = "red", size = 1),
results.subtitle = F,
xlab = "IGE Total"
)
mimic <- 'f1 =~ ige_1 + ige_11 + ige_13 + ige_22 + ige_30 + ige_33 + ige_34 + ige_36 + ige_43 + ige_47 + ige_48 + ige_53
f2 =~ ige_5 + ige_8 + ige_9 + ige_10 + ige_15 + ige_16 + ige_23 + ige_25 + ige_27 + ige_29 + ige_50
f3 =~ ige_4 + ige_37 + ige_38 + ige_39 + ige_41 + ige_44 + ige_45 + ige_51 + ige_54 + ige_55
f4 =~ ige_17 + ige_18 + ige_19 + ige_24 + ige_26 + ige_31 + ige_40 + ige_46 + ige_52
f5 =~ ige_2 + ige_3 + ige_6 + ige_12 + ige_20 + ige_32 + ige_57
ige =~ f1 + f2 + f3 + f4 + f5
#regression
ige ~ sexo
'
fit <- sem(mimic, data = cbind(ds_psych, dados %>% select(sexo)))
lavaan::standardizedSolution(fit) %>% dplyr::filter(!is.na(pvalue)) %>% arrange(desc(pvalue)) %>% mutate_if("is.numeric","round",3) %>% select(-ci.lower,-ci.upper,-z)
pvalue_cutoff <- 0.05
obj <- semPlot:::semPlotModel(fit)
# save a copy of the original, so we can compare it later and be sure we removed only what we intended to remove
original_Pars <- obj@Pars
check_Pars <- obj@Pars %>% dplyr::filter(!(edge %in% c("int","<->") | lhs == rhs)) # this is the list of paramater to sift thru
keep_Pars <- obj@Pars %>% dplyr::filter(edge %in% c("int","<->") | lhs == rhs) # this is the list of paramater to keep asis
test_against <- lavaan::standardizedSolution(fit) %>% dplyr::filter(pvalue < pvalue_cutoff, rhs != lhs)
test_against_rev <- test_against %>% rename(rhs2 = lhs, # for some reason, the rhs and lhs are reversed in the standardizedSolution() output, for some of the values
lhs = rhs) %>% # I'll have to reverse it myself, and test against both orders
rename(rhs = rhs2)
checked_Pars <-
check_Pars %>% semi_join(test_against, by = c("lhs", "rhs")) %>% bind_rows(
check_Pars %>% semi_join(test_against_rev, by = c("lhs", "rhs"))
)
obj@Pars <- keep_Pars %>% bind_rows(checked_Pars)
#let's verify by looking at the list of the edges we removed from the object
anti_join(original_Pars,obj@Pars)
semPlot::semPaths(fit, "std",fade = F, residuals = F)
semPaths(obj,
layout = 'tree3',
what = 'std',
intercepts = FALSE,
residuals = FALSE,
sizeLat = 7,
sizeMan = 6,
theme = 'gray',
edge.label.cex = 0.8,
label.font = 2, #bold in all text
label.cex = 1, #font size
label.prop = 0.9, #font size
nCharNodes = 5,
fade = FALSE,
rotation = 2)
apaTables::apa.aov.table(mod_sexo_idade_escolaridade)
ANOVA results using ige_total_ajustado as the dependent variable
Note: Values in square brackets indicate the bounds of the 90% confidence interval for partial eta-squared
olsrr::ols_regress(mod_sexo_idade_escolaridade)
Model Summary
---------------------------------------------------------------
R 0.367 RMSE 30.624
R-Squared 0.135 Coef. Var 14.017
Adj. R-Squared 0.125 MSE 937.842
Pred R-Squared 0.111 MAE 24.143
---------------------------------------------------------------
RMSE: Root Mean Square Error
MSE: Mean Square Error
MAE: Mean Absolute Error
ANOVA
-----------------------------------------------------------------------
Sum of
Squares DF Mean Square F Sig.
-----------------------------------------------------------------------
Regression 98843.744 8 12355.468 13.174 0.0000
Residual 633981.240 676 937.842
Total 732824.984 684
-----------------------------------------------------------------------
Parameter Estimates
----------------------------------------------------------------------------------------------------------
model Beta Std. Error Std. Beta t Sig lower upper
----------------------------------------------------------------------------------------------------------
(Intercept) 199.113 4.145 48.032 0.000 190.974 207.253
sexo_fctFem -3.757 2.474 -0.057 -1.519 0.129 -8.614 1.100
faixa_etaria21 a 30 13.683 3.147 0.179 4.348 0.000 7.504 19.862
faixa_etaria31 a 40 25.834 3.679 0.282 7.023 0.000 18.611 33.058
faixa_etaria41 a 50 28.571 4.571 0.243 6.250 0.000 19.595 37.547
faixa_etaria51 a 60 13.859 6.260 0.082 2.214 0.027 1.568 26.149
faixa_etaria61 a 70 17.407 11.005 0.057 1.582 0.114 -4.200 39.014
nivel_escolaridadeMédio 9.509 3.830 0.144 2.483 0.013 1.989 17.028
nivel_escolaridadeSuperior 17.773 3.936 0.251 4.516 0.000 10.045 25.501
----------------------------------------------------------------------------------------------------------
emmeans(mod_sexo_idade_escolaridade, pairwise ~ nivel_escolaridade)
$emmeans
nivel_escolaridade emmean SE df lower.CL upper.CL
Fundamental 210 3.31 680 203 216
Médio 216 1.70 680 213 219
Superior 226 2.20 680 222 231
Results are averaged over the levels of: sexo_fct
Confidence level used: 0.95
$contrasts
contrast estimate SE df t.ratio p.value
Fundamental - Médio -6.23 3.82 680 -1.631 0.2334
Fundamental - Superior -16.39 3.90 680 -4.203 0.0001
Médio - Superior -10.15 2.87 680 -3.532 0.0013
Results are averaged over the levels of: sexo_fct
P value adjustment: tukey method for comparing a family of 3 estimates
tableby(nivel_escolaridade ~ ige_total_ajustado, dados) %>% summary
| Fundamental (N=183) | Médio (N=382) | Superior (N=210) | Total (N=775) | p value | |
|---|---|---|---|---|---|
| ige_total_ajustado | < 0.001 | ||||
| N-Miss | 87 | 1 | 0 | 88 | |
| Mean (SD) | 216.010 (34.729) | 214.202 (33.032) | 227.519 (29.302) | 218.525 (32.697) | |
| Range | 89.000 - 268.000 | 117.000 - 277.000 | 142.000 - 283.000 | 89.000 - 283.000 |
NA
gridExtra::grid.arrange(
gridExtra::arrangeGrob(
ggplot(dados, aes(x= idade, y = ige_total_ajustado)) +
geom_jitter(alpha=.3, aes(color = ige_total_ajustado)) +
geom_smooth(method = "lm") +
labs(x= "Idade", y = "") +
theme_bw() +
theme(legend.position = "hide"),
dados %>% filter(!is.na(nivel_escolaridade)) %>% ggplot(., aes(x= nivel_escolaridade, y = ige_total_ajustado)) +
geom_boxplot() +
geom_jitter(alpha=.3, aes(color = nivel_escolaridade)) +
labs(x= "Escolaridade", y = "") +
theme_bw() +
theme(legend.position = "hide")),
left = grid::textGrob("IGE Total", rot = 90, vjust = 1))
mod_sexo_idade_escolaridade_agressividade <- lm(ige_agressividade ~ sexo_fct + idade + nivel_escolaridade, dados)
apaTables::apa.aov.table(mod_sexo_idade_escolaridade_agressividade)
ANOVA results using ige_agressividade as the dependent variable
Note: Values in square brackets indicate the bounds of the 90% confidence interval for partial eta-squared
olsrr::ols_regress(mod_sexo_idade_escolaridade_agressividade)
Model Summary
--------------------------------------------------------------
R 0.235 RMSE 8.977
R-Squared 0.055 Coef. Var 40.833
Adj. R-Squared 0.050 MSE 80.593
Pred R-Squared 0.039 MAE 6.618
--------------------------------------------------------------
RMSE: Root Mean Square Error
MSE: Mean Square Error
MAE: Mean Absolute Error
ANOVA
---------------------------------------------------------------------
Sum of
Squares DF Mean Square F Sig.
---------------------------------------------------------------------
Regression 3203.383 4 800.846 9.937 0.0000
Residual 54964.472 682 80.593
Total 58167.854 686
---------------------------------------------------------------------
Parameter Estimates
-------------------------------------------------------------------------------------------------------
model Beta Std. Error Std. Beta t Sig lower upper
-------------------------------------------------------------------------------------------------------
(Intercept) 28.017 1.497 18.711 0.000 25.077 30.957
sexo_fctFem -0.978 0.723 -0.053 -1.352 0.177 -2.398 0.442
idade -0.160 0.032 -0.203 -5.053 0.000 -0.223 -0.098
nivel_escolaridadeMédio -1.063 1.097 -0.057 -0.969 0.333 -3.216 1.091
nivel_escolaridadeSuperior -2.714 1.121 -0.136 -2.420 0.016 -4.915 -0.512
-------------------------------------------------------------------------------------------------------
mod_sexo_idade_escolaridade_impulsividade <- lm(ige_impulsividade ~ sexo_fct + idade + nivel_escolaridade, dados)
apaTables::apa.aov.table(mod_sexo_idade_escolaridade_impulsividade)
olsrr::ols_regress(mod_sexo_idade_escolaridade_impulsividade)
mod_sexo_idade_escolaridade_intolerancia <- lm(ige_intolerancia ~ sexo_fct + idade + nivel_escolaridade, dados)
apaTables::apa.aov.table(mod_sexo_idade_escolaridade_intolerancia)
olsrr::ols_regress(mod_sexo_idade_escolaridade_intolerancia)
mod_sexo_idade_escolaridade_ige_emocoesnegativas <- lm(ige_emocoesnegativas ~ sexo_fct + idade + nivel_escolaridade, dados)
apaTables::apa.aov.table(mod_sexo_idade_escolaridade_ige_emocoesnegativas)
olsrr::ols_regress(mod_sexo_idade_escolaridade_ige_emocoesnegativas)
mod_sexo_idade_escolaridade_ige_resilienciaemocio <- lm(ige_resilienciaemocio ~ sexo_fct + idade + nivel_escolaridade, dados)
apaTables::apa.aov.table(mod_sexo_idade_escolaridade_ige_resilienciaemocio)
olsrr::ols_regress(mod_sexo_idade_escolaridade_ige_resilienciaemocio)
norms_group <- function(grupo, factor) {
grupo <- enquo(grupo)
factor <- enquo(factor)
#condicional para ver se o grupo foi definido
if(rlang::quo_is_missing(grupo) == 0) { #se o grupo TIVER sido definido
x <- dados %>%
group_by(!!grupo) %>%
summarise_at(vars(!!factor),
~quantile(!!factor,
probs = c(seq(from = 0.05, to = 0.95, by = 0.05)), na.rm=T)) %>% #get percentiles
mutate(percentil = seq(0.05, 0.95, by = 0.05)) %>%
mutate(classificacao = case_when(
percentil < 0.1 ~ "inferior",
percentil < 0.3 ~ "medio inferior",
percentil < 0.71 ~ "medio",
percentil < 0.91 ~ "medio superior",
TRUE ~ "superior"
)) %>%
pivot_wider(names_from=!!grupo, values_from=!!factor) %>%
select(classificacao, percentil, everything())
#return
list(x,
dados %>% group_by(!!grupo) %>% summarise_at(vars(!!factor), lst(n=~n(), mean, sd), na.rm=T))
}
#se nao houver grupo definido
else {
x1 <- dados %>%
group_by(!!grupo) %>%
summarise_at(vars(!!factor),
~quantile(!!factor,
probs = c(seq(from = 0.05, to = 0.95, by = 0.05)), na.rm=T)) %>% #get percentiles
mutate(percentil = seq(0.05, 0.95, by = 0.05)) %>%
mutate(classificacao = case_when(
percentil < 0.1 ~ "inferior",
percentil < 0.3 ~ "medio inferior",
percentil < 0.71 ~ "medio",
percentil < 0.91 ~ "medio superior",
TRUE ~ "superior"
)) %>%
#pivot_wider(names_from=!!x, values_from=!!factor) %>%
select(classificacao, percentil, everything())
#return
list(x1,
dados %>% summarise_at(vars(!!factor), lst(n=~n(), mean, sd), na.rm=T))
}
}
norms_group(factor = ige_total_ajustado)
[[1]]
[[2]]
#%>% as.data.frame() %>% writexl::write_xlsx("data.xlsx")
norms_group(factor = ige_agressividade) %>% map_df(., ~as.data.frame(.)) %>% gt::gt() %>% writexl::write_xlsx("data.xlsx")
Error in writexl::write_xlsx(., "data.xlsx") :
Argument x must be a data frame or list of data frames
norms_group(factor = ige_total_ajustado, grupo = nivel_escolaridade)
[[1]]
[[2]]
NA
norms_group(factor = ige_total_ajustado, grupo = faixa_etaria)
[[1]]
[[2]]
#[1] %>% writexl::write_xlsx("data.xlsx")