ols: Ordinary Least Square Estimators

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

ols can be used to calculate the values of Ordinary Least Square Estimated values and corresponding scaler Mean Square Error (MSE) value.

Usage

1

Arguments

formula

in this section interested model should be given. This should be given as a formula.

data

an optional data frame, list or environment containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which the function is called.

na.action

if the dataset contain NA values, then na.action indicate what should happen to those NA values.

...

currently disregarded.

Details

Since formula has an implied intercept term, use either y ~ x - 1 or y ~ 0 + x to remove the intercept.

If there is any dependence present among the independent variables (multicollinearity) then it will be indicated as a warning massage. In case of multicollinearity Ordinary Least Square Estimators are not the best estimators.

Value

ols returns the Ordinary Least Square Estimated values, standard error values, t statistic values,p value and corresponding scalar MSE value. In addition if the dataset contains multicollinearity then it will be indicated as a warning massage.

Author(s)

P.Wijekoon, A.Dissanayake

References

Nagler, J. (Updated 2011) Notes on Ordinary Least Square Estimators.

See Also

checkm

Examples

1
2
3
## Portland cement data set is used.
data(pcd)
ols(Y~X1+X2+X3+X4-1,data=pcd)    # Model without the intercept is considered.

Example output

$`*****Ordinary Least Square Estimator******`
   Estimate Standard_error t_statistic p_value
X1   2.1930         0.1853     11.8367   0.000
X2   1.1533         0.0479     24.0565   0.000
X3   0.7585         0.1595      4.7551   0.001
X4   0.4863         0.0414     11.7443   0.000

$`*****Mean square error value*****`
   MSE 
0.0638 

Warning message:
In ols(Y ~ X1 + X2 + X3 + X4 - 1, data = pcd) :
  There is a multicollinearity

lrmest documentation built on May 1, 2019, 6:29 p.m.

Related to ols in lrmest...