knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
This vignette shows the functionality of functions within the linreg package. The functions are S3-objects and the practical example is based on the data set iris from R base.
linreg is used to fit the linear regression model and return a named list of class "linreg".
call_arg return the arguments used to perform the linear regressiony a vector with the response variable data usedX the dependent variables expressed with model.matrixbeta_hat a one column matrix with the coefficientssigma_2_hat the residual variance in a 1x1 matrixy_hat a one column matrix with the fitted valuese_hat a one column matrix with the residualsvar_beta_hat the covariance matrix for the coefficientst_beta a matrix with t-values for each coefficientp_value a matrix with p-values for each coefficientdata return the data.frame stated in the argument datalibrary(lab4sidjac) object <- linreg(formula = Petal.Length ~ Sepal.Length + Sepal.Width, data = iris)
print prints the formula and the coefficients from a linreg object.
print(object)
summary returns a summary for each variable in the linreg object that includes Estimate, Std.Error, t.value and p.value together with significance codes. Also returns the Residual standard error and Degrees of freedom for the linreg object.
summary(object)
coef return coefficients for the linreg object.
coef(object)
resid return residuals from the linreg object. The first six residuals are printed using head.
head(resid(object))
pred return a named vector with predictions. The first six prediction are printed using head.
head(pred(object))
plot return two ggplot objects: Residuals vs Fitted and Scale-Location. The theme used is theme_liu()
plot(object)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.