-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path05-appendix.Rmd
230 lines (153 loc) · 8.26 KB
/
05-appendix.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
---
output: html_document
editor_options:
chunk_output_type: console
---
`r if(knitr:::is_latex_output()) '\\appendix'`
`r if(!knitr:::is_latex_output()) '# (APPENDIX) Appendix {-}'`
# Appendix
The appendix is composed by 3 units, A1 appendix provides complementary tables with information regarding the items and countries used in the analysis.
Appendix A2 include detailed output for the analysis performed in this research, here can be found the individual model fit statistics LCA by country for different number of classes for both scales studied. Plots for the response categories probabilities and class size for the final selected global model are included as well with the thresholds and the class sizes for the confirmatory global model.
Finally, appendix A3 includes the syntax used in R to perform the automation of the procedures with MplusAutomation and to provide tables and plot to report results. Mplus syntax used to perform Latent Class Analysis with complex data, along with the different multigroup models to test the level of invariance and the confirmatory model for the global sample are also included in this appendix.
## Complementary tables
```{r tableA1, echo=FALSE, warning=FALSE, message=FALSE, results="asis", fig.cap="left-aligned"}
#orScalesIMM <- c("ES3G04A", "ES3G04B", "ES3G04C", "ES3G04D", "ES3G04E")
orScalesGND <- c("IS3G24A", "IS3G24B", "IS3G24E")
orScalesinvGND <- c("IS3G24C", "IS3G24D", "IS3G24F")#, "IS3G24G")
orScalesETH <- c("IS3G25A", "IS3G25B","IS3G25C","IS3G25D", "IS3G25E")
or1ScalesETH <- c("IS3G25A", "IS3G25B")
or2ScalesETH <- c("IS3G25C")
or3ScalesETH <- c("IS3G25D", "IS3G25E")
Scales <- c(orScalesGND, orScalesinvGND, orScalesETH)
labelsScales <- NULL
for(i in 1:length(Scales)){
labelsScales <- c(labelsScales, ifelse(Scales[i] %in% or1ScalesETH ,
paste0("All ethnic and racial groups ",
tolower(str_remove(attr(data_model[[Scales[i]]], "variable.label"),
"Rights and Responsibilities/Rights and responsibilities/"))),
ifelse(Scales[i] %in% or2ScalesETH ,
paste0(str_remove(attr(data_model[[Scales[i]]], "variable.label"),
"Rights and Responsibilities/Rights and responsibilities/"),
" members of all ethnic and racial groups"),
ifelse(Scales[i] %in% or3ScalesETH ,
paste0("Members of all ethnic and racial groups ",
tolower(str_remove(attr(data_model[[Scales[i]]], "variable.label"),
"Rights and Responsibilities/Rights and responsibilities/"))),
ifelse(Scales[i] %in% orScalesinvGND,
paste0(str_remove(attr(data_model[[Scales[i]]], "variable.label"),
"Rights and Responsibilities/Roles women and men/"), " (r)"),
gsub("[][<>]", "", str_remove(attr(data_model[[Scales[i]]], "variable.label"),
"Rights and Responsibilities/Roles women and men/|Moving/")))))))
}
items16 <- cbind(Scales, labelsScales) %>% data.frame()
kbl(items16,
caption = "Items for students' endorsement of equal rights and opportunities. ICCS 2016",
#label = "tableA4",
escape = FALSE,
booktabs = TRUE,
longtable = TRUE, col.names = c("Item", "Description")) %>%
column_spec(1, width = "8em") %>%
column_spec(2, width = "35em") %>%
kable_styling(bootstrap_options = c("bordered", "hover"),
latex_options = c("repeat_header", "HOLD_position"),
position = "left", font_size = 11, full_width = FALSE) %>%
#pack_rows("Equal rights for immigrants", 1, 5) %>%
pack_rows("Gender equality", 1, 6) %>%
pack_rows("Equal rights for all ethnic and racial groups", 7, 11)
```
\newpage
```{r tableA2, echo=FALSE, warning=FALSE, message=FALSE, results="asis", fig.cap="left-aligned"}
Country <- c("Belgium (Flemish)", "Bulgaria", "Chile", "Chinese Taipei", "Colombia", "Croatia", "Denmark", "Dominican Republic", " Estonia", "Finland",
"Hong Kong SAR", "Italy", "Korea, Republic of", "Latvia", "Lithuania", "Malta", "Mexico", "Netherlands", "Norway", "Peru",
"Russian Federation", "Slovenia", "Sweden")
Code <- c("BFL", "BGR", "CHL", "TWN","COL","HRV", "DNK", "DOM", "EST", "FIN", "HKG", "ITA", "KOR", "LVA", "LTU", "MLT", "MEX","NLD", "NOR", "PER", "RUS", "SVN", "SWE")
Students <- c(2931,2966,5081,3953,5609,3896,6254,3937,2857,3173,2653,3450,2601,3224,3631,3764,5526,2812,6271,5166,7289,2844,3264)
Schools <- c(162,147,178,141,150,175,184,141,164,179,91,170,93,147,182,47,213,123,148,206,352,145,155)
sample<- data.frame(Code, Country, Schools, Students)
sample %>%
kbl(caption = "Countries sample sizes that participate in ICCS 2016",
#label = "tableA1",
escape = FALSE, booktabs = TRUE, longtable = TRUE, col.names = c("AlphaCode","Country","Participating schools", "Participating students")) %>%
column_spec(1, width = "10em") %>%
row_spec(c(1,2,6,7,9,10,12,14,15,16,18,19,22,23), bold = TRUE, italic = FALSE) %>%
kable_styling(bootstrap_options = c("bordered", "hover"),
latex_options = c("repeat_header", "HOLD_position"),
position = "left", font_size = 11, full_width = FALSE) %>%
footnote(general = "Countries in bold were selected for this research")
```
\newpage
\blandscape
## Detailed output
```{r detailed1, ref.label='modelfitcnty1', echo = FALSE}
```
\elandscape
```{r detailedplot1, ref.label='higprob1', echo = FALSE, fig.cap = "Response categories probabilities and class size for 4-classes global model for Attitude towards gender equality scale", fig.width=5, fig.height=4}
```
```{r detailed2, ref.label='cfa1', echo = FALSE}
```
\blandscape
```{r detailed3, ref.label='modelfitcnty2', echo = FALSE}
```
\elandscape
```{r detailedplot2, ref.label='higprob2', echo = FALSE , fig.cap = "Response categories probabilities and class size for 4-classes global model for Attitude towards ethnic and race equal rights scale", fig.width=5, fig.height=4}
```
```{r detailed4, ref.label='cfa2', echo = FALSE}
```
## Syntax
#### R Packages[^1]
```{r ref.label='include_packages', results='hide', echo = TRUE}
```
[^1]: All codes can be found in https://github.com/PamelaInostroza/Master-s-thesis
<!-- #### MplusAutomation syntax -->
```{r results='markup', eval=FALSE}
fileName <- 'functions/Create_RunModels.R'
#89780
cat(readChar(fileName, 3318), collapse = "\n")
```
<!-- #### Automatized R code -->
```{r results='markup', eval=FALSE}
fileName <- 'functions/0.functions.R'
#23152
cat(readChar(fileName, 11468), collapse = "\n")
```
```{r results='markup', eval=FALSE}
fileName <- 'functions/code.txt'
cat(readChar(fileName, file.info(fileName)$size), collapse = "\n")
```
#### Mplus syntax
##### Latent Class model with 4 classes
\
```{r mplussyntax1, results='markup', echo = FALSE}
fileName <- 'data/MplusModels/LCA/GND_lca_C3cl4.inp'
cat(readChar(fileName, file.info(fileName)$size), collapse = "\n")
```
##### Complete homogeneous multigroup latent class model with 4 classes
\
```{r mplussyntax2, results='markup', echo = FALSE}
fileName <- 'data/MplusModels/CountryMG/GND_MGCnty_C3cl4_3CHom.inp'
cat(readChar(fileName, file.info(fileName)$size), collapse = "\n")
```
#### Partial homogeneous multigroup latent class model with 4 classes
\
```{r mplussyntax3, results='markup', echo = FALSE}
fileName <- 'functions/PartialMGmpluscode.txt'
cat(readChar(fileName, file.info(fileName)$size), collapse = "\n")
```
#### Complete heterogeneous multigroup latent class model with 4 classes
\
```{r mplussyntax4, results='markup', echo = FALSE}
fileName <- 'functions/HeterMGmpluscode.txt'
cat(readChar(fileName, file.info(fileName)$size), collapse = "\n")
```
#### Confirmatory latent class model with 4 classes for Students' endorsement of gender equality scale
\
```{r mplussyntax5, results='markup', echo = FALSE}
fileName <- 'data/MplusModels/LCA/GND_Conflca_C3cl4.inp'
cat(readChar(fileName, file.info(fileName)$size), collapse = "\n")
```
#### Confirmatory latent class model with 4 classes for Students' endorsement of equal rights for all ethnic/racial groups scale
\
```{r mplussyntax6, results='markup', echo = FALSE}
fileName <- 'data/MplusModels/LCA/ETH_Conflca_C3cl4.inp'
cat(readChar(fileName, file.info(fileName)$size), collapse = "\n")
```