knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(lab4Rpackage)
In order to fit a model, use the linereg()
. The function has two arguments: formula
and data
. The function linereg()
returns a linreg object.
data(iris) obj <- linreg(formula = Petal.Length~Species, data = iris)
Print()
will return the function call as well as the estimated $\beta$-coefficients in the model.
print(obj)
coef()
will return $\beta$-coefficients in the model.
coef(obj)
plot()
returns two scatter plots. The first one shows the residual against fitted values. The second scatter plot shows square root of the absolute value of the standardized residuals against the fitted values.
plot(obj)
pred()
returns the fitted values in the estimated model.
head(pred(obj),10)
resid()
returns the residuals in the estimated model.
head(resid(obj))
summary()
returns summary statistics about the estimated coefficient such as estimated parameters, the estimated standard error, t-value and p-value. It also returns the variance in the estimated model and the degree of freedom.
summary(obj)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.