Learn R Programming

msme (version 0.5.3)

ml_g: Function to fit linear regression using maximum likelihood.

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

ml_g(formula, data)

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.

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.

Details

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

References

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

See Also

lm

Examples

Run this code
# NOT RUN {
data(ufc)
ufc <- na.omit(ufc)

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

summary(ufc.g.reg)

# }

Run the code above in your browser using DataLab