knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(Lab04)
This is a linear regression package to solve linear regression models
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.
prints formula, name of data frame and regression coeficients:
Example:
temp <- linreg(Petal.Length~Sepal.Width+Sepal.Length, data=iris) temp$print()
plots residuals vs Fitted values plot and Scale - Location plot
Example:
temp <- linreg(Petal.Length~Sepal.Width+Sepal.Length, data=iris) temp$plot()
returns vector of residuals
Example:
temp <- linreg(Petal.Length~Sepal.Width+Sepal.Length, data=iris) temp$resid()
returns the predicted values
Example:
temp <- linreg(Petal.Length~Sepal.Width+Sepal.Length, data=iris) temp$pred()
returns coefficients as a named vector
Example:
temp <- linreg(Petal.Length~Sepal.Width+Sepal.Length, data=iris) temp$coef()
returns the summary of linear regression model
Example:
temp <- linreg(Petal.Length~Sepal.Width+Sepal.Length, data=iris) temp$summary()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.