Description

lab4 group 26.

Import

    library(lab4g26)

Methods

To start with, we can use the initialize method to input formula and data

example <- linreg(formula = Petal.Length~Species, data = iris)

The print() method can print out the coefficients and coefficient names.

example$print()

The plot() method can plot the following two plots using such packages as ggplot2, gird and gridExtra.

example$plot()

The resid() method can return the vector of residuals.

head(example$resid())

The pred() method can return the predicted values.

head(example$pred())

The coef() method can return the coefficients as a named vector.

example$coef()

The summary() method can present the coefficients with their standard error, t-value and p-value as well as the estimate of ˆσ and the degrees of freedom in linear regression model.

example$summary()


mubarak27/lab4g26 documentation built on Nov. 5, 2019, 2:54 p.m.