bolker_ci: Confidence and prediction intervals from lme objects

View source: R/bolker_ci.R

bolker_ciR Documentation

Confidence and prediction intervals from lme objects

Description

This function takes a mixed effect model (lme object) and a new dataframe as input and creates predictions, confidence intervals and prediction intervals using the method described by Ben Bolker.

Usage

bolker_ci(model, newdat, pred_int = FALSE, conf_level = 0.95)

Arguments

model

The lme-model used for prediction.

newdat

The data.frame to use for prediction.

pred_int

Calculate prediction intervals (logical).

conf_level

Confidence level for the calculation of both intervals.

Value

A datafame which has predictions, standarderrors, confidence and. prediction intervals

Examples

# depends on an lme object from the nlme-package
m <- nlme::lme(mpg ~ disp + hp, random = ~1|cyl, data = mtcars)

# create new data.frame
new <- data.frame(disp = c(160, 170), hp = c(90, 100))
bolker_ci(m, new)

bsurial/bernr documentation built on Nov. 7, 2022, 1:41 a.m.