[R-sig-ME] lmer()/glmer() data formatting question
bbo|ker @end|ng |rom gm@||@com
Fri Apr 30 21:15:51 CEST 2021
Yes, the value of the predictor for each observation should be the
value relevant to that observation. E.g. if subect 17 has a baseline
value of 14.2, that value should be repeated for all of the observations
pertaining to that subject.
Requiring the data to be in long format makes implementation *much*
easier, although I have sometimes mused about the possibility of
implementing modeling machinery that takes relational tables rather than
a single data frame as input ... (Is anyone aware of such a modeling
system, specifically one that handles designs of more-or-less arbitrary
There is a package for handling multi-tables in R
but it doesn't do anything clever/efficient in a mixed-model context,
just allows the coercion to long format to happen automatically ...
On 4/30/21 2:51 PM, Hedyeh Ahmadi wrote:
> Hi All,
> I am having a basic question about data formatting for lmer()/glmer() that I think I know the answer, but I would appreciate it if you could confirm my understanding.
> In the lmer() world, we have either time-varying or time-invariant predictors. When we format the data, we need to have it in long format. In long data format we have the following:
> * Time-varying predictors will change for each time point (i.e. each row).
> * Time-invariant predictors will stay the same for all time points.
> My question: If I want to adjust for a baseline predictor then the format for this variable should be the same as time-invariant predictor (i.e. same value for all time points) - is that correct?
> Thank you in advance for your time!
> Hedyeh Ahmadi, Ph.D.
> Applied Statistician
> Keck School of Medicine
> Department of Preventive Medicine
> University of Southern California
> Postdoctoral Scholar
> Institute for Interdisciplinary Salivary Bioscience Research (IISBR)
> University of California, Irvine
> [[alternative HTML version deleted]]
> R-sig-mixed-models using r-project.org mailing list
More information about the R-sig-mixed-models