ml_g: Function to fit linear regression using maximum likelihood.

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

Description

This function demonstrates the use of maximum likelihood to fit ordinary least-squares regression models, by maximizing the likelihood as a function of the parameters. Only conditional normal errors are supported.

Usage

1

Arguments

formula

an object of class '"formula"' (or one that can be coerced to that class): a symbolic description of the model to be fitted. (See the help for 'lm' for more details).

data

a data frame containing the variables in the model.

Details

This function has limited functionality compared with R's internal lm function, which should be preferred in general.

Value

fit

the output of optim.

X

the design matrix.

y

the response variable.

call

the call used for the function.

beta.hat

the parameter estimates.

se.beta.hat

estimated standard errors of the parameter estimates.

sigma.hat

the estimated conditional standard deviation of the response variable.

Note

We use least squares to get initial estimates, which is a pretty barbaric hack. But the purpose of this function is as a starting point, not to replace existing functions.

Author(s)

Andrew Robinson and Joe Hilbe.

References

Hilbe, J.M., and Robinson, A.P. 2013. Methods of Statistical Model Estimation. Chapman \& Hall / CRC.

See Also

lm

Examples

1
2
3
4
5
6
data(ufc)
ufc <- na.omit(ufc)

ufc.g.reg <- ml_g(height.m ~ dbh.cm, data = ufc)

summary(ufc.g.reg)

msme documentation built on May 2, 2019, 5:07 a.m.

Related to ml_g in msme...