gnm | R Documentation |
gnm
is used to fit generalized nonlinear models, specified by giving a symbolic description of the "linear" predictor
and a description of the error distribution.
gnm(
formula,
family = gaussian(),
offset = NULL,
weights = NULL,
data,
subset = NULL,
start = NULL,
toler = 1e-05,
maxit = 50,
trace = FALSE,
...
)
formula |
a |
family |
a description of the error distribution and link function to be used in the model. For |
offset |
this can be used to specify an a priori known component to be included in the linear predictor during fitting. This should be |
weights |
an (optional) vector of "prior weights" to be used in the fitting process. The length of |
data |
an (optional) data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model.
If not found in data, the variables are taken from |
subset |
an (optional) vector specifying a subset of observations to be used in the fitting process. |
start |
an (optional) vector of starting values for the parameters in the "linear" predictor. |
toler |
an (optional) positive value which represents the convergence tolerance. The convergence is reached when the maximum of the absolute relative
differences between the values of the parameters in the "linear" predictor in consecutive iterations of the fitting algorithm is lower than |
maxit |
an (optional) integer value which represents the maximum number of iterations allowed for the fitting algorithm. As default, |
trace |
an (optional) logical variable. If |
... |
further arguments passed to or from other methods. |
A set of standard extractor functions for fitted model objects is available for objects of class gnm,
including methods to the generic functions such as summary
, model.matrix
, estequa
,
coef
, vcov
, logLik
, fitted
, confint
, AIC
, BIC
and predict
.
In addition, the model fitted to the data may be assessed using functions such as adjR2.gnm
, anova.gnm,
residuals.gnm, dfbeta.gnm, cooks.distance.gnm, localInfluence.gnm and envelope.gnm.
an object of class gnm in which the main results of the model fitted to the data are stored, i.e., a list with components including
coefficients | a vector containing the parameter estimates, |
fitted.values | a vector containing the estimates of \mu_1,\ldots,\mu_n , |
start | a vector containing the starting values used, |
prior.weights | a vector containing the case weights used, |
offset | a vector containing the offset used, |
terms | an object containing the terms objects, |
loglik | the value of the log-likelihood function avaliated at the parameter estimates, |
estfun | a vector containing the estimating functions evaluated at the parameter estimates |
and the observed data, | |
formula | the formula, |
converged | a logical indicating successful convergence, |
model | the full model frame, |
y | the response vector, |
family | an object containing the family object used, |
linear.predictors | a vector containing the estimates of g(\mu_1),\ldots,g(\mu_n) , |
R | a matrix with unscaled estimate of the variance-covariance |
matrix of model parameters, | |
call | the original function call. |
glm, glmgee, gnmgee
###### Example 1: The effects of fertilizers on coastal Bermuda grass
data(Grass)
fit1 <- gnm(Yield ~ b0 + b1/(Nitrogen + a1) + b2/(Phosphorus + a2) + b3/(Potassium + a3),
family=gaussian(inverse), start=c(b0=0.1,b1=13,b2=1,b3=1,a1=45,a2=15,a3=30), data=Grass)
summary(fit1)
###### Example 2: Assay of an Insecticide with a Synergist
data(Melanopus)
fit2 <- gnm(Killed/Exposed ~ b0 + b1*log(Insecticide-a1) + b2*Synergist/(a2 + Synergist),
family=binomial(logit), weights=Exposed, start=c(b0=-3,b1=1.2,a1=1.7,b2=1.7,a2=2),
data=Melanopus)
summary(fit2)
###### Example 3: Developmental rate of Drosophila melanogaster
data(Drosophila)
fit3 <- gnm(Duration ~ b0 + b1*Temp + b2/(Temp-a), family=Gamma(log),
start=c(b0=3,b1=-0.25,b2=-210,a=55), weights=Size, data=Drosophila)
summary(fit3)
###### Example 4: Radioimmunological Assay of Cortisol
data(Cortisol)
fit4 <- gnm(Y ~ b0 + (b1-b0)/(1 + exp(b2+ b3*lDose))^b4, family=Gamma(identity),
start=c(b0=130,b1=2800,b2=3,b3=3,b4=0.5), data=Cortisol)
summary(fit4)
###### Example 5: Age and Eye Lens Weight of Rabbits in Australia
data(rabbits)
fit5 <- gnm(wlens ~ b1 - b2/(age + b3), family=Gamma(log),
start=c(b1=5.5,b2=130,b3=35), data=rabbits)
summary(fit5)
###### Example 6: Calls to a technical support help line
data(calls)
fit6 <- gnm(calls ~ SSlogis(week, Asym, xmid, scal), family=poisson(identity), data=calls)
summary(fit6)
###### Example 7: Growth of Paramecium aurelium
data(paramecium)
fit7 <- gnm(Number ~ exp(alpha - exp(beta - gamma*Days)), family=poisson(log),
start=c(alpha=1.85,beta=0.7,gamma=0.35), data=paramecium)
summary(fit7)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.