statmod (version 1.0.1)

mlreg: Fit a Linear Model by Maximum Likelihood

Description

Fits a linear model by maximum likelihood assuming a variety of response distributions.

Usage

mlreg.fit(X, y, weights=NULL, dist="logistic", init=NULL, scale=NULL)
mlreg.fit.zero(y, weights=NULL, dist="logistic", init=NULL, scale=NULL)

Arguments

X
the design matrix. Rows containing missing values (in X or y) will be removed.
y
numeric response vector. Missing values will be removed.
weights
vector of non-negative weights.
dist
character string giving the name of the response distribution. The possibilities are "extreme", "logistic", "gaussian", "weibull", "exponential", "rayleigh", "loggauss
init
numeric vector of initial values for the parameters.
scale
if specified then the scale parameter is fixed at the given value.

Value

  • See the documentation for survreg.object

Details

This function is merely a convenient wrapper for calling the survreg.fit function, which is part of the survival library by Terry Therneau. It fits the model y = X*b + scale*e where b is the vector of regression coefficients and e is a vector of mean-zero errors, by maximum likelihood. The function mlreg.fit.zero assumes that the mean is zero and fits y = scale*e, estimating only the scale parameter.

See Also

survreg, survreg.object

Examples

Run this code
x <- 1:50
y <- x + 2*rnorm(50)
X <- cbind(1,x)
out <- mlreg.fit(X,y,dist="logistic")

Run the code above in your browser using DataCamp Workspace