knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(Lab04)

What is this package?

This is a linear regression package to solve linear regression models

linreg class

Class takes linear equation and data structure, calculates regression coefficients, fitted values, residuals, degrees of freedom, residual variance, variance of the regression coefficients, t-values and p-values.

Methods

  1. print()

prints formula, name of data frame and regression coeficients:

Example:

temp <- linreg(Petal.Length~Sepal.Width+Sepal.Length, data=iris)
temp$print()
  1. plot()

plots residuals vs Fitted values plot and Scale - Location plot

Example:

temp <- linreg(Petal.Length~Sepal.Width+Sepal.Length, data=iris)
temp$plot()
  1. resid()

returns vector of residuals

Example:

temp <- linreg(Petal.Length~Sepal.Width+Sepal.Length, data=iris)
temp$resid()
  1. pred()

returns the predicted values

Example:

temp <- linreg(Petal.Length~Sepal.Width+Sepal.Length, data=iris)
temp$pred()
  1. coef()

returns coefficients as a named vector

Example:

temp <- linreg(Petal.Length~Sepal.Width+Sepal.Length, data=iris)
temp$coef()
  1. summary()

returns the summary of linear regression model

Example:

temp <- linreg(Petal.Length~Sepal.Width+Sepal.Length, data=iris)
temp$summary()


martynas2514/Lab04 documentation built on Sept. 23, 2020, 8:52 p.m.