library(tidyverse)
Registered S3 methods overwritten by 'dbplyr':
method from
print.tbl_lazy
print.tbl_sql
Found more than one class "atomicVector" in cache; using the first, from namespace 'Matrix'
Also defined by 㤼㸱Rmpfr㤼㸲
Found more than one class "atomicVector" in cache; using the first, from namespace 'Matrix'
Also defined by 㤼㸱Rmpfr㤼㸲
Found more than one class "atomicVector" in cache; using the first, from namespace 'Matrix'
Also defined by 㤼㸱Rmpfr㤼㸲
Found more than one class "atomicVector" in cache; using the first, from namespace 'Matrix'
Also defined by 㤼㸱Rmpfr㤼㸲
Found more than one class "atomicVector" in cache; using the first, from namespace 'Matrix'
Also defined by 㤼㸱Rmpfr㤼㸲
Found more than one class "atomicVector" in cache; using the first, from namespace 'Matrix'
Also defined by 㤼㸱Rmpfr㤼㸲
Found more than one class "atomicVector" in cache; using the first, from namespace 'Matrix'
Also defined by 㤼㸱Rmpfr㤼㸲
Found more than one class "atomicVector" in cache; using the first, from namespace 'Matrix'
Also defined by 㤼㸱Rmpfr㤼㸲
Found more than one class "atomicVector" in cache; using the first, from namespace 'Matrix'
Also defined by 㤼㸱Rmpfr㤼㸲
Found more than one class "atomicVector" in cache; using the first, from namespace 'Matrix'
Also defined by 㤼㸱Rmpfr㤼㸲
Found more than one class "atomicVector" in cache; using the first, from namespace 'Matrix'
Also defined by 㤼㸱Rmpfr㤼㸲
Found more than one class "atomicVector" in cache; using the first, from namespace 'Matrix'
Also defined by 㤼㸱Rmpfr㤼㸲
-- Attaching packages --------------------------------------- tidyverse 1.3.0 --
v ggplot2 3.3.1 v purrr 0.3.4
v tibble 3.0.1 v dplyr 1.0.0
v tidyr 1.1.0 v stringr 1.4.0
v readr 1.3.1 v forcats 0.5.0
-- Conflicts ------------------------------------------ tidyverse_conflicts() --
x dplyr::filter() masks stats::filter()
x dplyr::lag() masks stats::lag()
library(arsenal)
package 㤼㸱arsenal㤼㸲 was built under R version 4.0.3
library(readxl)
dados <- read_excel("C:/Users/luisf/Dropbox/Puc-Rio/Projeto - Ivan competencias emocionais/DADOS teste IGE final compartilhado.xlsx")
backup <- dados
dados <- janitor::clean_names(dados)
View(dados)
dados %>%
select(ige_1:ige_57) %>%
select(-c(ige_7, ige_14, ige_21, ige_28, ige_35, ige_42, ige_49, ige_56)) %>%
DataExplorer::profile_missing()
library(summarytools)
Registered S3 method overwritten by 'pryr':
method from
print.bytes Rcpp
For best results, restart R session and update pander using devtools:: or remotes::install_github('rapporter/pander')
Attaching package: 㤼㸱summarytools㤼㸲
The following object is masked from 㤼㸱package:tibble㤼㸲:
view
#view(dfSummary(dados))
ds_psych <- dados %>%
select(ige_1:ige_57) %>%
select(-c(ige_7, ige_14, ige_21, ige_28, ige_35, ige_42, ige_49, ige_56)) %>%
na.omit()
ds_psych %>% str()
tibble [783 x 49] (S3: tbl_df/tbl/data.frame)
$ ige_1 : num [1:783] 1 1 1 1 4 1 4 1 1 1 ...
$ ige_2 : num [1:783] 4 2 1 6 1 3 4 6 1 3 ...
$ ige_3 : num [1:783] 6 1 6 1 2 1 3 1 1 2 ...
$ ige_4 : num [1:783] 4 4 1 3 6 4 3 2 1 1 ...
$ ige_5 : num [1:783] 6 4 1 4 6 1 1 3 1 1 ...
$ ige_6 : num [1:783] 4 5 1 3 3 3 6 1 1 6 ...
$ ige_8 : num [1:783] 2 3 1 1 6 3 1 1 1 1 ...
$ ige_9 : num [1:783] 6 4 3 6 3 4 1 3 6 3 ...
$ ige_10: num [1:783] 6 6 6 6 6 1 4 5 6 1 ...
$ ige_11: num [1:783] 1 1 1 1 1 2 1 1 1 1 ...
$ ige_12: num [1:783] 6 6 6 6 3 3 6 6 1 6 ...
$ ige_13: num [1:783] 1 1 1 4 1 2 1 1 1 1 ...
$ ige_15: num [1:783] 6 1 4 4 4 2 1 3 1 1 ...
$ ige_16: num [1:783] 1 6 1 2 6 2 1 1 6 1 ...
$ ige_17: num [1:783] 3 3 3 4 6 3 3 3 6 6 ...
$ ige_18: num [1:783] 1 4 1 3 3 4 1 3 1 6 ...
$ ige_19: num [1:783] 1 1 1 6 5 3 1 4 1 5 ...
$ ige_20: num [1:783] 3 5 6 6 4 2 6 3 6 6 ...
$ ige_22: num [1:783] 6 6 1 1 6 3 1 4 1 4 ...
$ ige_23: num [1:783] 1 2 4 1 1 3 2 2 1 3 ...
$ ige_24: num [1:783] 2 1 1 1 1 4 1 1 6 6 ...
$ ige_25: num [1:783] 6 6 1 6 6 4 5 6 6 6 ...
$ ige_26: num [1:783] 3 4 5 6 6 4 3 4 1 3 ...
$ ige_27: num [1:783] 1 6 1 1 5 1 1 5 6 1 ...
$ ige_29: num [1:783] 1 1 1 1 6 1 1 1 1 1 ...
$ ige_30: num [1:783] 2 6 1 1 4 1 2 1 1 1 ...
$ ige_31: num [1:783] 1 6 1 1 3 4 3 2 1 6 ...
$ ige_32: num [1:783] 6 3 6 6 4 1 6 5 6 1 ...
$ ige_33: num [1:783] 1 1 1 1 6 2 1 1 1 1 ...
$ ige_34: num [1:783] 6 3 1 1 5 3 1 4 1 1 ...
$ ige_36: num [1:783] 1 1 1 1 4 1 1 1 1 1 ...
$ ige_37: num [1:783] 1 3 3 1 6 1 1 2 1 4 ...
$ ige_38: num [1:783] 2 6 1 3 6 4 1 5 1 6 ...
$ ige_39: num [1:783] 1 6 1 1 5 2 1 1 1 1 ...
$ ige_40: num [1:783] 1 1 1 6 1 4 1 1 1 6 ...
$ ige_41: num [1:783] 3 6 3 1 1 4 3 3 6 6 ...
$ ige_43: num [1:783] 1 1 1 1 1 1 1 1 1 1 ...
$ ige_44: num [1:783] 2 6 1 3 6 3 1 1 1 2 ...
$ ige_45: num [1:783] 2 6 1 1 6 3 4 3 1 1 ...
$ ige_46: num [1:783] 1 4 1 1 1 1 1 1 6 4 ...
$ ige_47: num [1:783] 2 4 1 1 1 2 1 1 6 1 ...
$ ige_48: num [1:783] 1 6 1 3 6 1 2 1 1 1 ...
$ ige_50: num [1:783] 1 1 1 6 1 1 1 2 1 1 ...
$ ige_51: num [1:783] 2 6 6 4 5 4 5 4 1 3 ...
$ ige_52: num [1:783] 2 2 1 3 1 3 1 1 6 6 ...
$ ige_53: num [1:783] 1 5 1 1 1 3 1 1 1 1 ...
$ ige_54: num [1:783] 1 3 1 1 1 5 1 1 1 2 ...
$ ige_55: num [1:783] 2 5 3 1 6 5 1 1 6 3 ...
$ ige_57: num [1:783] 3 3 1 6 4 2 6 1 1 3 ...
- attr(*, "na.action")= 'omit' Named int [1:4] 715 720 724 767
..- attr(*, "names")= chr [1:4] "715" "720" "724" "767"
dados <- dados %>%
select(-c(ige_hostilidade, ige_impulsividade, ige_intolerancia, ige_emocoes_negat, ige_resiliencia_emocional, total_ige,
ige_hostilid_reteste, ige_impulsiv_reteste, ige_intoler_reteste, ige_emoc_negat_reteste, ige_resiliencia_emocio_reteste, total_ige_reteste))
dados <- dados %>% select(-ige_validade)
dados <- dados %>% mutate_at(vars(starts_with("ige")),
list(copy = ~paste0(.) %>% as.numeric(is.character)))
NAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercion
I’ll reverse all items BUT resiliencia emocional (2, 3, 6, etc)
dados <- dados %>%
mutate_at(vars(ige_1_copy,
ige_10_copy,
ige_11_copy,
ige_13_copy,
ige_15_copy,
ige_16_copy,
ige_17_copy,
ige_18_copy,
ige_19_copy,
ige_22_copy,
ige_23_copy,
ige_24_copy,
ige_25_copy,
ige_26_copy,
ige_27_copy,
ige_29_copy,
ige_30_copy,
ige_31_copy,
ige_33_copy,
ige_34_copy,
ige_36_copy,
ige_37_copy,
ige_38_copy,
ige_39_copy,
ige_4_copy,
ige_40_copy,
ige_41_copy,
ige_43_copy,
ige_44_copy,
ige_45_copy,
ige_46_copy,
ige_47_copy,
ige_48_copy,
ige_5_copy,
ige_50_copy,
ige_51_copy,
ige_52_copy,
ige_53_copy,
ige_54_copy,
ige_55_copy,
ige_8_copy,
ige_9_copy), list(~7-.)) #reverse
minor check
cor(dados$ige_50, dados$ige_50_copy, use = "complete.obs")
[1] -1
dados <- dados %>%
#HOSTILIDADE
mutate(ige_hostilidade = rowSums(select(., ige_34_copy,
ige_11_copy,
ige_36_copy,
ige_22_copy,
ige_53_copy,
ige_33_copy,
ige_48_copy,
ige_43_copy,
ige_1_copy,
ige_47_copy,
ige_30_copy,
ige_13_copy), na.rm=F)) #i'll not use missing values!!!
Minor check
dados %>% filter(id == 715) %>% select(ige_hostilidade)
That’s right!!!
dados <- dados %>%
mutate(ige_impulsividade = rowSums(select(., ige_29_copy,
ige_8_copy,
ige_5_copy,
ige_27_copy,
ige_50_copy,
ige_15_copy,
ige_10_copy,
ige_16_copy,
ige_23_copy,
ige_9_copy,
ige_25_copy), na.rm=F)) ##I'll not use missing vaues
Minor check
dados %>% filter(id == 715) %>% select(ige_impulsividade)
That’s right!!! (returning NA)
dados <- dados %>%
mutate(ige_intolerancia = rowSums(select(.,
ige_54_copy,
ige_39_copy,
ige_44_copy,
ige_38_copy,
ige_55_copy,
ige_37_copy,
ige_45_copy,
ige_51_copy,
ige_4_copy,
ige_41_copy), na.rm=F)) #same thing. Don't use missings
Minor check
dados %>% filter(id == 715) %>% select(ige_intolerancia)
That’r right! Returning missing!
dados <- dados %>%
mutate(ige_emocoesnegativas = rowSums(select(.,
ige_46_copy,
ige_52_copy,
ige_24_copy,
ige_31_copy,
ige_40_copy,
ige_26_copy,
ige_19_copy,
ige_18_copy,
ige_17_copy), na.rm=F)) #don't use missings
minor check
dados %>% filter(id == 715) %>% select(ige_emocoesnegativas)
That’s right! Returning NA
##ATTENTION! this scale IS NOT REVERSED!!!!!!
dados <- dados %>%
mutate(ige_resilienciaemocio = rowSums(select(.,
ige_12,
ige_32,
ige_3,
ige_20,
ige_6,
ige_57,
ige_2), na.rm=F)) #don't use missings
minor check
dados %>% filter(id == 715) %>% select(ige_resilienciaemocio)
That’s right. Now it is returnig missing, but in the Ivans’ SPSS was returning 0 (suggesting a bad coping!)
dados <- dados %>%
mutate(ige_total = rowSums(select(.,
ige_hostilidade,
ige_impulsividade,
ige_intolerancia,
ige_emocoesnegativas,
ige_resilienciaemocio), na.rm=F)) #dont use missings
minor check
dados %>% filter(id == 715) %>% select(ige_total)
all ok!
I’ll reverse all items BUT resiliencia emocional (2, 3, 6, etc) at t2
dados <- dados %>%
mutate_at(vars(ige_reteste_1_copy,
ige_reteste_10_copy,
ige_reteste_11_copy,
ige_reteste_13_copy,
ige_reteste_15_copy,
ige_reteste_16_copy,
ige_reteste_17_copy,
ige_reteste_18_copy,
ige_reteste_19_copy,
ige_reteste_22_copy,
ige_reteste_23_copy,
ige_reteste_24_copy,
ige_reteste_25_copy,
ige_reteste_26_copy,
ige_reteste_27_copy,
ige_reteste_29_copy,
ige_reteste_30_copy,
ige_reteste_31_copy,
ige_reteste_33_copy,
ige_reteste_34_copy,
ige_reteste_36_copy,
ige_reteste_37_copy,
ige_reteste_38_copy,
ige_reteste_39_copy,
ige_reteste_4_copy,
ige_reteste_40_copy,
ige_reteste_41_copy,
ige_reteste_43_copy,
ige_reteste_44_copy,
ige_reteste_45_copy,
ige_reteste_46_copy,
ige_reteste_47_copy,
ige_reteste_48_copy,
ige_reteste_5_copy,
ige_reteste_50_copy,
ige_reteste_51_copy,
ige_reteste_52_copy,
ige_reteste_53_copy,
ige_reteste_54_copy,
ige_reteste_55_copy,
ige_reteste_8_copy,
ige_reteste_9_copy), list(~7-.)) #reverse
minor check
cor(dados$ige_reteste_8, dados$ige_reteste_8_copy, use="complete.obs")
[1] -1
dados <- dados %>%
#HOSTILIDADE
mutate(ige_hostilidade_t2 = rowSums(select(., ige_reteste_34_copy,
ige_reteste_11_copy,
ige_reteste_36_copy,
ige_reteste_22_copy,
ige_reteste_53_copy,
ige_reteste_33_copy,
ige_reteste_48_copy,
ige_reteste_43_copy,
ige_reteste_1_copy,
ige_reteste_47_copy,
ige_reteste_30_copy,
ige_reteste_13_copy), na.rm=F)) %>% #same thing. Don't use missings
#impulsividade
mutate(ige_impulsividade_t2 = rowSums(select(., ige_reteste_29_copy,
ige_reteste_8_copy,
ige_reteste_5_copy,
ige_reteste_27_copy,
ige_reteste_50_copy,
ige_reteste_15_copy,
ige_reteste_10_copy,
ige_reteste_16_copy,
ige_reteste_23_copy,
ige_reteste_9_copy,
ige_reteste_25_copy), na.rm=F)) %>% #same thing. Don't use missings
#intolerancia
mutate(ige_intolerancia_t2 = rowSums(select(.,
ige_reteste_54_copy,
ige_reteste_39_copy,
ige_reteste_44_copy,
ige_reteste_38_copy,
ige_reteste_55_copy,
ige_reteste_37_copy,
ige_reteste_45_copy,
ige_reteste_51_copy,
ige_reteste_4_copy,
ige_reteste_41_copy), na.rm=F)) %>% #same thing. Don't use missings
#emocoes engativas
mutate(ige_emocoesnegativas_t2 = rowSums(select(.,
ige_reteste_46_copy,
ige_reteste_52_copy,
ige_reteste_24_copy,
ige_reteste_31_copy,
ige_reteste_40_copy,
ige_reteste_26_copy,
ige_reteste_19_copy,
ige_reteste_18_copy,
ige_reteste_17_copy), na.rm=F)) %>% #don't use missings
#resiliencia (doest not rever)
mutate(ige_resilienciaemocio_t2 = rowSums(select(.,
ige_reteste_12, #doesn't reverse
ige_reteste_32, #doesn't reverse
ige_reteste_3, #doesn't reverse
ige_reteste_20, #doesn't reverse
ige_reteste_6, #doesn't reverse
ige_reteste_57, #doesn't reverse
ige_reteste_2), na.rm=F)) %>% #don't use missings
#ige total
mutate(ige_total_t2 = rowSums(select(.,
ige_hostilidade_t2,
ige_impulsividade_t2,
ige_intolerancia_t2,
ige_emocoesnegativas_t2,
ige_resilienciaemocio_t2), na.rm=F)) #dont use missings
Minor check
dados$ige_resilienciaemocio_t2
[1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[43] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[85] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[127] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[169] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[211] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[253] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 25 36 24 26 42 12 31 33 20 25 21 12 17 22 26 27
[295] 26 18 10 35 15 22 28 32 15 16 29 26 24 30 31 15 17 33 25 34 25 32 28 22 22 23 22 31 NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[337] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[379] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[421] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[463] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[505] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[547] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[589] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[631] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[673] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[715] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[757] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
dados$ige_emocoesnegativas_t2
[1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[43] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[85] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[127] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[169] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[211] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[253] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 42 44 39 23 9 44 37 23 44 41 52 54 45 31 38 46
[295] 39 51 45 43 48 32 45 29 50 44 34 38 54 40 35 27 37 29 37 27 38 47 48 36 39 34 51 29 NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[337] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[379] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[421] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[463] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[505] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[547] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[589] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[631] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[673] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[715] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[757] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
dados$ige_total_t2
[1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[33] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[65] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[97] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[129] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[161] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[193] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[225] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[257] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 208 246 207 177 84 239 206 184 225 231
[289] 257 219 235 164 225 201 223 233 212 178 227 198 243 212 250 215 184 208 255 233 194 156 205 174 204 212 216 267 219 208 218 177
[321] 241 166 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[353] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[385] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[417] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[449] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[481] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[513] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[545] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[577] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[609] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[641] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[673] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[705] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[737] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[769] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
dados %>%
select(contains("ige")) %>%
DataExplorer::profile_missing() %>%
arrange(desc(pct_missing))
Sexo, grupo, escolaridade(1), estado
dados <- dados %>%
mutate(sexo_fct = as.factor(sexo) %>% fct_recode("Masc"="1","Fem"="2"),
grupo_fct = as.factor(grupo),
escolaridade_fct = as.factor(escolaridade),
estado_fct = tolower(stringi::stri_trans_general(estado_nasc,"Latin-ASCII")))
dados %>% count(sexo_fct)
escolaridade agregada
dados <- dados %>%
mutate(nivel_escolaridade = factor(case_when(
escolaridade_fct == 3 ~ "Fundamental",
escolaridade_fct == 4 ~ "Fundamental",
escolaridade_fct == 5 ~ "Fundamental",
escolaridade_fct == 6 ~ "Médio",
escolaridade_fct == 7 ~ "Médio",
escolaridade_fct == 8 ~ "Médio",
escolaridade_fct == 10 ~ "Superior",
escolaridade_fct == 11 ~ "Superior",
escolaridade_fct == 12 ~ "Superior",
TRUE ~ NA_character_)))
Check
dados %>% count(nivel_escolaridade)
write.csv(dados, file = "DADOS teste IGE final compartilhado - LUIS.csv", row.names = F)
!done!
dados %>%
select(sexo_fct, idade, nivel_escolaridade, estado_fct) %>%
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 |
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'
library(lavaan)
This is lavaan 0.6-6
lavaan is BETA software! Please report any bugs.
cfa_1 <- cfa(model = mod_cfa,
data = ds_psych,
estimator = 'WLSMV',
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-6 ended normally after 116 iterations
Estimator DWLS
Optimization method NLMINB
Number of free parameters 353
Number of observations 783
Model Test User Model:
Standard Robust
Test Statistic 4345.933 3452.435
Degrees of freedom 1117 1117
P-value (Chi-square) 0.000 0.000
Scaling correction factor 1.528
Shift parameter 608.684
simple second-order correction
Model Test Baseline Model:
Test statistic 107552.254 31280.824
Degrees of freedom 1176 1176
P-value 0.000 0.000
Scaling correction factor 3.534
User Model versus Baseline Model:
Comparative Fit Index (CFI) 0.970 0.922
Tucker-Lewis Index (TLI) 0.968 0.918
Robust Comparative Fit Index (CFI) NA
Robust Tucker-Lewis Index (TLI) NA
Root Mean Square Error of Approximation:
RMSEA 0.061 0.052
90 Percent confidence interval - lower 0.059 0.050
90 Percent confidence interval - upper 0.063 0.054
P-value RMSEA <= 0.05 0.000 0.075
Robust RMSEA NA
90 Percent confidence interval - lower NA
90 Percent confidence interval - upper NA
Standardized Root Mean Square Residual:
SRMR 0.061 0.061
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.574 0.574
ige_11 1.263 0.059 21.231 0.000 0.724 0.724
ige_13 0.967 0.055 17.430 0.000 0.555 0.555
ige_22 1.185 0.058 20.445 0.000 0.680 0.680
ige_30 0.996 0.056 17.850 0.000 0.571 0.571
ige_33 1.164 0.057 20.357 0.000 0.668 0.668
ige_34 1.311 0.061 21.311 0.000 0.752 0.752
ige_36 1.243 0.065 19.232 0.000 0.713 0.713
ige_43 1.083 0.064 16.975 0.000 0.621 0.621
ige_47 1.001 0.053 18.896 0.000 0.574 0.574
ige_48 1.089 0.050 21.616 0.000 0.625 0.625
ige_53 1.170 0.057 20.647 0.000 0.671 0.671
f2 =~
ige_5 1.000 0.699 0.699
ige_8 1.024 0.040 25.615 0.000 0.715 0.715
ige_9 0.466 0.048 9.729 0.000 0.325 0.325
ige_10 0.753 0.046 16.509 0.000 0.526 0.526
ige_15 0.767 0.047 16.209 0.000 0.536 0.536
ige_16 0.722 0.048 14.981 0.000 0.504 0.504
ige_23 0.640 0.048 13.308 0.000 0.447 0.447
ige_25 0.410 0.052 7.913 0.000 0.287 0.287
ige_27 0.983 0.039 25.121 0.000 0.687 0.687
ige_29 1.162 0.044 26.496 0.000 0.812 0.812
ige_50 0.800 0.044 18.268 0.000 0.559 0.559
f3 =~
ige_4 1.000 0.506 0.506
ige_37 1.310 0.080 16.423 0.000 0.663 0.663
ige_38 1.349 0.079 17.050 0.000 0.682 0.682
ige_39 1.493 0.088 16.944 0.000 0.756 0.756
ige_41 0.259 0.069 3.744 0.000 0.131 0.131
ige_44 1.489 0.085 17.593 0.000 0.753 0.753
ige_45 1.181 0.070 16.820 0.000 0.597 0.597
ige_51 1.160 0.073 15.811 0.000 0.587 0.587
ige_54 1.546 0.089 17.301 0.000 0.782 0.782
ige_55 1.348 0.078 17.308 0.000 0.682 0.682
f4 =~
ige_17 1.000 0.554 0.554
ige_18 1.036 0.065 15.924 0.000 0.574 0.574
ige_19 1.052 0.071 14.909 0.000 0.583 0.583
ige_24 1.337 0.071 18.869 0.000 0.741 0.741
ige_26 1.057 0.066 16.059 0.000 0.586 0.586
ige_31 1.187 0.068 17.356 0.000 0.658 0.658
ige_40 1.122 0.068 16.379 0.000 0.622 0.622
ige_46 1.383 0.075 18.389 0.000 0.766 0.766
ige_52 1.370 0.071 19.333 0.000 0.759 0.759
f5 =~
ige_2 1.000 0.287 0.287
ige_3 1.711 0.293 5.833 0.000 0.491 0.491
ige_6 1.401 0.221 6.338 0.000 0.402 0.402
ige_12 2.183 0.365 5.976 0.000 0.627 0.627
ige_20 1.653 0.278 5.945 0.000 0.474 0.474
ige_32 2.121 0.362 5.867 0.000 0.609 0.609
ige_57 1.046 0.203 5.146 0.000 0.300 0.300
Covariances:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
f1 ~~
f2 0.335 0.020 16.674 0.000 0.837 0.837
f3 0.233 0.018 12.908 0.000 0.802 0.802
f4 0.254 0.017 14.631 0.000 0.798 0.798
f5 0.007 0.008 0.841 0.401 0.041 0.041
f2 ~~
f3 0.278 0.019 14.350 0.000 0.786 0.786
f4 0.259 0.018 14.438 0.000 0.669 0.669
f5 0.009 0.009 1.067 0.286 0.046 0.046
f3 ~~
f4 0.229 0.018 12.382 0.000 0.817 0.817
f5 0.013 0.007 1.917 0.055 0.086 0.086
f4 ~~
f5 0.025 0.007 3.363 0.001 0.157 0.157
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 -2.045 0.103 -19.929 0.000 -2.045 -2.045
ige_1|t2 -0.238 0.045 -5.245 0.000 -0.238 -0.238
ige_1|t3 0.234 0.045 5.174 0.000 0.234 0.234
ige_1|t4 0.588 0.048 12.306 0.000 0.588 0.588
ige_1|t5 1.023 0.054 18.774 0.000 1.023 1.023
ige_1|t6 1.503 0.069 21.763 0.000 1.503 1.503
ige_11|t1 -1.465 0.068 -21.695 0.000 -1.465 -1.465
ige_11|t2 0.584 0.048 12.236 0.000 0.584 0.584
ige_11|t3 1.207 0.059 20.475 0.000 1.207 1.207
ige_11|t4 1.544 0.071 21.803 0.000 1.544 1.544
ige_11|t5 1.685 0.078 21.699 0.000 1.685 1.685
ige_11|t6 1.910 0.092 20.822 0.000 1.910 1.910
ige_13|t1 -1.755 0.082 -21.514 0.000 -1.755 -1.755
ige_13|t2 0.341 0.046 7.450 0.000 0.341 0.341
ige_13|t3 0.920 0.052 17.543 0.000 0.920 0.920
ige_13|t4 1.241 0.060 20.712 0.000 1.241 1.241
ige_13|t5 1.565 0.072 21.812 0.000 1.565 1.565
ige_13|t6 1.836 0.087 21.200 0.000 1.836 1.836
ige_22|t1 -1.622 0.074 -21.791 0.000 -1.622 -1.622
ige_22|t2 -0.034 0.045 -0.750 0.453 -0.034 -0.034
ige_22|t3 0.341 0.046 7.450 0.000 0.341 0.341
ige_22|t4 0.588 0.048 12.306 0.000 0.588 0.588
ige_22|t5 0.891 0.052 17.160 0.000 0.891 0.891
ige_22|t6 1.168 0.058 20.173 0.000 1.168 1.168
ige_30|t1 -1.544 0.071 -21.803 0.000 -1.544 -1.544
ige_30|t2 0.531 0.047 11.259 0.000 0.531 0.531
ige_30|t3 0.985 0.054 18.352 0.000 0.985 0.985
ige_30|t4 1.284 0.061 20.978 0.000 1.284 1.284
ige_30|t5 1.611 0.074 21.801 0.000 1.611 1.611
ige_30|t6 1.741 0.081 21.560 0.000 1.741 1.741
ige_33|t1 -1.741 0.081 -21.560 0.000 -1.741 -1.741
ige_33|t2 0.244 0.045 5.388 0.000 0.244 0.244
ige_33|t3 0.863 0.051 16.773 0.000 0.863 0.863
ige_33|t4 1.291 0.061 21.020 0.000 1.291 1.291
ige_33|t5 1.699 0.078 21.671 0.000 1.699 1.699
ige_33|t6 2.130 0.111 19.256 0.000 2.130 2.130
ige_34|t1 -1.455 0.067 -21.674 0.000 -1.455 -1.455
ige_34|t2 0.542 0.047 11.469 0.000 0.542 0.542
ige_34|t3 1.017 0.054 18.715 0.000 1.017 1.017
ige_34|t4 1.214 0.059 20.523 0.000 1.214 1.214
ige_34|t5 1.474 0.068 21.714 0.000 1.474 1.474
ige_34|t6 1.771 0.082 21.462 0.000 1.771 1.771
ige_36|t1 -1.533 0.070 -21.796 0.000 -1.533 -1.533
ige_36|t2 0.891 0.052 17.160 0.000 0.891 0.891
ige_36|t3 1.465 0.068 21.695 0.000 1.465 1.465
ige_36|t4 1.836 0.087 21.200 0.000 1.836 1.836
ige_36|t5 1.996 0.098 20.282 0.000 1.996 1.996
ige_36|t6 2.130 0.111 19.256 0.000 2.130 2.130
ige_43|t1 -1.565 0.072 -21.812 0.000 -1.565 -1.565
ige_43|t2 0.970 0.053 18.168 0.000 0.970 0.970
ige_43|t3 1.446 0.067 21.652 0.000 1.446 1.446
ige_43|t4 1.712 0.079 21.638 0.000 1.712 1.712
ige_43|t5 1.973 0.097 20.435 0.000 1.973 1.973
ige_43|t6 2.130 0.111 19.256 0.000 2.130 2.130
ige_47|t1 -1.996 0.098 -20.282 0.000 -1.996 -1.996
ige_47|t2 0.159 0.045 3.534 0.000 0.159 0.159
ige_47|t3 0.722 0.049 14.643 0.000 0.722 0.722
ige_47|t4 1.168 0.058 20.173 0.000 1.168 1.168
ige_47|t5 1.565 0.072 21.812 0.000 1.565 1.565
ige_47|t6 1.890 0.090 20.929 0.000 1.890 1.890
ige_48|t1 -1.951 0.095 -20.576 0.000 -1.951 -1.951
ige_48|t2 -0.002 0.045 -0.036 0.972 -0.002 -0.002
ige_48|t3 0.588 0.048 12.306 0.000 0.588 0.588
ige_48|t4 0.965 0.053 18.106 0.000 0.965 0.965
ige_48|t5 1.337 0.063 21.256 0.000 1.337 1.337
ige_48|t6 1.802 0.084 21.344 0.000 1.802 1.802
ige_53|t1 -1.647 0.076 -21.764 0.000 -1.647 -1.647
ige_53|t2 0.557 0.047 11.749 0.000 0.557 0.557
ige_53|t3 1.023 0.054 18.774 0.000 1.023 1.023
ige_53|t4 1.474 0.068 21.714 0.000 1.474 1.474
ige_53|t5 1.786 0.083 21.406 0.000 1.786 1.786
ige_53|t6 2.130 0.111 19.256 0.000 2.130 2.130
ige_5|t1 -2.045 0.103 -19.929 0.000 -2.045 -2.045
ige_5|t2 -0.588 0.048 -12.306 0.000 -0.588 -0.588
ige_5|t3 0.008 0.045 0.179 0.858 0.008 0.008
ige_5|t4 0.466 0.047 9.996 0.000 0.466 0.466
ige_5|t5 0.867 0.052 16.837 0.000 0.867 0.867
ige_5|t6 1.313 0.062 21.141 0.000 1.313 1.313
ige_8|t1 -1.951 0.095 -20.576 0.000 -1.951 -1.951
ige_8|t2 -0.088 0.045 -1.964 0.050 -0.088 -0.088
ige_8|t3 0.455 0.047 9.784 0.000 0.455 0.455
ige_8|t4 0.945 0.053 17.857 0.000 0.945 0.945
ige_8|t5 1.313 0.062 21.141 0.000 1.313 1.313
ige_8|t6 1.634 0.075 21.779 0.000 1.634 1.634
ige_9|t1 -2.233 0.122 -18.333 0.000 -2.233 -2.233
ige_9|t2 -0.795 0.050 -15.786 0.000 -0.795 -0.795
ige_9|t3 -0.358 0.046 -7.804 0.000 -0.358 -0.358
ige_9|t4 0.066 0.045 1.464 0.143 0.066 0.066
ige_9|t5 0.557 0.047 11.749 0.000 0.557 0.557
ige_9|t6 1.023 0.054 18.774 0.000 1.023 1.023
ige_9|t7 3.017 0.303 9.952 0.000 3.017 3.017
ige_10|t1 -2.667 0.194 -13.758 0.000 -2.667 -2.667
ige_10|t2 -0.710 0.049 -14.439 0.000 -0.710 -0.710
ige_10|t3 -0.271 0.045 -5.957 0.000 -0.271 -0.271
ige_10|t4 0.062 0.045 1.393 0.164 0.062 0.062
ige_10|t5 0.484 0.047 10.347 0.000 0.484 0.484
ige_10|t6 0.925 0.053 17.606 0.000 0.925 0.925
ige_15|t1 -2.425 0.148 -16.410 0.000 -2.425 -2.425
ige_15|t2 -0.661 0.049 -13.619 0.000 -0.661 -0.661
ige_15|t3 -0.198 0.045 -4.390 0.000 -0.198 -0.198
ige_15|t4 0.241 0.045 5.317 0.000 0.241 0.241
ige_15|t5 0.727 0.049 14.711 0.000 0.727 0.727
ige_15|t6 1.194 0.059 20.376 0.000 1.194 1.194
ige_16|t1 -1.853 0.088 -21.118 0.000 -1.853 -1.853
ige_16|t2 -0.172 0.045 -3.820 0.000 -0.172 -0.172
ige_16|t3 0.382 0.046 8.300 0.000 0.382 0.382
ige_16|t4 0.773 0.050 15.452 0.000 0.773 0.773
ige_16|t5 1.156 0.058 20.069 0.000 1.156 1.156
ige_16|t6 1.465 0.068 21.695 0.000 1.465 1.465
ige_23|t1 -3.017 0.303 -9.952 0.000 -3.017 -3.017
ige_23|t2 -0.448 0.046 -9.643 0.000 -0.448 -0.448
ige_23|t3 0.069 0.045 1.536 0.125 0.069 0.069
ige_23|t4 0.557 0.047 11.749 0.000 0.557 0.557
ige_23|t5 1.131 0.057 19.856 0.000 1.131 1.131
ige_23|t6 1.699 0.078 21.671 0.000 1.699 1.699
ige_25|t1 -3.017 0.303 -9.952 0.000 -3.017 -3.017
ige_25|t2 -1.306 0.062 -21.101 0.000 -1.306 -1.306
ige_25|t3 -0.731 0.049 -14.779 0.000 -0.731 -0.731
ige_25|t4 -0.261 0.045 -5.744 0.000 -0.261 -0.261
ige_25|t5 0.231 0.045 5.103 0.000 0.231 0.231
ige_25|t6 0.702 0.049 14.303 0.000 0.702 0.702
ige_27|t1 -2.233 0.122 -18.333 0.000 -2.233 -2.233
ige_27|t2 -0.470 0.047 -10.066 0.000 -0.470 -0.470
ige_27|t3 0.153 0.045 3.392 0.001 0.153 0.153
ige_27|t4 0.588 0.048 12.306 0.000 0.588 0.588
ige_27|t5 1.012 0.054 18.655 0.000 1.012 1.012
ige_27|t6 1.402 0.065 21.521 0.000 1.402 1.402
ige_29|t1 -1.741 0.081 -21.560 0.000 -1.741 -1.741
ige_29|t2 0.185 0.045 4.105 0.000 0.185 0.185
ige_29|t3 0.773 0.050 15.452 0.000 0.773 0.773
ige_29|t4 1.119 0.057 19.748 0.000 1.119 1.119
ige_29|t5 1.599 0.073 21.807 0.000 1.599 1.599
ige_29|t6 1.871 0.089 21.028 0.000 1.871 1.871
ige_50|t1 -1.973 0.097 -20.435 0.000 -1.973 -1.973
ige_50|t2 -0.069 0.045 -1.536 0.125 -0.069 -0.069
ige_50|t3 0.455 0.047 9.784 0.000 0.455 0.455
ige_50|t4 0.955 0.053 17.982 0.000 0.955 0.955
ige_50|t5 1.352 0.063 21.328 0.000 1.352 1.352
ige_50|t6 1.771 0.082 21.462 0.000 1.771 1.771
ige_4|t1 -2.233 0.122 -18.333 0.000 -2.233 -2.233
ige_4|t2 -0.752 0.050 -15.116 0.000 -0.752 -0.752
ige_4|t3 -0.088 0.045 -1.964 0.050 -0.088 -0.088
[ reached getOption("max.print") -- omitted 152 rows ]
Variances:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.ige_1 0.671 0.671 0.671
.ige_11 0.475 0.475 0.475
.ige_13 0.692 0.692 0.692
.ige_22 0.538 0.538 0.538
.ige_30 0.674 0.674 0.674
.ige_33 0.554 0.554 0.554
.ige_34 0.435 0.435 0.435
.ige_36 0.492 0.492 0.492
.ige_43 0.614 0.614 0.614
.ige_47 0.670 0.670 0.670
.ige_48 0.610 0.610 0.610
.ige_53 0.550 0.550 0.550
.ige_5 0.512 0.512 0.512
.ige_8 0.488 0.488 0.488
.ige_9 0.894 0.894 0.894
.ige_10 0.723 0.723 0.723
.ige_15 0.713 0.713 0.713
.ige_16 0.746 0.746 0.746
.ige_23 0.800 0.800 0.800
.ige_25 0.918 0.918 0.918
.ige_27 0.528 0.528 0.528
.ige_29 0.340 0.340 0.340
.ige_50 0.687 0.687 0.687
.ige_4 0.744 0.744 0.744
.ige_37 0.561 0.561 0.561
.ige_38 0.534 0.534 0.534
.ige_39 0.429 0.429 0.429
.ige_41 0.983 0.983 0.983
.ige_44 0.432 0.432 0.432
.ige_45 0.643 0.643 0.643
.ige_51 0.655 0.655 0.655
.ige_54 0.389 0.389 0.389
.ige_55 0.535 0.535 0.535
.ige_17 0.693 0.693 0.693
.ige_18 0.671 0.671 0.671
.ige_19 0.660 0.660 0.660
.ige_24 0.451 0.451 0.451
.ige_26 0.657 0.657 0.657
.ige_31 0.567 0.567 0.567
.ige_40 0.614 0.614 0.614
.ige_46 0.413 0.413 0.413
.ige_52 0.424 0.424 0.424
.ige_2 0.918 0.918 0.918
.ige_3 0.759 0.759 0.759
.ige_6 0.838 0.838 0.838
.ige_12 0.607 0.607 0.607
.ige_20 0.775 0.775 0.775
.ige_32 0.629 0.629 0.629
.ige_57 0.910 0.910 0.910
f1 0.329 0.027 12.179 0.000 1.000 1.000
f2 0.488 0.030 16.135 0.000 1.000 1.000
f3 0.256 0.027 9.367 0.000 1.000 1.000
f4 0.307 0.029 10.430 0.000 1.000 1.000
f5 0.082 0.025 3.335 0.001 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(psych)
Attaching package: 㤼㸱psych㤼㸲
The following object is masked from 㤼㸱package:lavaan㤼㸲:
cor2cov
The following objects are masked from 㤼㸱package:ggplot2㤼㸲:
%+%, alpha
psych::alpha(ds_psych)
Some items were negatively correlated with the total scale and probably
should be reversed.
To do this, run the function again with the 'check.keys=TRUE' option
Some items ( ige_3 ige_6 ige_57 ) were negatively correlated with the total scale and
probably should be reversed.
To do this, run the function again with the 'check.keys=TRUE' option
Reliability analysis
Call: psych::alpha(x = ds_psych)
lower alpha upper 95% confidence boundaries
0.9 0.91 0.92
Reliability if an item is dropped:
Item statistics
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.95
Guttman lambda 6 = 0.94
Average split half reliability = 0.92
Guttman lambda 3 (alpha) = 0.92
Guttman lambda 2 = 0.93
Minimum split half reliability (beta) = 0.83
Average interitem r = 0.19 with median = 0.21
library(semTools)
###############################################################################
This is semTools 0.5-3
All users of R (or SEM) are invited to submit functions or ideas for functions.
###############################################################################
Attaching package: 㤼㸱semTools㤼㸲
The following object is masked from 㤼㸱package:psych㤼㸲:
skew
The following object is masked from 㤼㸱package:readr㤼㸲:
clipboard
reliability(cfa_1)
For constructs with categorical indicators, the alpha and the average variance extracted are calculated from polychoric (polyserial) correlations, not from Pearson correlations.
f1 f2 f3 f4 f5
alpha 0.8897436 0.8153396 0.8491360 0.8581426 0.6449447
omega 0.6212081 0.7316337 0.6061965 0.8410086 0.3781626
omega2 0.6212081 0.7316337 0.6061965 0.8410086 0.3781626
omega3 0.6314895 0.7615396 0.6131150 0.8637700 0.3696241
avevar 0.4187966 0.3318097 0.4094733 0.4278612 0.2233822
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 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))
New names:
* p -> p...4
* p -> p...6
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_hostilidade,ige_impulsividade,ige_intolerancia,ige_emocoesnegativas,ige_resilienciaemocio,ige_total,
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 usedthe condition has length > 1 and only the first element will be used
correlations2
minor checks
cor.test(dados$ige_total, dados$ige_total_t2, method = "spearman", use="complete.obs")
Cannot compute exact p-value with ties
Spearman's rank correlation rho
data: dados$ige_total and dados$ige_total_t2
S = 5687.8, p-value = 1.73e-05
alternative hypothesis: true rho is not equal to 0
sample estimates:
rho
0.5991677
Now I’ll get the ICC for these same factors
purrr::map2(dados %>% select(ige_hostilidade,ige_impulsividade,ige_intolerancia,ige_emocoesnegativas,ige_resilienciaemocio,ige_total), 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
Model failed to converge with max|grad| = 0.00456218 (tol = 0.002, component 1)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, dados$ige_total_t2))
Call: ICC(x = cbind(dados$ige_total, dados$ige_total_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_hostilidade,ige_impulsividade,ige_intolerancia,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.11889, df = 43, p-value = 0.9059
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-11.83901 10.52083
sample estimates:
mean of the differences
-0.6590909
tabela_correlacao <- function(...) {
#r
x<-dados %>%
select(ige_hostilidade,ige_impulsividade,ige_intolerancia,ige_emocoesnegativas,ige_resilienciaemocio,ige_total,...) %>%
{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_hostilidade,ige_impulsividade,ige_intolerancia,ige_emocoesnegativas,ige_resilienciaemocio,ige_total,...) %>%
{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(ifp_assisten, ifp_intracep, ifp_afago, ifp_deferen, ifp_afilia, ifp_dominan, ifp_deneg, ifp_desempen, ifp_exibi,ifp_agressao, ifp_ordem, ifp_persist, ifp_mudanca, ifp_autonom, ifp_heterossex)
minor check
cor.test(dados$ige_hostilidade,dados$ifp_heterossex, method = "spearman")
Cannot compute exact p-value with ties
Spearman's rank correlation rho
data: dados$ige_hostilidade and dados$ifp_heterossex
S = 165089, p-value = 0.002387
alternative hypothesis: true rho is not equal to 0
sample estimates:
rho
-0.3146133
tabela_correlacao(staxi_estado_raiva, staxi_traco_raiva, staxi_temperamento, staxi_reacao, staxi_raiva_dentro, staxi_raiva_fora, staxi_controle, staxi_expressao)
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(bfp_abertura, bfp_extroversao, bfp_neuroticismo, bfp_realizacao, bfp_socializacao)
tabela_correlacao(ihsa_dificult_total)
mod_sexo_idade_escolaridade <- lm(ige_total ~ sexo_fct + idade + nivel_escolaridade, dados)
apaTables::apa.aov.table(mod_sexo_idade_escolaridade)
ANOVA results using ige_total 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.305 RMSE 32.086
R-Squared 0.093 Coef. Var 14.450
Adj. R-Squared 0.088 MSE 1029.521
Pred R-Squared 0.081 MAE 25.336
----------------------------------------------------------------
RMSE: Root Mean Square Error
MSE: Mean Square Error
MAE: Mean Absolute Error
ANOVA
-----------------------------------------------------------------------
Sum of
Squares DF Mean Square F Sig.
-----------------------------------------------------------------------
Regression 80732.054 4 20183.014 19.604 0.0000
Residual 786554.261 764 1029.521
Total 867286.315 768
-----------------------------------------------------------------------
Parameter Estimates
----------------------------------------------------------------------------------------------------------
model Beta Std. Error Std. Beta t Sig lower upper
----------------------------------------------------------------------------------------------------------
(Intercept) 228.028 3.580 63.689 0.000 221.000 235.057
sexo_fctFem -10.421 2.470 -0.152 -4.219 0.000 -15.271 -5.572
idade 0.308 0.102 0.106 3.018 0.003 0.108 0.509
nivel_escolaridadeMédio -17.540 2.927 -0.261 -5.993 0.000 -23.285 -11.795
nivel_escolaridadeSuperior -2.645 3.416 -0.035 -0.774 0.439 -9.351 4.060
----------------------------------------------------------------------------------------------------------
library(emmeans)
emmeans(mod_sexo_idade_escolaridade, pairwise ~ sexo_fct)
$emmeans
sexo_fct emmean SE df lower.CL upper.CL
Masc 229 1.60 764 226 232
Fem 219 1.89 764 215 222
Results are averaged over the levels of: nivel_escolaridade
Confidence level used: 0.95
$contrasts
contrast estimate SE df t.ratio p.value
Masc - Fem 10.4 2.47 764 4.219 <.0001
Results are averaged over the levels of: nivel_escolaridade
emmeans(mod_sexo_idade_escolaridade, pairwise ~ nivel_escolaridade)
$emmeans
nivel_escolaridade emmean SE df lower.CL upper.CL
Fundamental 230 2.47 764 226 235
Médio 213 1.71 764 210 216
Superior 228 2.27 764 223 232
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 17.54 2.93 764 5.993 <.0001
Fundamental - Superior 2.65 3.42 764 0.774 0.7189
Médio - Superior -14.89 2.92 764 -5.100 <.0001
Results are averaged over the levels of: sexo_fct
P value adjustment: tukey method for comparing a family of 3 estimates
ggplot(dados, aes(x = idade, y = ige_total)) +
geom_jitter() +
geom_smooth(method = "lm") +
labs(x = "Idade", y = "IGE total") +
theme_bw()
tableby(list(sexo_fct, nivel_escolaridade) ~ ige_total, dados) %>% summary
| Masc (N=467) | Fem (N=320) | Total (N=787) | p value | |
|---|---|---|---|---|
| ige_total | < 0.001 | |||
| N-Miss | 4 | 0 | 4 | |
| Mean (SD) | 225.626 (33.079) | 217.209 (33.444) | 222.186 (33.464) | |
| Range | 117.000 - 311.000 | 89.000 - 277.000 | 89.000 - 311.000 |
| Fundamental (N=183) | Médio (N=382) | Superior (N=210) | Total (N=775) | p value | |
|---|---|---|---|---|---|
| ige_total | < 0.001 | ||||
| N-Miss | 4 | 0 | 0 | 4 | |
| Mean (SD) | 232.944 (34.754) | 213.995 (33.237) | 227.519 (29.302) | 222.078 (33.568) | |
| Range | 89.000 - 311.000 | 117.000 - 277.000 | 142.000 - 283.000 | 89.000 - 311.000 |
NA
gridExtra::grid.arrange(
gridExtra::arrangeGrob(
ggplot(dados, aes(x= sexo_fct, y = total_ige)) +
geom_boxplot() +
geom_jitter(alpha=.3, aes(color = sexo_fct)) +
labs(x= "Sexo", y = "") +
theme_bw() +
theme(legend.position = "hide"),
dados %>% filter(!is.na(nivel_escolaridade)) %>% ggplot(., aes(x= nivel_escolaridade, y = total_ige)) +
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))
Error in FUN(X[[i]], ...) : object 'total_ige' not found
olsrr::ols_regress(mod_sexo_idade_escolaridade_hostilidade)
Model Summary
--------------------------------------------------------------
R 0.245 RMSE 9.205
R-Squared 0.060 Coef. Var 14.596
Adj. R-Squared 0.055 MSE 84.738
Pred R-Squared 0.046 MAE 6.849
--------------------------------------------------------------
RMSE: Root Mean Square Error
MSE: Mean Square Error
MAE: Mean Absolute Error
ANOVA
----------------------------------------------------------------------
Sum of
Squares DF Mean Square F Sig.
----------------------------------------------------------------------
Regression 4144.561 4 1036.140 12.228 0.0000
Residual 64824.791 765 84.738
Total 68969.352 769
----------------------------------------------------------------------
Parameter Estimates
-------------------------------------------------------------------------------------------------------
model Beta Std. Error Std. Beta t Sig lower upper
-------------------------------------------------------------------------------------------------------
(Intercept) 65.715 1.024 64.166 0.000 63.704 67.725
sexo_fctFem -0.886 0.709 -0.046 -1.251 0.211 -2.277 0.505
idade 0.041 0.029 0.050 1.385 0.167 -0.017 0.098
nivel_escolaridadeMédio -5.322 0.838 -0.281 -6.351 0.000 -6.967 -3.677
nivel_escolaridadeSuperior -2.419 0.979 -0.114 -2.471 0.014 -4.341 -0.497
-------------------------------------------------------------------------------------------------------
olsrr::ols_regress(mod_sexo_idade_escolaridade_impulsividade)
Model Summary
--------------------------------------------------------------
R 0.249 RMSE 9.772
R-Squared 0.062 Coef. Var 20.875
Adj. R-Squared 0.057 MSE 95.483
Pred R-Squared 0.049 MAE 7.769
--------------------------------------------------------------
RMSE: Root Mean Square Error
MSE: Mean Square Error
MAE: Mean Absolute Error
ANOVA
----------------------------------------------------------------------
Sum of
Squares DF Mean Square F Sig.
----------------------------------------------------------------------
Regression 4838.149 4 1209.537 12.668 0.0000
Residual 72948.751 764 95.483
Total 77786.900 768
----------------------------------------------------------------------
Parameter Estimates
-------------------------------------------------------------------------------------------------------
model Beta Std. Error Std. Beta t Sig lower upper
-------------------------------------------------------------------------------------------------------
(Intercept) 48.213 1.090 44.218 0.000 46.073 50.354
sexo_fctFem -0.164 0.752 -0.008 -0.218 0.828 -1.641 1.313
idade 0.053 0.031 0.061 1.701 0.089 -0.008 0.114
nivel_escolaridadeMédio -5.000 0.891 -0.249 -5.610 0.000 -6.749 -3.250
nivel_escolaridadeSuperior -0.636 1.040 -0.028 -0.612 0.541 -2.678 1.406
-------------------------------------------------------------------------------------------------------
olsrr::ols_regress(mod_sexo_idade_escolaridade_intolerancia)
Model Summary
--------------------------------------------------------------
R 0.301 RMSE 9.460
R-Squared 0.091 Coef. Var 21.859
Adj. R-Squared 0.086 MSE 89.498
Pred R-Squared 0.079 MAE 7.565
--------------------------------------------------------------
RMSE: Root Mean Square Error
MSE: Mean Square Error
MAE: Mean Absolute Error
ANOVA
----------------------------------------------------------------------
Sum of
Squares DF Mean Square F Sig.
----------------------------------------------------------------------
Regression 6839.222 4 1709.805 19.104 0.0000
Residual 68465.746 765 89.498
Total 75304.968 769
----------------------------------------------------------------------
Parameter Estimates
-------------------------------------------------------------------------------------------------------
model Beta Std. Error Std. Beta t Sig lower upper
-------------------------------------------------------------------------------------------------------
(Intercept) 45.909 1.052 43.620 0.000 43.843 47.975
sexo_fctFem -4.085 0.728 -0.203 -5.610 0.000 -5.515 -2.656
idade 0.076 0.030 0.089 2.509 0.012 0.016 0.135
nivel_escolaridadeMédio -4.781 0.861 -0.242 -5.552 0.000 -6.472 -3.091
nivel_escolaridadeSuperior -1.783 1.006 -0.080 -1.773 0.077 -3.759 0.192
-------------------------------------------------------------------------------------------------------
olsrr::ols_regress(mod_sexo_idade_escolaridade_ige_emocoesnegativas)
Model Summary
--------------------------------------------------------------
R 0.376 RMSE 8.624
R-Squared 0.141 Coef. Var 21.225
Adj. R-Squared 0.137 MSE 74.380
Pred R-Squared 0.130 MAE 6.969
--------------------------------------------------------------
RMSE: Root Mean Square Error
MSE: Mean Square Error
MAE: Mean Absolute Error
ANOVA
----------------------------------------------------------------------
Sum of
Squares DF Mean Square F Sig.
----------------------------------------------------------------------
Regression 9351.949 4 2337.987 31.433 0.0000
Residual 56901.039 765 74.380
Total 66252.988 769
----------------------------------------------------------------------
Parameter Estimates
-------------------------------------------------------------------------------------------------------
model Beta Std. Error Std. Beta t Sig lower upper
-------------------------------------------------------------------------------------------------------
(Intercept) 43.247 0.959 45.073 0.000 41.364 45.131
sexo_fctFem -5.672 0.664 -0.300 -8.545 0.000 -6.975 -4.369
idade 0.079 0.027 0.098 2.864 0.004 0.025 0.133
nivel_escolaridadeMédio -4.381 0.785 -0.236 -5.581 0.000 -5.923 -2.840
nivel_escolaridadeSuperior -0.382 0.917 -0.018 -0.417 0.677 -2.183 1.419
-------------------------------------------------------------------------------------------------------
olsrr::ols_regress(mod_sexo_idade_escolaridade_ige_resilienciaemocio)
Model Summary
--------------------------------------------------------------
R 0.194 RMSE 6.472
R-Squared 0.038 Coef. Var 22.900
Adj. R-Squared 0.033 MSE 41.884
Pred R-Squared 0.025 MAE 5.182
--------------------------------------------------------------
RMSE: Root Mean Square Error
MSE: Mean Square Error
MAE: Mean Absolute Error
ANOVA
---------------------------------------------------------------------
Sum of
Squares DF Mean Square F Sig.
---------------------------------------------------------------------
Regression 1257.531 4 314.383 7.506 0.0000
Residual 32041.001 765 41.884
Total 33298.531 769
---------------------------------------------------------------------
Parameter Estimates
-------------------------------------------------------------------------------------------------------
model Beta Std. Error Std. Beta t Sig lower upper
-------------------------------------------------------------------------------------------------------
(Intercept) 24.895 0.720 34.577 0.000 23.482 26.309
sexo_fctFem 0.396 0.498 0.030 0.794 0.427 -0.582 1.373
idade 0.061 0.021 0.108 2.974 0.003 0.021 0.102
nivel_escolaridadeMédio 1.977 0.589 0.150 3.355 0.001 0.820 3.133
nivel_escolaridadeSuperior 2.602 0.688 0.176 3.780 0.000 1.251 3.953
-------------------------------------------------------------------------------------------------------
dados %>%
Warning messages:
1: In readChar(file, size, TRUE) : truncating string with embedded nuls
2: In readChar(file, size, TRUE) : truncating string with embedded nuls
count(profissao, sexo_fct) %>%
pivot_wider(names_from = sexo_fct, values_from = n) %>%
janitor::adorn_totals()
profissao Masc Fem
Administrador 4 NA
Advogado 1 NA
Agente Penitenciário 18 1
Agricultor 2 NA
Agropecuarista 1 NA
Analista de RH NA 1
Analista Tributario 1 NA
Aposentada NA 1
Assistente Administrativo NA 1
Assistente de Atendimento 3 NA
Atendente NA 1
Atleta 167 NA
Aux. Administrativo NA 4
Aux. de Limpeza NA 1
Aux. de serviços gerais 1 6
Auxiliar de Limpeza 1 NA
Cabeleireira NA 1
Caixa NA 1
Caldereiro (aposentado) 1 NA
Cobrador interno 1 NA
Comerciante 4 NA
Despachante 1 NA
Diarista NA 1
Diretor Administrativo 1 NA
Doméstica NA 2
Educador 1 3
Eletrecista 1 NA
Eletricista 3 NA
Empresário 4 NA
Encarregado OP. 1 NA
Estagiária NA 3
Estagiário 2 NA
Estudante 63 150
Faturista NA 1
Faxineira NA 3
func. Publico Estadual 1 NA
Func. Publico Federal 18 8
Gerente 1 1
Guarda Municipal 2 NA
Instrutor de segurança 1 NA
Instrutor de Tiro 1 NA
Instrutor de trânsito 1 NA
Jornalista NA 1
Lavador de carro 1 NA
Militar 1 NA
Militar Reformado 3 NA
Militar Reserva 12 1
Monitor de Livraria 1 NA
Monitora NA 2
Montador de moveis 1 NA
Moto Taxi 1 NA
Motociclista 1 NA
Motorista 1 NA
Musico 2 NA
Operadora de Caixa NA 1
Pastor 1 NA
Pedreiro 1 NA
Pescador 1 NA
Pintor 2 NA
Policial Federal Aposentado 2 NA
Porteiro 17 1
Professora NA 2
Psicólogo 1 NA
Representante 1 1
Secretária NA 1
Segurança 1 NA
Serralheiro 1 NA
Serviços gerais 1 8
Servidor Publico 1 NA
Servidor Publico Estadual 1 NA
Servidor Publico Federal 1 NA
Servidora Pública Federal NA 1
Supermercadista 1 NA
Supervisor 1 NA
Supervisor predial 1 NA
Técnico ADM NA 1
Técnico de Segurança do Trabalho NA 1
Técnico Eletrônica 1 NA
Técnico Eletrotécmico 1 NA
Técnico em enfermagem NA 1
Vendedor 1 NA
vendedora NA 1
Vigia 2 NA
Vigilante 6 NA
Zelador 3 NA
<NA> 87 107
Total 467 320
dados %>%
mutate(profissao2 = if_else(profissao == "Atleta","Atleta","Outros")) %>%
ggstatsplot::ggpiestats(
data = .,
x = profissao2
)
dados %>%
mutate(profissao2 = if_else(profissao == "Atleta","Atleta","Outros")) %>%
ggstatsplot::ggpiestats(
data = .,
x = sexo_fct,
y = profissao2)
dados %>%
mutate(profissao2 = if_else(profissao == "Atleta","Atleta","Outros")) %>%
group_by(profissao2) %>%
{t.test(idade ~ profissao2, data = .)}
Welch Two Sample t-test
data: idade by profissao2
t = -23.462, df = 451.06, p-value < 2.2e-16
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-14.92682 -12.61944
sample estimates:
mean in group Atleta mean in group Outros
15.38922 29.16235
ggplot(dados, aes(x = sexo_fct, y = bfp_neuroticismo)) +
geom_boxplot()