ranef: Extract Random Effects

Description Usage Arguments Details Value See Also Examples

View source: R/ranef.R

Description

Generic function for extracting the random effects. This is the same generic (and same name) defined in the nlme and lme4 package.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
ranef(object, ...)

random.effects(object, ...)

## Default S3 method:
random.effects(object, ...)

## Default S3 method:
ranef(object, ...)

## S3 method for class 'ggmix_gic'
ranef(object, s = "lambda.min", ...)

Arguments

object

any fitted model object from which random effects estimates can be extracted. Currently supports "ggmix_gic" objects outputted by the gic function

...

other parameters. currently ignored

s

Value(s) of the penalty parameter lambda at which predictions are required. Default is the value s="lambda.min" can be used. If s is numeric, it is taken as the value(s) of lambda to be used.

Details

For objects of class "ggmix_gic", this function returns the subject-specific random effect value for the model which minimizes the GIC using the maximum a posteriori principle

Value

a numeric vector of length equal to the number of observations of subject-specific random effects

See Also

gic

Examples

1
2
3
4
5
6
7
8
data("admixed")
fit <- ggmix(x = admixed$xtrain, y = admixed$ytrain,
            kinship = admixed$kin_train)
gicfit <- gic(fit)
# random effect at selected value of lambda
plot(ggmix::ranef(gicfit))
# random effects at specific values of lambda
head(ggmix::ranef(gicfit, s = c(0.1,0.2)))

sahirbhatnagar/ggmix documentation built on April 18, 2021, 3:46 p.m.