CecileProust-Lima / lcmm

R package lcmm
https://CecileProust-Lima.github.io/lcmm/
58 stars 13 forks source link

externVar from latent class model estimated with lcmm link=“thresholds” #264

Closed rossneville closed 1 month ago

rossneville commented 4 months ago

Dear Prof. Proust-Lima

I am very much enjoying using the lcmm package and I have found it very user-friendly (largely due to the worked out vignettes on the lcmm webpage).

I have successfully used lcmm to estimate a latent class model. Given that I’m estimating latent classes from a 4-level ordinal outcome, I employed the thresholds link function.

The lcmm model works well, producing two distinct classes (of children screen time across ages 3, 5, 7, and 9).

I was hoping to use the externVar command to estimate the degree to which class membership (1. high initial screen time steadily declining and 2. high stable screen time) predicts an external outcome at age 9 (reading and literacy).

As far as I can tell, the externVar command does not work for latent class models estimated with ordinal outcome variables (i.e., where link=“thresholds”). Is this correct / still the case?

If I am mistaken and there is a vignette where external is used in the context of an ordinal outcome, can you please point me in the right direction .

If I am right and there is no way of estimating an external outcome using externVar where the lcmm model has the thresholds link function, can you share your thoughts on how such an analysis could be accomplished.

I can extract the predicted class membership for each observation in the dataset and use that as a categorical predictor in a typical regression model. That works fine. However, this does not take into consideration that class membership is measured with error…hence why you came up with externVar.

I would most appreciate any guidance / support / additional resources that you can provide.

Thank you for your consideration of my (long winded) question.

Regards Ross

CecileProust-Lima commented 4 months ago

Dear Ross, sorry for the delay.

ExternVar can be used when your outcome is ordinal. It's just that you should use the method "conditional" and not the "twoStageJoint". Here is an example :

library(lcmm) paquid$age65 <- paquid$age - 65

estimation of the first model (ordinal mixed model)

mthresholds <- lcmm(HIER ~ age65male, random=~ 1, subject='ID', data=paquid, link='thresholds') mthresholds2 <- lcmm(HIER ~ age65male, random=~ 1, subject='ID', mixture=~ age65,ng=2,data=paquid, link='thresholds',B=random(thresholds))

estimation of an external model (linear mixed model in this case)

ext <- externVar(mthresholds2,fixed= IST ~ age65, random=~age65, data=paquid,method="conditional",M = 100) summary(ext)

I hope this helps, best Cécile

rossneville commented 4 months ago

Dear Cécile

Thank you so much for the response.

This is great news, and most helpful.

I have 1 further question: if the latent class growth model is measured across three time points but the external variable is only measured at 1 timepoint (i.e., the final timepoint at the end of the latent process), should the data file only have one observation of the external variable per subject (rather than a duplicate observation for the earlier time points).

This is implied in the externVar documentation. If correct, this would mean the input file for externVar would have 1/3 of the observations of the input file for the initial lcmm.

I hope this further question makes sense.

I’m very excited to run the model this afternoon :)

Regards Ross

CecileProust-Lima commented 4 months ago

Oh yes, indeed, thanks for asking: You should keep the repeated information on the ordinal outcome that will be necessary for the posterior class probability (weights) so in the longitudinal format. But you should have only one row per subject for your external outcome if you want only one classical linear regression. To do that, just put NA on the other rows of the longitudinal format for this external outcome. In my example, I could have kept the exact same data but for IST, put NA on all rows of a subject except one. Cécile

rossneville commented 4 months ago

Thanks so much for clarifying, Cécile. Thanks makes complete sense. Regards Ross

Dr Ross D. Neville, PhD, ProfCert University Teaching and Learning Assistant Professor School of Public Health, Physiotherapy and Sport Science University College Dublin (UCD) Room G6 - Woodview House Belfield, Dublin 4 @.*** +353 (0) 1 716 3419

On Mon 15 Jul 2024 at 13:24, Cécile Proust-Lima @.***> wrote:

