data-edu / tidyLPA

Easily carry out Latent Profile Analysis (LPA) using open-source or commercial software
https://data-edu.github.io/tidyLPA/
Other
56 stars 16 forks source link

error message using single_imputation() #111

Closed ebmtnprof closed 5 years ago

ebmtnprof commented 5 years ago

Thanks yet again for a great package! The updated version is now pretty much working for me, except that I am getting an error message when trying to use the imputation option. Here is the syntax and error (note: It works fine if I omit the single_imputation argument) - any thoughts?? Cheers, Emily

lpa1 <- clo$params %>%

  • select(obs_0:p_d1_1) %>%
  • single_imputation() %>%
  • estimate_profiles(3) Error in mix::da.mix(s, thetahat, steps = 100, showits = verbose) : NA/NaN/Inf in foreign function call (arg 5)
cjvanlissa commented 5 years ago

single_imputation is a wrapper for imputation functions from external packages. You're using mix(), which is throwing an error. I might be able to help anyway, but would need to see the data, or a reproducible example with fake data, to debug this!

ebmtnprof commented 5 years ago

thanks for the response! I am attaching the data and here is the script. I guess mix is somehow my default - should I change that, and if so, to what? Cheers, Emily

lpa1 <- params %>% select(obs_0:p_d1_1) %>% single_imputation %>% estimate_profiles(n_profiles=2:4)

On Wed, Apr 10, 2019 at 11:01 PM C. J. van Lissa notifications@github.com wrote:

single_imputation is a wrapper for imputation functions from external packages. You're using mix(), which is throwing an error. I might be able to help anyway, but would need to see the data, or a reproducible example with fake data, to debug this!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/data-edu/tidyLPA/issues/111#issuecomment-481977259, or mute the thread https://github.com/notifications/unsubscribe-auth/AkNSOgO3ozY6B2DoVBXiUzmU6KEJeyihks5vfs_FgaJpZM4coWmt .

--

Emily A. Butler

Professor & Graduate Director Family Studies and Human Development College of Agriculture & Life Sciences University of Arizona Tucson, AZ, 85721-0033

cjvanlissa commented 5 years ago

I looked into it, and noticed two things: 1) Your data does not have any missing values, so you can omit the call to single_imputation; 2) Indeed, the error originates in the "mix" package. I got quite deep into their code, but cannot detect the source of the problem. Moreover, the problem only occurs with your dataset. If you want this issue solved, I would suggest contacting the "mix" package maintainer. I am not familiar enough with their code to debug it.

Meanwhile, if you do have missing values, you can use the "missForest" method for single_imputation. You will need to install the package "missForest" for this:

install.packages("missForest")
params %>%
  select(obs_0:p_d1_1) %>%
  single_imputation(method = "missForest") %>%
  estimate_profiles(n_profiles=2:4)

That'll work. Good luck!

ebmtnprof commented 5 years ago

Thanks for this response too! First, sorry - I guess I gave you the wrong data. I was trying to use single_imputation with a dataframe that had missing values. Second, thanks for digging into it. I'll try the missForest approach. Cheers, Emily

On Sat, Apr 13, 2019 at 12:03 AM C. J. van Lissa notifications@github.com wrote:

I looked into it, and noticed two things:

  1. Your data does not have any missing values, so you can omit the call to single_imputation;
  2. Indeed, the error originates in the "mix" package. I got quite deep into their code, but cannot detect the source of the problem. Moreover, the problem only occurs with your dataset. If you want this issue solved, I would suggest contacting the "mix" package maintainer. I am not familiar enough with their code to debug it.

Meanwhile, if you do have missing values, you can use the "missForest" method for single_imputation. You will need to install the package "missForest" for this:

install.packages("missForest") params %>% select(obs_0:p_d1_1) %>% single_imputation(method = "missForest") %>% estimate_profiles(n_profiles=2:4)

That'll work. Good luck!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/data-edu/tidyLPA/issues/111#issuecomment-482783242, or mute the thread https://github.com/notifications/unsubscribe-auth/AkNSOgiLaOAwWoftfj-y-fTpgZyj9W-Vks5vgYE5gaJpZM4coWmt .

--

Emily A. Butler

Professor & Graduate Director Family Studies and Human Development College of Agriculture & Life Sciences University of Arizona Tucson, AZ, 85721-0033