Description Usage Arguments Details Value Examples
main function to return result of lm()
1 2 3 4 5 6 7 8 9 10 11 |
formula |
an object of class "formula": a symbolic description of the model to be fitted. |
data |
an optional data frame, list or environment containing the variables in the model. If not found in data, the variables are taken from environment(formula) |
subset |
optional vector specifying a subset of observations to be used in the fitting process. |
weights |
this can be used to specify an a priori known component weights of predictors to be included in the fitting. This should be NULL or a numeric vector or matrix of extents matching those of the response. |
model |
logical. If TRUE the the model frame is returned. |
x |
logical. If TRUE the the model matrix is returned. |
y |
logical. If TRUE the response is returned. |
qr |
logical. If TRUE the the QR is returned. |
offset |
this can be used to specify an a priori known component to be included in the linear predictor during fitting. This should be NULL or a numeric vector or matrix of extents matching those of the response. |
you can use this function to do linear regression and return a list of results.
'linear_regression' returns a list of results containing at least the following components:
coefficients: a named vector of coefficients
residuals: the residuals, that is response minus fitted values.
fitted.values: the fitted mean values.
rank: the numeric rank of the fitted linear model.
df.residual: the residual degrees of freedom.
call: the matched call.
y: if requested, the response used.
x: if requested, the model matrix used.
model: if requested (the default), the model frame used.
offset: if not null, a n*1 matrix containing the offset values.
weights: if not null, a n*1 matrix containing the weights values.
terms: the formula of fitted model.
1 2 3 4 5 6 7 | #NOT RUN
data_range = matrix(c(0,0,0,1,1,1),3,2)
offsets_range = c(0,1)
weights_range = c(0,1)
coefficients = c(1,2,3)
data = simulate_data(10, 3, error_range = c(0,1), data_range, offsets_range, weights_range,coefficients)
model = linear_regression(V1~V2+V3+V4, data = data, weights = data$`(weights)`,offset = data$`(offsets)`)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.