Sergio: 1. You do not have a "repeated measures linear model" .
2. This list is not designed to replace your own efforts to learn the necessary R background, in this case, factor coding and contrasts in linear models. I would suggest you spend some time with any of the many fine R linear model tutorials that can be found on the web. Here is one place to look for suggestions: https://www.rstudio.com/online-learning/#R . But just googling around you'll probably find something that may suit even better. 3. This list is primarily for R programming help, not statistics help (although they do sometimes intersect). For the latter, try a statistics site like stats.stackexchange.com . 4. Finally, as always, consulting with a local statistical resource, if available, is always worth considering. HTH. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Wed, Dec 6, 2017 at 6:17 AM, Sergio PV <serpalm...@gmail.com> wrote: > Dear Users, > > I am trying to understand the inner workings of a repeated measures linear > model. Take for example a situation with 6 individuals sampled twice for > two conditions (control and treated). > > set.seed(12) > ctrl <- rnorm(n = 6, mean = 2) > ttd <- rnorm(n = 6, mean = 10) > dat <- data.frame(vals = c(ctrl, ttd), > group = c(rep("ctrl", 6), rep("ttd", 6)), > ind = factor(rep(1:6, 2))) > > fit <- lm(vals ~ ind + group, data = dat) > model.matrix(~ ind + group, data = dat) > > I am puzzled on how the coeficients are calculated. For example, according > to the model matrix, I thought the intercept would be individual 1 control. > But that is clearly not the case. > For the last coeficient, I understand it as the mean of all differences > between treated vs control at each individual. > > I would greatly appreciate if someone could clarify to me how the > coefficients in this situation are estimated. > > Thanks > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/ > posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.