-
Notifications
You must be signed in to change notification settings - Fork 49
Description
Dear all,
I am fitting MixedModels for large single cell datasets.
One approach to test for covariates is to drop a single coefficient from the modelmatrix, which belongs to one level of a categorical variable.
I have not been able to find this possibility in Julia.
As an example, let me use the iris dataset. It may not be a mixed model, but in principle it is the same.
We have the full model:
full = lm(@formula(SepalLength ~ Species), iris)
with results
SepalLength ~ 1 + Species
Coefficients:
─────────────────────────────────────────────────────────────────────────────
Coef. Std. Error t Pr(>|t|) Lower 95% Upper 95%
─────────────────────────────────────────────────────────────────────────────
(Intercept) 5.936 0.0728022 81.54 <1e-99 5.79213 6.07987
Species: setosa -0.93 0.102958 -9.03 <1e-15 -1.13347 -0.726531
Species: virginica 0.652 0.102958 6.33 <1e-08 0.448531 0.855469
─────────────────────────────────────────────────────────────────────────────
My goal would be, to drop Species: setosa in the formula or model matrix for another linear model.
This nested model would be compared to the full model by likelihood ratio test.
Everything I found so far would be dropping the Species variable entirely, but it is not what I want.
I have played around with contrasts, where in the example the modelmatrix column for Species: setosa would be all zeros, but got the warning that the model is not full rank.
Is there any solution to this, or possibly a workaround?
Thank you for any help,
Max