Dear all,
I just started using DataSHIELD. The purpose is to evaluate the possibility to use DataSHIELD in our upcoming medical research. Do do so I am trying to do a linear mixed model analysis.
My code looks like this:
tryCatch(
{
m1 <- ds.lmerSLMA(
formula = "Var1 ~ Time * Group + (1|ID)",
data = "D_Supine",
datasources = conns,
newobj = "m1"
)
}, error = function(e) {
print(e)
print(datashield.errorMessages())
}
)
My questions:
- Are there any good tutorials on doing lmer analysis with DataSHIELD?
- How could I calculate contrasts etc using the object DataSHIELD returns?
Thanks for any help and ideas.
Best,
Jonathan
Hi Jonathan,
Here is a tutorial I delivered on mixed effects models:
Could you give me an example of the contrasts you are looking to do, and I can have a think whether/how it is possible?
Cheers,
Tim
Here is the markdown file:
Hey Tim,
thank you for the excellent video and the work you put into dsHelper!
I get it to work when my Month and Group variable are continues, but not when they are factors. It works when I run my “normal R code“ using lme4 Any tips for that?
My “preferred code“ look something like this. If the factors Months and Groups are continues they work fine.
tryCatch(
{
m1 <- ds.lmerSLMA(
formula = "cont_var ~ factor_1 (Months) * factor_2 (Group) + (1|ID)",
data = "D_Supine",
datasources = conns,
newobj = "m1"
)
m1$output.summary
}, error = function(e) {
print(e)
print(datashield.errorMessages())
}
)
Thank you.
Hi Jonathan, what error message do you get?
Hej again,
I created a markdown file and a fake dataset.
Both can be found here:
Github Page
The error I get says:
Error in `select()`:
ℹ In argument: `all_of(coef_names)`.
Caused by error in `all_of()`:
! Can't subset elements that don't exist.
✖ Elements `MonthGroup12`, `MonthGroup24`, `MonthGroup3`, `MonthGroup48`, `MonthGroup6`, etc. don't exist.
Run `rlang::last_trace()` to see where the error occurred.