knitr::opts_chunk$set(error = TRUE) library(FancyPackRLiU4) #install.packages("ggplot2") library("png") library("grid") library("ggplot2")
linreg is a pilot RC project to carry out linear regression. Given \code{formula} and data source \code{data}, it will find the best fitted linear regression model.
formula, a suggested linear regression model
data, a data source used to train the model
guo, a list of key results from regression, including Coefficients, FittedValues, Residuals, FreedomDegree, VarianceResiduals, StdErrorResiduals, VarianceCoefficients, StdError, Tcoefficients, Possibility, X, Y, Formula, Data, VariableNames.
print() print out the coefficients and coefficient names, similar as done by the lm class
plot() plot the following two plots using ggplot2. Remember to include ggplot2 in your package
resid() return the vector of residuals
pred() return the predicted values
coef() return the coefficients as a named vector
summary() return a printout including the coefficients with their standard error, t-value and p-value as well as the standard error of residuals and the degrees of freedom in the model.
data(iris) a<-linreg$new(formula=Sepal.Length~Sepal.Width,data=iris) a$print() a$plot() a$resid() a$pred() a$coef() a$summary()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.