lm_sampler: Sample a Linear Model

View source: R/estimators.R

lm_samplerR Documentation

Sample a Linear Model

Description

Draw samples from a fitted linear model.

Usage

lm_sampler(fits, newdata = NULL, indices = NULL, ...)

Arguments

fits

The fitted linear model model from which to draw samples.

newdata

A data.frame containing new inputs from which to sample responses. If NULL, defaults to the data used to estimate fit.

indices

The coordinates of the response from which to draw samples.

...

Additional parameters passed to lm.predict

Value

y_star A data.frame of samples y associated with the new inputs.

Examples

fit <- lm(mpg ~ hp + wt, data = mtcars)
lm_sampler(list(f = fit))

plm <- parallelize(lm)
fit <- plm(mpg + disp ~ hp + wt, data = mtcars)
lm_sampler(fit)

multimedia documentation built on Sept. 30, 2024, 9:28 a.m.