Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem running mincLm with covariates #322

Open
christianlimberger opened this issue Jul 12, 2024 · 7 comments
Open

Problem running mincLm with covariates #322

christianlimberger opened this issue Jul 12, 2024 · 7 comments

Comments

@christianlimberger
Copy link

christianlimberger commented Jul 12, 2024

I am trying to run mincLm, but I'm encountering an error that only occurs when I include covariates. This is strange because the same error is happening with other codes that previously worked perfectly.

> df_fdg <- read.csv("final_merge-model.csv")
> df_fdg$APOE4 <- as.factor(df_fdg$APOE4)
> df_fdg$PTGENDER <- as.factor(df_fdg$PTGENDER)
> df_fdg$ABETA <- as.numeric(df_fdg$ABETA)
> df_fdg$PTAU <- as.numeric(df_fdg$PTAU)
> df_fdg$AGE <- as.numeric(df_fdg$AGE)
> df_fdg_CU <- filter(df_fdg, DX == "CU")
> df_fdg_CU$AGE <- scale(df_fdg_CU$AGE)[,1]
> df_fdg_CU$ABETA <- scale(df_fdg_CU$ABETA)[,1]
> df_fdg_CU$PTAU <- scale(df_fdg_CU$PTAU)[,1]
> df_fdg_CU$snp <- factor(df_fdg_CU$snp, levels = c("noncarrier", "carrier"))
> lm1 <- mincLm(FDG_path ~ snp + APOE4 + PTGENDER + AGE + ABETA + PTAU, data = df_fdg_CU, mask = "adni_space.mnc")
Error in formula[[3]][[nTerm]] > 1 :
comparison (>) is not possible for language types
@gdevenyi
Copy link
Contributor

First, you can directly use the scale() function inside the RMINC equation, which is probably more clear for the latest outputs.

I suggest you try each covariate individually, something about the structure of one of your columns isn't as expected.

@christianlimberger
Copy link
Author

Thank you Gabriel, I already tried putting scale() inside the function, and also testing each covariate individually, but only got the function running without any covariate...

@gdevenyi
Copy link
Contributor

gdevenyi commented Jul 12, 2024

ok, something about your data is very messed up then. Please provide some kind of view of the df_fdg_CU object.

@christianlimberger
Copy link
Author

image

@gdevenyi
Copy link
Contributor

Ok. Lets look at a few more things.

Given this model is your goal,

> lm1 <- mincLm(FDG_path ~ snp + APOE4 + PTGENDER + AGE + ABETA + PTAU, data = df_fdg_CU, mask = "adni_space.mnc")

Can you successfully run

>  lm1 <- mincLm(FDG_path ~ <SINGLE PREDICTOR>, data = df_fdg_CU, mask = "adni_space.mnc")

For each of these columns successfully?

@christianlimberger
Copy link
Author

yes! The problem is when I put any covariate

@gdevenyi
Copy link
Contributor

Okay, lets pare down this to a minimum failing example.

Can you please choose a simple two-predictor model, run it without the mask option, and after the error, run traceback() and provide the full output.

In addition, please provide your sessionInfo()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants