ols: OLS calculation with additional objects

View source: R/ols.R

olsR Documentation

OLS calculation with additional objects

Description

OLS calculation with additional objects

Usage

ols(y, x, const, Norm = NULL)

Arguments

y

A vector with the dependent variable.

x

A matrix with with regressors as columns or 0 for model without any regressors.

const

Binary variable: 1 - include a constant in the estimation, 0 - do not include a constant in the estimation.

Norm

A parameter used to correct likelihood function when it gets to close to zero in the case of high number of observations.

Value

A list with OLS objects: Coefficients, Standard errors, Marginal likelihood, R^2, Degrees of freedom, Determinant of the regressors' matrix, log(Marginal likelihood).

Examples

x1<-rnorm(10, mean = 0, sd = 1)
x2<-rnorm(10, mean = 0, sd = 2)
y<-2+x1+2*x2
x<-cbind(x1,x2)
const<-1
ols(y,x,const)

x1<-rnorm(10, mean = 0, sd = 1)
x2<-rnorm(10, mean = 0, sd = 2)
e<-rnorm(10, mean = 0, sd = 0.5)
y<-2+x1+2*x2+e
x<-cbind(x1,x2)
const<-1
ols(y,x,const)


rmsBMA documentation built on March 14, 2026, 5:06 p.m.