Oh yes, indeed, thanks for asking: You should keep the repeated information on the ordinal outcome that will be necessary for the posterior class probability (weights) so in the longitudinal format. But you should have only one row per subject for your external outcome if you want only one classical linear regression. To do that, just put NA on the other rows of the longitudinal format for this external outcome. In my example, I could have kept the exact same data but for IST, put NA on all rows of a subject except one. Cécile

— Reply to this email directly, view it on GitHub https://github.com/CecileProust-Lima/lcmm/issues/264#issuecomment-2228381630, or unsubscribe https://github.com/notifications/unsubscribe-auth/BIT2M3JMCIQJSNDC72YEDX3ZMO5RJAVCNFSM6AAAAABKQ2GTRGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRYGM4DCNRTGA . You are receiving this because you commented.Message ID: @.***>

rossneville commented 4 months ago

Sorry to pester you again so quickly after you closed the issue, however, I've run the model and the R console states "Output can not be produced since the program stopped abnormally".

On Mon, 15 Jul 2024 at 13:24, Cécile Proust-Lima @.***> wrote:

Oh yes, indeed, thanks for asking: You should keep the repeated information on the ordinal outcome that will be necessary for the posterior class probability (weights) so in the longitudinal format. But you should have only one row per subject for your external outcome if you want only one classical linear regression. To do that, just put NA on the other rows of the longitudinal format for this external outcome. In my example, I could have kept the exact same data but for IST, put NA on all rows of a subject except one. Cécile

— Reply to this email directly, view it on GitHub https://github.com/CecileProust-Lima/lcmm/issues/264#issuecomment-2228381630, or unsubscribe https://github.com/notifications/unsubscribe-auth/BIT2M3JMCIQJSNDC72YEDX3ZMO5RJAVCNFSM6AAAAABKQ2GTRGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRYGM4DCNRTGA . You are receiving this because you commented.Message ID: @.***>

-- Dr Ross D. Neville, PhD, ProfCert University Teaching and Learning Assistant Professor School of Public Health, Physiotherapy and Sport Science University College Dublin (UCD) Room G6 - Woodview House Belfield, Dublin 4 @.*** +353 (0) 1 716 3419

CecileProust-Lima commented 4 months ago

Oops, sorry, I hadn't checked thoroughly enough. Indeed, when trying to estimate through externVar with no random effect, it seems there is a bug. We will look into this as soon as possible and keep you updated. Sorry for the inconvenience. Cécile

rossneville commented 4 months ago

Hi Cécile Thanks for the quick reply and update. Yes, the model would not run for me without a random effect. It also wouldn’t run with just a simple random intercept (random =~ 1). Finally, I’m not sure if the externVar model can be run with just the the class intercepts being estimated (fixed = IST ~ 1). Could you clarify this for me too? I’d like to run the most basic model and build my intuition up from there. Ultimately, however, I would like the latent class intercepts for the external outcome to vary by sex and for the model to estimate separate variances for males and females in each class, which I assume would require the incorporation of sex into the fixed component of the model (fixed = IST ~ Sex) and the mixture statement (mixture =~ Sex). Thanks so much for your consideration of my questions. I am very much enjoying learning to use the lcmm package having spent most of my career to date running mixed models in SAS (Proc Mixed), which is more limited it seems. This is great learning for me. Regards Ross

Dr Ross D. Neville, PhD, ProfCert University Teaching and Learning Assistant Professor School of Public Health, Physiotherapy and Sport Science University College Dublin (UCD) Room G6 - Woodview House Belfield, Dublin 4 @.*** +353 (0) 1 716 3419

On Tue 16 Jul 2024 at 17:53, Cécile Proust-Lima @.***> wrote:

Oops, sorry, I hadn't checked thoroughly enough. Indeed, when trying to estimate through externVar with no random effect, it seems there is a bug. We will look into this as soon as possible and keep you updated. Sorry for the inconvenience. Cécile

— Reply to this email directly, view it on GitHub https://github.com/CecileProust-Lima/lcmm/issues/264#issuecomment-2231393339, or unsubscribe https://github.com/notifications/unsubscribe-auth/BIT2M3N3XM4TGQS3WNGACJLZMVFYFAVCNFSM6AAAAABKQ2GTRGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZRGM4TGMZTHE . You are receiving this because you commented.Message ID: @.***>

