knitr::opts_chunk$set(error = TRUE)
knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
Normal linear model
library(ggplot2) library(Lab04)
linreg_mod <- linreg(formula, data)
----------- ---------------------------------------------------------------------------------
formula an object of class "formula":
a symbolic description of the model structure to be fitted. The details of model specification are given under tram and in the package vignette.
data an optional data frame, list or environment (or object coercible by as.data.frame
to a data frame) containing the variables in the model.
A Simple Linear model of a data frame.It estimates the regression coefficients of the given formula and also the residuals, degrees of freedom , the residual variance and the variance of the regression coefficients using the using the QR decomposition method.
The function returns an object of class s3 called linreg.
An object of class Linreg
, with corresponding coef
, coefvariance
, qr_coef
, estfun
, summary
, print
, plot
,residualvariance
and df
.
linreg_mod <- linreg(Petal.Length~Sepal.Width+Sepal.Length, data=iris) print(linreg_mod)
linreg_mod <- linreg(Petal.Length~Sepal.Width+Sepal.Length, data=iris) summary(linreg_mod)
linreg_mod <- lm(Petal.Length~Sepal.Width+Sepal.Length, data=iris) summary(linreg_mod)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.