FIML with auxiliary vriables

711 views
Skip to first unread message

Thalia Theodoraki

unread,
Jun 30, 2017, 10:10:56 AM6/30/17
to lavaan
Hi there
I am interested in doing a hierarchical regression while utilising auxiliary variables.

I am interested in regressing a cognitive ability score on age, some control variables and another cognitive ability score.
Let's imagine my regression looks something like this

outcome<- predictor1+predictor2+
predictor3

I have missing data on both the outcome and some of the predictor variables. Some of the missing data was caused by testing errors and should be at random. However, some of the missingness on the outcome variable is related to another variable ( let's call it auxiliary1). Also, missingness on the predictor3 variable is related to another variable (let's call it auxiliary2).

As I said, I intend to do a hierarchical regression analysis utilising the saturated correlated model i.e. inserting a series of correlations between the auxiliary variables and the model variables. So my models look something like this (without the auxiliary variables)

outcome~predictor1+ predictor2+predictor3 (full model)
outcome~predictor1+ predictor2+0*predictor3
outcome~predictor1+ 0*predictor2+0*predictor3

And I intend to use anova to compare the models to each other. My question regards which auxiliary variables I should insert in each of these models. Obviously I have to always include the auxiliary1 variable which is related to missingness in the outcome , but what about the auxiliary2?
For example in the last two models where the effect of predicor3 is constrained to 0 do I have to include the auxiliary2 variable that is related to missingness in predictor3 or not?

Also, in models where some predictors are constrained to 0 do I still have to correlate these variables to the auxiliary variables?

I am also guessing that it is ok to work with predictor variables with missing data in lavaan and it is uniform in how it treats missing predictor variables and does not default to excluding cases with missing data on the predictor variables?

Thank you so much
Thalia (a very overwhelmed user of lavaan)

Terrence Jorgensen

unread,
Jul 13, 2017, 12:14:54 PM7/13/17
to lavaan
Obviously I have to always include the auxiliary1 variable which is related to missingness in the outcome , but what about the auxiliary2?
For example in the last two models where the effect of predicor3 is constrained to 0 do I have to include the auxiliary2 variable that is related to missingness in predictor3 or not?

Yes, in order to have valid chi-squared difference tests using anova(), you need to fit the model to the same data (observations and variables).  

Also, in models where some predictors are constrained to 0 do I still have to correlate these variables to the auxiliary variables?

Yes.  The correlation with your auxiliary has nothing to do with your hypothesized relationship you test between the predictor and outcome.  You want to make sure the auxiliary correlation is still estimated, so you are only testing the constraint you are interested in.

I am also guessing that it is ok to work with predictor variables with missing data in lavaan and it is uniform in how it treats missing predictor variables and does not default to excluding cases with missing data on the predictor variables?

Yes, if you set fixed.x = FALSE so that the exogenous predictors are treated as random variables whose (co)variances are freely estimated.  If you are using the auxiliary() function in semTools package, that option will be set automatically,  but you can use it as an argument to a lavaan() function as well.

Terrence D. Jorgensen
Postdoctoral Researcher, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam

David Disabato

unread,
Feb 15, 2018, 9:41:01 AM2/15/18
to lavaan
Hi everyone,

