Learn R Programming

RRI (version 1.1)

get_clustered_eps: Calculate residuals restricted under H0

Description

Given regression model and clustering, this function calculates the OLS residuals under the linear null hypothesis, and assigns them to the specified clusters.

Usage

get_clustered_eps(model, clustering)

Arguments

model

A regression model. See example_model for details.

clustering

A List that specifies a clustering of indexes 1...n (#datapoints). See example_clustering for details.

Value

A List of the restricted residuals clustered according to clustering.

Examples

Run this code
# NOT RUN {
m = example_model(n=100)
cl = list(1:50, 51:100)
er = get_clustered_eps(m, cl)
stopifnot(length(er) == length(cl))
stopifnot(length(er[[1]]) == 50)
# }

Run the code above in your browser using DataLab