rpr: Cluster and Subcluster effects

View source: R/rpr.R

rprR Documentation

Cluster and Subcluster effects

Description

Partitions model residuals into cluster and subcluster effects using RPP algorithm.

Usage

rpr(f, resd, data, rprpair = "hl-disp")

Arguments

f

A model formula which specifices the random effects (see example)

resd

The residuals from the fitted model

data

The data the model was fitted on

rprpair

Character string indicating the location and scale parameters to use. Default to "hl-disp", but may also be "med-mad". See Bilgic (2012).

Value

siga2

Variance from cluster

sigw2

Variance from subcluster

sigmae2

Remaining variance not accounted for by variance of cluster and subcluster

Author(s)

J. W. McKean and Y. K. Bilgic

References

Y. K. Bilgic. Rank-based estimation and prediction for mixed effects models in nested designs. 2012. URL http://scholarworks.wmich.edu/dissertations/40. Dissertation.

See Also

rprmeddis, dispvar

Examples


# Load school data
data(schools)

# Fit fixed effects model with lmr
lmr.fit = lmr(y ~ age + sex, data=schools)

# Three level design
# Partition residuals into school and region effects with rpp algorithm
rpr(y ~ age + sex + (1 | school) + (1 | school:region), lmr.fit$ehat, schools)

# Two level design
# Estimate variance in residuals from school
rpr(y ~ age + sex + (1 | school), lmr.fit$ehat, schools)


herbps10/rlme documentation built on Nov. 25, 2022, 1:38 p.m.