Learn R Programming

kvr2 (version 0.2.0)

model_info: Get Model Information Used for Calculations

Description

Extracts the metadata and model specifications used to calculate the coefficients of determination, such as the regression type, sample size, and degrees of freedom.

Usage

model_info(x)

Value

A list containing the following components:

  • type: A string indicating the regression type ("linear" or "power").

  • has_intercept: A logical value indicating if the model includes an intercept.

  • n: The number of observations used in the model (excluding missing values).

  • k: The number of estimated parameters (including the intercept if present).

  • df_res: Residual degrees of freedom (\(n - k\)).

Arguments

x

An object of class r2_kvr2 or comp_kvr2.

Details

This function provides transparency into the calculation process of the various R-squared definitions. It is particularly useful for verifying whether a model was treated as a "power" regression (log-transformed) and how the degrees of freedom were determined for adjusted R-squared values.

See Also

r2(), comp_fit()

Examples

Run this code
df1 <- data.frame(x = 1:6, y = c(15, 37, 52, 59, 83, 92))
model <- lm(y ~ x, data = df1)
res <- r2(model)

# Check the metadata
info <- model_info(res)
info$n
info$type

Run the code above in your browser using DataLab