Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

cluster.lm

Linear regression with clustered data


Description

Linear regression with clustered data.

Usage

cluster.lm(y, x, id)

Arguments

y

The dependent variable, a numerical vector with numbers.

x

A matrix or a data.frame with the indendent variables.

id

A numerical variable with 1, 2, ... indicating the subject. Unbalanced design is of course welcome.

Details

A linear regression model for clustered data is fitted. For more information see Chapter 4.21 of Hansen (2019).

Value

A list including:

be

The (beta) regression coefficients.

becov

Robust covariance matrix of the regression coefficients.

seb

Robust standard errors of the regression coefficients.

Author(s)

Michail Tsagris

R implementation and documentation: Michail Tsagris <mtsagris@uoc.gr>

References

See Also

Examples

y <- rnorm(200)
id <- sample(1:20, 200, replace = TRUE)
x <- rnorm(200, 3)
cluster.lm(y, x, id)

Rfast2

A Collection of Efficient and Extremely Fast R Functions II

v0.0.9
GPL (>= 2.0)
Authors
Manos Papadakis, Michail Tsagris, Stefanos Fafalios and Marios Dimitriadis.
Initial release
2021-03-21

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.