my.lm: my.lm

Description Usage Arguments Value Examples

View source: R/my.lm.R

Description

Fits a linear regression model using OLS or WLS

Usage

1

Arguments

formula

formula specifying the regression equation

data

n x p data.frame to be used to fit the model

weights

optional length n numeric vector to be used in a WLS regression

Value

A list containing regression results

Examples

1
2
3
4
5
6
7
8
9
get(data(mtcars))

#OLS
my.fit = my.lm(mpg ~ cyl, data = mtcars)
my.fit$coefficients

#WLS
my.fit2 = my.lm(mpg ~ cyl, data = mtcars, weights = 1:32)
my.fit2$coefficients

srhaup2/my.lm documentation built on Dec. 23, 2021, 4:30 a.m.