CecileProust-Lima commented 4 months ago

Hi, I identified the bug with no random effect. It should work fine now with the github version.

Here is the example I ran for the check. You will see, I considered both the case of just a regression with class-specific intercepts, and the case with class-specific effect of covariate:

estimation of the first model (ordinal mixed model)

paquid$age65 <- paquid$age - 65 mthresholds <- lcmm(HIER ~ age65 male, random=~ 1, subject='ID', data=paquid, link='thresholds') mthresholds2 <- lcmm(HIER ~ age65 male, random=~ 1, subject='ID', mixture=~ age65,ng=2,data=paquid, link='thresholds',B=random(mthresholds))

estimation of an external model with a (pseudo) time-fixed outcome

I consider here the last value of IST during the follow-up

library(dplyr) paq <- paquid %>% group_by(ID) %>% mutate(agemax = max(age)) %>%ungroup %>% mutate(ISTlast = ifelse(age==agemax,IST,NA))

with only 10 bootstrap as just for the illustration

ext0 <- externVar(mthresholds2,fixed= ISTlast ~ 1, random=~-1, mixture=~1, data=paq,method="conditional",M = 10,varest = "paramBoot") summary(ext0)

with class-specific effect of sex

extM <- externVar(mthresholds2,fixed= ISTlast ~ male, random=~-1, mixture=~male, data=paq,method="conditional",M = 10,varest = "paramBoot") summary(extM)

I hope it will work fine for you Cécile

rossneville commented 4 months ago

Dear Cécile

Thanks so much for your response and direction.

In the first instance, I tried to reproduce that example your provided above with the paquid dataset.

The following model (external model with time-fixed outcome and no random effect) would not run.

ext0 <- externVar(mthresholds2,fixed= ISTlast ~ 1, random=~-1, mixture=~1, data=paq,method="conditional",M = 10,varest = "paramBoot") summary(ext0)

I got the following error:

