| ols | R Documentation |
OLS calculation with additional objects
ols(y, x, const, Norm = NULL)
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. |
A list with OLS objects: Coefficients, Standard errors, Marginal likelihood, R^2, Degrees of freedom, Determinant of the regressors' matrix, log(Marginal likelihood).
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.