I am having a related problem with including auxiliary variables for FIML estimation with "lavaan" and "semTools." I have a longitudinal design with 2 timepoints. The retention rate from T1 (n = 3000) to T2 (n = 2000) is about 66%. I want to conduct a CFA on a measure at T2; however, I want to include T1 measures as auxiliary variables (e.g., one's that predict missingness). I used the "cfa.auxiliary" function below:

auxvars <- c("depression_1","anxiety_1","alcohol_1","drugs_1")
mod <- "extraversion_2 =~ extra1_2 + extra2_2 + extra3_2 + extra4_2"
cfa.auxiliary(mode = mod, aux = auxvars, data = dat, fixed.x = F, meanstructure = T, estimator = "ML", missing = "FIML")

The model runs and converges fine, but I get the following warning about empty cases:
Warning message:
In lav_data_full(data = data, group = group, cluster = cluster,  :
  lavaan WARNING: some cases are empty and will be ignored:
  2 3 4 5 6 8 9 11 12 13 17 19 22 23 24 25 30 31 32 33 35 38 39 42 45 46 50 52 55 57 61 62 64 66 68 69 70 71 74 75 76 78 79 80 81 82 85 86 89 91 92 94 95 100 101 102 103 104 106 108 109 111 113 115 117 119 120 131 132 134 136 137 140 142 149 152 155 158 162 164 165 166 167 170 172 181 182 184 185 186 188 189 190 191 192 193 194 196 197 198 200 205 207 208 209 213 216 218 220 221 222 224 225 227 228 231 232 235 236 242 245 246 247 249 250 253 257 261 263 264 266 268 275 276 278 279 283 285 287 288 289 290 293 297 298 303 304 306 310 311 312 313 315 316 321 324 325 328 329 330 332 334 335 340 343 344 348 349 350 353 359 360 369 372 375 380 383 385 386 389 390 391 392 394 396 397 398 400 403 406 409 410 411 413 414 415 420 421 422 424 425 426 427 429 431 433 434 435 437 438 442 443 446 448 451 452 453 454 455 456 458 460 465 466 467 468 469 470 471 472 475 477 478 479 480 481 483 486 487 488 492 493 494 495 496 498 501 502 505 506  [... truncated]

I am worried that lavaan is deleting the 1000 cases that only have data at T1 since they are missing for "extra1_2", "extra2_2", "extra3_2", and "extra4_2" (n = 2000). The auxiliary variables all have no missing data (n = 3000) so the full dataframe in the CFA of "extra1_2", "extra2_2", "extra3_2", "extra4_2","depression_1","anxiety_1","alcohol_1","drugs" should have no empty cases. So I am not sure why lavaan would tell me some cases were empty and therefore deleted.

I would love to get people's thoughts,
David

Terrence Jorgensen

unread,
Feb 22, 2018, 10:34:43 AM2/22/18
to lavaan
I am worried that lavaan is deleting the 1000 cases that only have data at T1 since they are missing for "extra1_2", "extra2_2", "extra3_2", and "extra4_2" (n = 2000).

Those are pretty round numbers.  Are they missing by design?  If the 2000 observed at T2 are a random sample of the full N = 3000, then there is no issue with ignoring them when fitting your theoretical model.  Those 1000 contributed no information about which you want to make an inference, so having their auxiliary information won't offer you anything unless it really is attrition due to the auxiliary variables.  

Regardless, are you using the latest version of the package?  I can not reproduce your issue when I simulate a similar design using the ?auxiliary help page example.

dat1 <- lavaan::HolzingerSwineford1939
set.seed(12345)
dat1$z
<- rnorm(nrow(dat1))
dat1
[201:301, paste0("x", 1:9)] <- NA

targetModel
<- "
  visual  =~ x1 + x2 + x3
  textual =~ x4 + x5 + x6
  speed   =~ x7 + x8 + x9
"


fitaux1
<- cfa.auxiliary(targetModel, data = dat1, aux = "z",
                         missing
= "fiml", estimator = "ml")

To install the latest software (which requires the latest development version of lavaan), run this:

install.packages("lavaan", repos="http://www.da.ugent.be", type="source")
devtools
::install_github("simsem/semTools/semTools")

David Disabato

unread,
Feb 22, 2018, 4:54:10 PM2/22/18
to lavaan
Thanks for your response Terrence. The missingness is due to participant dropout (not by design) and there are some auxiliary variables that predict missingness, so I am hoping to get some lost information back via FIML. I simplified my specific dataset and analysis to make the post more easily understood and broadly applicable. So the sample sizes at T1 and T2 are not as round as 3000 and 2000 and there are more than 4 items in the measure, but the exactness of those details shouldn't affect the answer to my question (to my knowledge).

So I updated R, Rstudio, "lavaan", and "semTools" on my computer and the warning message still occurs with my code. I also got the same warning message while running your code on my computer:

> dat1 <- lavaan::HolzingerSwineford1939
> set.seed(12345)
> dat1$z <- rnorm(nrow(dat1))
> dat1[201:301, paste0("x", 1:9)] <- NA
> targetModel <- "
+ visual  =~ x1 + x2 + x3
+ textual =~ x4 + x5 + x6
+ speed   =~ x7 + x8 + x9
+ "
> fitaux1 <- cfa.auxiliary(targetModel, data = dat1, aux = "z",
+                          missing = "fiml", estimator = "ml")
Warning message:
In lav_data_full(data = data, group = group, cluster = cluster,  :
  lavaan WARNING: some cases are empty and will be ignored:
  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 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301

However, after running the two lines of code you sent me to obtain the developmental versions of "lavaan" and "semTools", both sets of code ran without the warning. Presumably once the new package versions are up on CRAN, no one should have the issue.

Thanks again - David.
Reply all
Reply to author
Forward
0 new messages