Output can not be produced since the program stopped abnormally. Error in externVar(mthresholds2, fixed = ISTlast ~ 1, random = ~-1, mixture = ~1, No parametric boostrap iteration could converge.

The problem seems to be with "random=~-1", since the following code with the addition of the random intercept worked fine:

ext0 <- externVar(mthresholds2,fixed= ISTlast ~ 1, random=~1, mixture=~1, data=paq,method="conditional",M = 10,varest = "paramBoot") summary(ext0)

The following model with the class-specific effect of sex also wouldn't run:

extM <- externVar(mthresholds2,fixed= ISTlast ~ male, random=~-1, mixture=~male, data=paq,method="conditional",M = 10,varest = "paramBoot") summary(extM)

I received the following error when I ran that model:

Error in modOut$best[iVCOut] <- vc : replacement has length zero

As above, the model with class-specific effect of sex ran fine when I introduced the random intercept, as follows:

extM <- externVar(mthresholds2,fixed= ISTlast ~ male, random=~1, mixture=~male, data=paq,method="conditional",M = 10,varest = "paramBoot") summary(extM)

Could there be something on my device or console that is problematic, since I assume that the example you shared worked for you.

Regards Ross

CecileProust-Lima commented 4 months ago

Have you first reinstalled lcmm from github? This is the problem I fixed yesterday:

remotes::install_github("https://github.com/CecileProust-Lima/lcmm.git")

Cécile

rossneville commented 4 months ago

I haven't. Sorry. I should have done that. I will try that now.

On Thu, 18 Jul 2024 at 12:18, Cécile Proust-Lima @.***> wrote:

Have you first reinstalled lcmm from github? This is the problem I fixed yesterday:

remotes::install_github("https://github.com/CecileProust-Lima/lcmm.git")

Cécile

— Reply to this email directly, view it on GitHub https://github.com/CecileProust-Lima/lcmm/issues/264#issuecomment-2236250953, or unsubscribe https://github.com/notifications/unsubscribe-auth/BIT2M3N6ZNY3WKJCPR4O5I3ZM6P7TAVCNFSM6AAAAABKQ2GTRGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZWGI2TAOJVGM . You are receiving this because you commented.Message ID: @.***>

-- Dr Ross D. Neville, PhD, ProfCert University Teaching and Learning Assistant Professor School of Public Health, Physiotherapy and Sport Science University College Dublin (UCD) Room G6 - Woodview House Belfield, Dublin 4 @.*** +353 (0) 1 716 3419

rossneville commented 4 months ago

Unfortunately I keep getting an error message when trying to install lcmm again. Though perhaps its a problem on my side.

Error message below:

remotes::install_github("https://github.com/CecileProust-Lima/lcmm.git") Downloading GitHub repo CecileProust-Lima/lcmm@HEAD ── R CMD build ───────────────────────────────────────────────────────────────────────────────────────── ✔ checking for file ‘/private/var/folders/jl/pxj5wshj00g47zbvj_65ft9r0000gn/T/RtmpxMcFaO/remotes8ce141879ac7/CecileProust-Lima-lcmm-4e541c4/DESCRIPTION’ (458ms) ─ preparing ‘lcmm’: (415ms) ✔ checking DESCRIPTION meta-information ... ─ cleaning src ─ installing the package to process help pages

─ installing source package ‘lcmm’ ... using staged installation libs clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -Wall -pedantic -fdiagnostics-color=always -c init.c -o init.o clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -Wall -pedantic -fdiagnostics-color=always -c runiran.c -o runiran.o gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c compute.f90 -o compute.o gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c hetmixOrd.f90 -o hetmixOrd.o gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c hetmixlin.f90 -o hetmixlin.o gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c hetmixCont.f90 -o hetmixCont.o gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c Jointhet.f90 -o Jointhet.o gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c calculusTransfo.f90 -o calculusTransfo.o gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c predictCont.f90 -o predictCont.o gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c predictMult.f90 -o predictMult.o gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c postprob2.f90 -o postprob2.o gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c cvpl.f90 -o cvpl.o gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c predictYcond.f90 -o predictYcond.o gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c mpjhet.f90 -o mpjhet.o gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c hetmixMult.f90 -o hetmixMult.o gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c iteminfo.f90 -o iteminfo.o gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c Integ.f90 -o Integ.o Integ.f90:23:28:

  23 |   integer :: ier, nmoins, kk, nvarprob, ncg, ncssg, nea, nef, nvc, nprob
     |                            1

Warning: Unused variable ‘kk’ declared at (1) [-Wunused-variable] clang -mmacosx-version-min=10.13 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o lcmm.so init.o runiran.o compute.o hetmixOrd.o hetmixlin.o hetmixCont.o Jointhet.o calculusTransfo.o predictCont.o predictMult.o postprob2.o cvpl.o predictYcond.o mpjhet.o hetmixMult.o iteminfo.o Integ.o -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0' ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0' ld: warning: could not create compact unwind for vraisobs: stack subq instruction is too different from dwarf stack size ld: warning: could not create compact unwind for vraisobsc: stack subq instruction is too different from dwarf stack size ld: warning: could not create compact unwind for predictmult: stack subq instruction is too different from dwarf stack size ld: warning: dylib (/usr/local/gfortran/lib/libgfortran.dylib) was built for newer macOS version (12.3) than being linked (10.13) ld: warning: dylib (/usr/local/gfortran/lib/libquadmath.dylib) was built for newer macOS version (12.3) than being linked (10.13) installing to /private/var/folders/jl/pxj5wshj00g47zbvj_65ft9r0000gn/T/RtmpZPPGCI/Rinst8ece7d04fbd4/00LOCK-lcmm/00new/lcmm/libs R data * moving datasets to lazyload DB inst byte-compile and prepare package for lazy loading * help installing help indices building package indices installing vignettes ** testing if installed package can be loaded from temporary location Error: package or namespace load failed for ‘lcmm’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/private/var/folders/jl/pxj5wshj00g47zbvj_65ft9r0000gn/T/RtmpZPPGCI/Rinst8ece7d04fbd4/00LOCK-lcmm/00new/lcmm/libs/lcmm.so': dlopen(/private/var/folders/jl/pxj5wshj00g47zbvj_65ft9r0000gn/T/RtmpZPPGCI/Rinst8ece7d04fbd4/00LOCK-lcmm/00new/lcmm/libs/lcmm.so, 0x0006): Symbol not found: (__gfortran_os_error_at) Referenced from: '/private/var/folders/jl/pxj5wshj00g47zbvj_65ft9r0000gn/T/RtmpZPPGCI/Rinst8ece7d04fbd4/00LOCK-lcmm/00new/lcmm/libs/lcmm.so' Expected in: '/Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libgfortran.5.dylib' Error: loading failed Execution halted ERROR: loading failed ─ removing ‘/private/var/folders/jl/pxj5wshj00g47zbvj_65ft9r0000gn/T/RtmpZPPGCI/Rinst8ece7d04fbd4/lcmm’

ERROR: package installation failed Error: Failed to install 'lcmm' from GitHub: ! System command 'R' failed

VivianePhilipps commented 4 months ago

Hi,

I don't know how to fix this, but a search about your warnings led me to this post : https://github.com/fxcoudert/gfortran-for-macOS/issues/40 This suggests that there may be some options in Rstudio to change. See maybe in the "Global options" or "Build tools" tabs.

Viviane

rossneville commented 4 months ago

I managed to reinstall lcmm from GitHub.

I had to resolve a local issue on my Mac by ensuring the Fortran compiler and necessary libraries were correctly linked (updating the .R/Makevars file with the appropriate paths for gfortran and its libraries).

The paquid example you provided now works in full.

However, I subsequently applied the example model you provided to my data and still get the "Output can not be produced since the program stopped abnormally".

My external outcome variable is bounded values 0 to 100 and is quite right skewed, so perhaps that is affecting the model. The variable in your model (ISTlast) is much more normally distributed.

I log transformed the variable and the model actually ran and produced output, but it didn't estimate standard errors for the fixed and random effect.

So perhaps I need to tinker with the link function here, or consider other transformations of the external outcome.

Any further thoughts and suggestions?

Regards Ross

On Thu, 18 Jul 2024 at 12:18, Cécile Proust-Lima @.***> wrote:

Have you first reinstalled lcmm from github? This is the problem I fixed yesterday:

remotes::install_github("https://github.com/CecileProust-Lima/lcmm.git")

Cécile

— Reply to this email directly, view it on GitHub https://github.com/CecileProust-Lima/lcmm/issues/264#issuecomment-2236250953, or unsubscribe https://github.com/notifications/unsubscribe-auth/BIT2M3N6ZNY3WKJCPR4O5I3ZM6P7TAVCNFSM6AAAAABKQ2GTRGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZWGI2TAOJVGM . You are receiving this because you commented.Message ID: @.***>

-- Dr Ross D. Neville, PhD, ProfCert University Teaching and Learning Assistant Professor School of Public Health, Physiotherapy and Sport Science University College Dublin (UCD) Room G6 - Woodview House Belfield, Dublin 4 @.*** +353 (0) 1 716 3419

rossneville commented 4 months ago

Thanks Viviane. As noted in my response just now, I resolved the local issue (though, it has taken me most of the day!!!). So, I'm back on track....but facing new issues in lcmm. Regards Ross

On Fri, 19 Jul 2024 at 15:07, VivianePhilipps @.***> wrote:

Hi,

I don't know how to fix this, but a search about your warnings led me to this post : fxcoudert/gfortran-for-macOS#40 https://github.com/fxcoudert/gfortran-for-macOS/issues/40 This suggests that there may be some options in Rstudio to change. See maybe in the "Global options" or "Build tools" tabs.

Viviane

— Reply to this email directly, view it on GitHub https://github.com/CecileProust-Lima/lcmm/issues/264#issuecomment-2239264622, or unsubscribe https://github.com/notifications/unsubscribe-auth/BIT2M3K2DEPX4W2XO5DQBQDZNEMTBAVCNFSM6AAAAABKQ2GTRGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZZGI3DINRSGI . You are receiving this because you commented.Message ID: @.***>

-- Dr Ross D. Neville, PhD, ProfCert University Teaching and Learning Assistant Professor School of Public Health, Physiotherapy and Sport Science University College Dublin (UCD) Room G6 - Woodview House Belfield, Dublin 4 @.*** +353 (0) 1 716 3419

CecileProust-Lima commented 4 months ago

Hi, you can indeed account for nonlinear link functin in the externVar regression by adding link argument as in lcmm classical object:

just the class effect and a nonlinear link

extL <- externVar(mthresholds2,fixed= ISTlast ~ 1, random=~-1, mixture=~1, data=paq,method="conditional",M = 10,varest = "paramBoot",link="splines") summary(extL)

After that, maybe your problem comes from the initial values. You could use as initial values the estimates given by the "naive" approach that uses directly the posterior classification as the predictor. This way, you would be close to the target (so faster program estimation).

Cécile

rossneville commented 4 months ago

That’s good to know. I will tinker with the initial values to begin with.

Dr Ross D. Neville, PhD, ProfCert University Teaching and Learning Assistant Professor School of Public Health, Physiotherapy and Sport Science University College Dublin (UCD) Room G6 - Woodview House Belfield, Dublin 4 @.*** +353 (0) 1 716 3419

On Mon 22 Jul 2024 at 11:47, Cécile Proust-Lima @.***> wrote:

Hi, you can indeed account for nonlinear link functin in the externVar regression by adding link argument as in lcmm classical object: just the class effect and a nonlinear link

extL <- externVar(mthresholds2,fixed= ISTlast ~ 1, random=~-1, mixture=~1, data=paq,method="conditional",M = 10,varest = "paramBoot",link="splines") summary(extL)

After that, maybe your problem comes from the initial values. You could use as initial values the estimates given by the "naive" approach that uses directly the posterior classification as the predictor. This way, you would be close to the target (so faster program estimation).

Cécile

— Reply to this email directly, view it on GitHub https://github.com/CecileProust-Lima/lcmm/issues/264#issuecomment-2242658355, or unsubscribe https://github.com/notifications/unsubscribe-auth/BIT2M3IQZRYMJOLEMU5LS7DZNTPMXAVCNFSM6AAAAABKQ2GTRGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBSGY2TQMZVGU . You are receiving this because you commented.Message ID: @.***>

rossneville commented 3 months ago

Dear Cécile Thanks for this clarification. It's taken me a lot of tinkering, mostly on the side of my data, to get externVar working. It's working well now. I am surprised how different the outcomes of externVar are from the naive approach. Has it been your experience that the difference in class means for an external outcome estimate with the externVar approach is considerably smaller or larger than the difference in class means estimated with the naive approach? Regards Ross

On Mon, 22 Jul 2024 at 11:47, Cécile Proust-Lima @.***> wrote:

Hi, you can indeed account for nonlinear link functin in the externVar regression by adding link argument as in lcmm classical object: just the class effect and a nonlinear link

extL <- externVar(mthresholds2,fixed= ISTlast ~ 1, random=~-1, mixture=~1, data=paq,method="conditional",M = 10,varest = "paramBoot",link="splines") summary(extL)

After that, maybe your problem comes from the initial values. You could use as initial values the estimates given by the "naive" approach that uses directly the posterior classification as the predictor. This way, you would be close to the target (so faster program estimation).

Cécile

— Reply to this email directly, view it on GitHub https://github.com/CecileProust-Lima/lcmm/issues/264#issuecomment-2242658355, or unsubscribe https://github.com/notifications/unsubscribe-auth/BIT2M3IQZRYMJOLEMU5LS7DZNTPMXAVCNFSM6AAAAABKQ2GTRGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBSGY2TQMZVGU . You are receiving this because you commented.Message ID: @.***>

-- Dr Ross D. Neville, PhD, ProfCert University Teaching and Learning Assistant Professor School of Public Health, Physiotherapy and Sport Science University College Dublin (UCD) Room G6 - Woodview House Belfield, Dublin 4 @.*** +353 (0) 1 716 3419