How to extract coefficients corresponding to data from each time in a mixed effect model in R?
0
1
Entering edit mode
20 months ago
lzgcas ▴ 10

I am not good at statistics and might have a naive question. Any help is appreciated.

Here is the simplified question: Patients received two different vaccines twice and we collected their blood after each vaccination to measure antibody levels in the blood. There are other variables but here I omitted them and just want to know how different vaccines affect the antibody levels. It seems that the longitudinal data mixed effect model is a proper analysis.

Here is the simulated data. 6 patients received Vaccines A or B for the first vaccine and all received Vaccine A as the second vaccine; after each vaccination they visited a hospital to measure blood antibody levels (2 data points at 2 Visits). It is already confirmed with studies that Vaccine A induced higher antibody levels than Vaccine B. So if using only Visit 1 data to do a linear regression, we can see Vaccine A induced significantly higher antibody levels compared to that with Vaccine B. As all patients received A as the second vaccine, if using only Visit 2 data, there is no significance. My question is, if we include all the data in a linear mixed effect model, how to extract coefficients corresponding to each visit data? I only know how to use the summary() to get the coefficients for both visits data, however, the significance for the Vaccine type doesn't seem to be right.

data_raw = data.frame(ID=c(1,2,3,4,5,6,1,2,3,4,5,6), 
                   Antibody=c(50,60,70,30,40,35,101,102,102,102,101,103), 
                   Visit=c(1,1,1,1,1,1,2,2,2,2,2,2),
                   Vaccine=c("A","A","A","B","B","B","A","A","A","A","A","A"),
                   VaccineChange=c(0,0,0,0,0,0,0,0,0,1,1,1))

Linear regression of Visit 1 data confirmed that Vaccine A induced higher antibody levels.

lm_Visit1=subset(data_raw, Visit ==1)
summary(lm(Antibody~Vaccine,lm_Visit1))


Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)   60.000      4.564  13.145 0.000193 ***
VaccineB     -25.000      6.455  -3.873 0.017948 *  

Linear regression of Visit 2 data indicated no significance as everyone got Vaccine A.

lm_Visit2=subset(data_raw, Visit ==2)
summary(lm(Antibody~VaccineChange,lm_Visit2))       


Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept)   101.6667     0.4714   215.7 2.77e-09 ***
VaccineChange   0.3333     0.6667     0.5    0.643 

If using mixed model with both visits data, the vaccine variable is significant. Is it possible to extract coefficients corresponding to each visit? Just to show similar results to linear regression that Visit 1 showed significance but not Visit 2.

summary(lmer(Antibody~Vaccine+(1|ID),data_raw))       


Fixed effects:
            Estimate Std. Error      df t value Pr(>|t|)    
(Intercept)   87.889      6.457  10.000  13.610 8.87e-08 ***
VaccineB     -52.889     12.915  10.000  -4.095  0.00216 ** 

Originally, I performed two linear regression with each visit data. But I was told that for visit 2 data I should use linear mixed model as I got both visit data to account for repeated measurement within patient differences. Other covariates are not included in this simulated model just for simplicity.

Many thanks,

Jordan

model lmer mixed-effect • 344 views
ADD COMMENT

Login before adding your answer.

Traffic: 2523 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6