estimate_extraction: Extract estimates/statistics from a model

estimate_extractionR Documentation

Extract estimates/statistics from a model

Description

This collection of functions is useful for extracting estimates and statistics from a fitted model. They are particularly useful when estimating many models, like when bootstrapping confidence intervals. Each function can be used with an already fitted model as an lm object, or a formula and associated data can be passed to it. All of these assume the comparison is the empty model.

Usage

b0(object, data = NULL)

b1(object, data = NULL)

b(object, data = NULL, all = FALSE, predictor = character())

f(object, data = NULL, all = FALSE, predictor = character(), type = 3)

pre(object, data = NULL, all = FALSE, predictor = character(), type = 3)

p(object, data = NULL, all = FALSE, predictor = character(), type = 3)

fVal(object, data = NULL, all = FALSE, predictor = character(), type = 3)

PRE(object, data = NULL, all = FALSE, predictor = character(), type = 3)

Arguments

object

A lm object, or formula.

data

If object is a formula, the data to fit the formula to as a data.frame.

all

If TRUE, return a named list of all related terms (e.g. all F-values).The name for the full model value is the name of the function (e.g. "f"), and the names for the constituent terms are the term names prefixed by the function name (e.g. "f_a:b" for the F-value of the a:b interaction term).

predictor

Filter the output down to just the statistics for these terms (e.g. "hp" to just get the statistics for that term in the model). This argument is flexible: you can pass a character vector of terms (c("hp", "hp:cyl")), a one-sided formula (~hp), or a list of formulae (c(~hp, ~hp:cyl)).

type

The type of sums of squares to calculate (see generate_models()). Defaults to the widely used Type III SS.

Details

  • b0: The intercept from the full model.

  • b1: The slope b1 from the full model.

  • b: The coefficients from the full model.

  • f: The F value from the full model.

  • pre: The Proportional Reduction in Error for the full model.

  • p: The p-value from the full model.

  • sse: The SS Error (SS Residual) from the model.

  • ssm: The SS Model (SS Regression) for the full model.

  • ssr: Alias for SSM.

Value

The value of the estimate as a single number.

References

Judd, C. M., McClelland, G. H., & Ryan, C. S. (2017). Data Analysis: A Model Comparison Approach to Regression, ANOVA, and Beyond (3rd ed.). New York: Routledge. ISBN:879-1138819832

Examples

supernova(lm(mpg ~ disp, data = mtcars))

change_p_decimals <- supernova(lm(mpg ~ disp, data = mtcars))
print(change_p_decimals, pcut = 8)

coursekata documentation built on Sept. 11, 2024, 8:42 p.m.