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 object

linreg is used to fit the linear regression model and return a named list of class "linreg".

library(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)


Sidryd/lab4sidjac documentation built on Oct. 17, 2020, 11:05 p.m.