knitr::opts_chunk$set(error = TRUE)
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Linear Model

Normal linear model

library(ggplot2)
library(Lab04)

Usage

linreg_mod <- linreg(formula, data)

Arguments

----------- --------------------------------------------------------------------------------- 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.

Description

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.

Value

An object of class Linreg, with corresponding coef, coefvariance, qr_coef, estfun, summary, print, plot,residualvariance and df.

Example

Print function

linreg_mod <- linreg(Petal.Length~Sepal.Width+Sepal.Length, data=iris)
print(linreg_mod)

Summary function

linreg_mod <- linreg(Petal.Length~Sepal.Width+Sepal.Length, data=iris)
summary(linreg_mod)

lm Summary function

linreg_mod <- lm(Petal.Length~Sepal.Width+Sepal.Length, data=iris)
summary(linreg_mod)


menon1234/Lab04 documentation built on March 27, 2021, 12:50 a.m.