av.lm {avlm}R Documentation

Convert a Linear Model (lm) Object to Anytime-Valid lm (avlm)

Description

Converts an lm object into an anytime-valid version by storing a precision parameter g as an attribute and updating the object's class. The resulting object supports anytime-valid inference.

Usage

## S3 method for class 'lm'
av(model, g = 1, vcov_estimator = NULL, ...)

Arguments

model

An lm object from a linear model fit.

g

An integer precision parameter for anytime-valid inference. Default is 1.

vcov_estimator

Optional character string specifying the type of robust standard errors to use. Must be one of "HC0", "HC1", "HC2", or "HC3". If NULL (default), no robust variance estimation is applied.

...

Additional arguments passed to or from other methods.

Value

An enhanced lm object of class avlm with anytime-valid inference capabilities.

Examples

# Fit a linear model on the built-in mtcars dataset
fit <- lm(mpg ~ wt + hp, data = mtcars)

# Convert the standard lm object to an anytime-valid avlm object
av_fit <- av(fit, g = 1)

# Print the summary of the anytime-valid model
summary(av_fit)


[Package avlm version 0.1.0 Index]