Description Usage Arguments Value Examples
linear_model function is used to fit numeric linear models. It can be seen as a basic version of lm() function.
1 | linear_model(formula, data, digit = 3, detailed = FALSE)
|
formula |
regression formula of interests; an object of class "formula" (or one that can be coerced to that class). The formula should only contain numeric variables. |
data |
data used for regression model; an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. |
digit |
digit precision of output (except p-value); an optional int value. The default value in this function is 3. |
detailed |
whether the function output a detailed table; a optional boolean that indicates whether output the relevant detailed table. The default value of "detailed" is FALSE. |
linear_model() will return the fitted model's information
It returns a list containing at least the following components:
the matched call.
a named vector of coefficients.
If the option "detailed = TRUE", it would also return:
the table showing the whether the coefficients are significant.
the degree of freedom of the model.
the R squared.
the adjusted R squared.
the F statistic of the model.
the P value of the model.
1 2 3 4 5 | x = c(1,2,5,7,1,4)
y = c(3,4,7,1,8,8)
linear_model(y~x, detailed = TRUE)
linear_model(y~x + I(x^2), digit = 3, detailed = FALSE)
linear_model(Petal.Length~Sepal.Width, data = iris, digit = 3, detailed = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.