Description Usage Arguments Details Value Note References See Also Examples
The 'linreg' function allows for the linear regression of a dependent variable on a set of independent variables, and thereafter, views of regression coefficients, residuals, and other statistics
1 |
formula |
an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given under ‘Details’. |
data |
a data frame containing the variables in the model |
qr_method |
a boolean; TRUE forces linreg to use QR decomposition for the regression |
... |
additional arguments to be passed to the |
Models for linreg
are specified symbolically. A typical model has the form response ~ terms
or
response ~ .
, where 'response' is the (numeric) response vector. In the former form, 'terms' is a series
of terms which specifies a linear predictor for response. In the latter form, the '.' indicates that all available
predictors must be taken into account for modelling. Term specification of the form first + second
indicates all the terms in first together with all the terms in second with duplicate terms removed.
Specifications of the form first:second
or first*second
are recognised exactly the same way as
first+second
. Additional arguments passed via ..., if provided, will force the linear model will
have no intercept.
the function returns an object of class "linreg", which has a number of associated
methods including print.linreg
,
pred.linreg
, plot.linreg
,
resid.linreg
, summary.linreg
,
and coef.linreg
.
The "linreg" object itself is a list containing at least the following components:
call |
the matched call |
coefficients |
a named vector of coefficients |
fitted_values |
the fitted mean values |
residuals |
the residuals, that is response minus fitted values |
df |
the residual degrees of freedom |
residual_variance |
estimated value of the variance of the residuals |
t_values |
t-statistics of the independent variables, that is coefficients/standard-error |
p_values |
p-values for the two-sided t-test with null that coefficients are each zero |
The 'linreg' function was designed to work just as the 'lm' function in the 'stats' package. The 'linreg' function documentation, therefore, also draws upon the 'lm' function documentation. Review the 'See Also' section.
Linear Regression QR decomposition of a Matrix Linear Regression with QR decomposition
1 2 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.