mlreg {statmod} | R Documentation |
Fits a linear model by maximum likelihood assuming a variety of response distributions.
mlreg.fit(X, y, weights=NULL, dist="logistic", init=NULL, scale=NULL) mlreg.fit.zero(y, weights=NULL, dist="logistic", init=NULL, scale=NULL)
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" ,
"loggaussian" , "lognormal" , "loglogistic" or "t" on 4 df. |
init |
numeric vector of initial values for the parameters. |
scale |
if specified then the scale parameter is fixed at the given value. |
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 the documentation for survreg.object
Gordon Smyth
x <- 1:50 y <- x + 2*rnorm(50) X <- cbind(1,x) out <- mlreg.fit(X,y,dist="logistic")