View source: R/ranef_mle_regressions_repeated_measures.R

Many random intercepts LMMs for balanced data with a single identical covariate. | R Documentation |

Many random intercepts LMMs for balanced data with a single identical covariate.

colrint.regbx(y, x, id)

`y` |
A numerical matrix with the data. The subject values. |

`x` |
A numerical vector with the same length as the number of rows of y indicating the fixed predictor variable. Its values are the same for all levels of y. An example of this x is time which is the same for all subjects. |

`id` |
A numerical variable with 1, 2, ... indicating the subject. |

This is a special case of a balanced random intercepts model with a compound symmetric covariance matrix and one single covariate which is constant for all replicates. An example, is time, which is the same for all subjects. Maximum likelihood estimation has been performed. In this case the mathematics exist in a closed formula (Demidenko, 2013, pg. 67-69).

This is the generalistion of `rint.regbx`

to matrices. Assume you have many observations, gene
expressions over time for example, and you want to calculate the random effects or something else for each
expression. Instead of using a "for" loop with `rint.regbx`

function we have used amtrix operations to
make it even faster.

A list including:

`info` |
A matrix with the random intercepts variance (between), the variance of the errors (within), the log-likelihood, the deviance (twice the log-likelihood) and the BIC. In the case of "rint.reg" it also includes the number of iterations required by the generalised least squares. |

`be` |
The estimated regression coefficients, which in the case of "rint.regbx" are simply two: the constant and the slope (time effect). |

`ranef` |
A matrix with random intercepts effects. Each row corresponds to a column in y. Instead of having a matrix with the same number of columns as y we return a transposed matrix. |

Michail Tsagris

R implementation and documentation: Michail Tsagris <mtsagris@uoc.gr> and Manos Papadakis <papadakm95@gmail.com>.

Eugene Demidenko (2013). Mixed Models: Theory and Applications with R, 2nd Edition. New Jersey: Wiley \& Sons (excellent book).

```
colvarcomps.mle, rint.regbx, rm.lines, varcomps.mom, rint.reg
```

y <- matrix( rnorm(100 * 50), ncol = 50) id <- rep(1:20, each = 5) x <- rep(1:10, 10) system.time( a<- colrint.regbx(y, x, id) )

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.