lm_coefficients | R Documentation |
This function fits a linear regression model using the given data and formula, and returns the coefficients.
lm_coefficients(data, formula, standardize = FALSE, each = TRUE)
data |
A data frame containing the response variable and predictors. |
formula |
A formula specifying the structure of the linear regression model. |
standardize |
Whether to standardize the data before fitting the model. |
each |
each variable do a lm or whole multi-lm |
coefficients The coefficients of the linear regression model.
data <- data.frame(
response = c(2, 4, 6, 7, 9),
x1 = c(1, 2, 3, 4, 5),
x2 = c(2, 3, 6, 8, 9),
x3 = c(3, 6, 5, 12, 12)
)
coefficients_df <- lm_coefficients(data, response ~ x1 + x2 + x3)
print(coefficients_df)
plot(coefficients_df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.