subsample_lm | R Documentation |
Performs k-fold resampling to estimate averaged coefficients for linear regression. The coefficients are averaged across k different subsets of the data to provide more stable estimates. For small samples (n < 100), returns a standard linear model instead.
subsample_lm(text, data, weights, k = 10)
text |
A character string or formula specifying the model to be fitted |
data |
A data frame containing the variables in the model |
weights |
Optional numeric vector of weights. If NULL, unweighted regression is performed |
k |
Integer specifying the number of resampling folds (default = 10) |
The function splits the data into k subsets, fits a linear model on k-1 subsets, and stores the coefficients. This process is repeated k times, and the final coefficients are averaged across all iterations to provide more stable estimates.
An object of class 'lm' with averaged coefficients from k-fold resampling. For small samples, returns a standard lm object.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.