linreg-class: Linear Regression

Description Fields Methods Examples

Description

You can have Reference Class containing some calculations by giving formula and data.

Fields

formula

Formula

data

A data frame

Methods

coef()

This function returns regression coefficients

plot()

This function plots two graphs, such as Fitted values vs Residuals and Scale Location by using given formula and data in initialization.

pred()

This function returns fitted value.

print()

This function prints regression coefficients by using given formula and data in initialization.

resid()

This function returns residuals value.

summary()

This function prints the coefficients with their standard error, t-value and p-value.

Examples

1
2
3
4
5
6
7
data(iris)
linreg$new(Petal.Length~Sepal.Width+Sepal.Length, data=iris)$print()
linreg$new(Petal.Length~Sepal.Width+Sepal.Length, data=iris)$pred()
linreg$new(Petal.Length~Sepal.Width+Sepal.Length, data=iris)$summary()
linreg$new(Petal.Length~Sepal.Width+Sepal.Length, data=iris)$resid()
linreg$new(Petal.Length~Sepal.Width+Sepal.Length, data=iris)$coef()
linreg$new(Petal.Length~Sepal.Width+Sepal.Length, data=iris)$plot()

ugurcanlacin/Lab7 documentation built on May 24, 2019, 7:26 p.m.