lab4 group 26.
library(lab4g26)
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()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.