hnlmix {repeated} | R Documentation |
Generalized Nonlinear Regression using h-likelihood for a Random Parameter
Description
hnlmix
fits user-specified nonlinear regression equations to one or
both parameters of the common one and two parameter distributions. One
parameter of the location regression is random with some specified mixing
distribution.
Usage
hnlmix(
y = NULL,
distribution = "normal",
mixture = "normal",
random = NULL,
nest = NULL,
mu = NULL,
shape = NULL,
linear = NULL,
pmu = NULL,
pshape = NULL,
pmix = NULL,
prandom = NULL,
delta = 1,
common = FALSE,
envir = parent.frame(),
print.level = 0,
typsize = abs(p),
ndigit = 10,
gradtol = 1e-05,
stepmax = 10 * sqrt(p %*% p),
steptol = 1e-05,
iterlim = 100,
fscale = 1,
eps = 1e-04,
points = 5
)
Arguments
y |
A response vector of uncensored data, a two column matrix for
binomial data or censored data, with the second column being the censoring
indicator (1: uncensored, 0: right censored, -1: left censored), or an
object of class, |
distribution |
The distribution for the response: binomial, beta binomial, double binomial, mult(iplicative) binomial, Poisson, negative binomial, double Poisson, mult(iplicative) Poisson, gamma count, Consul generalized Poisson, logarithmic series, geometric, normal, inverse Gauss, logistic, exponential, gamma, Weibull, extreme value, Cauchy, Pareto, Laplace, Levy, beta, simplex, or two-sided power. (For definitions of distributions, see the corresponding [dpqr]distribution help.) |
mixture |
The mixing distribution for the random parameter (whose
initial values are supplied in |
random |
The name of the random parameter in the |
nest |
The cluster variable classifying observations by the unit upon
which they were observed. Ignored if |
mu |
A user-specified formula containing named unknown parameters,
giving the regression equation for the location parameter. This may contain
the keyword, |
shape |
A user-specified formula containing named unknown parameters,
giving the regression equation for the shape parameter. This may contain
the keyword, |
linear |
A formula beginning with ~ in W&R notation, specifying the linear part of the regression function for the location parameter or list of two such expressions for the location and/or shape parameters. |
pmu |
Vector of initial estimates for the location parameters. These must be supplied either in their order of appearance in the formula or in a named list. |
pshape |
Vector of initial estimates for the shape parameters. These must be supplied either in their order of appearance in the expression or in a named list. |
pmix |
If NULL, this parameter is estimated from the variances. If a value is given, it is taken as fixed. |
prandom |
Either one estimate of the random effects or one for each
cluster (see |
delta |
Scalar or vector giving the unit of measurement (always one
for discrete data) for each response value, set to unity by default. For
example, if a response is measured to two decimals, |
common |
If TRUE, the formulae with unknowns for the location and
shape have names in common. All parameter estimates must be supplied in
|
envir |
Environment in which model formulae are to be interpreted or a
data object of class, |
print.level |
Arguments for nlm. |
typsize |
Arguments for nlm. |
ndigit |
Arguments for nlm. |
gradtol |
Arguments for nlm. |
stepmax |
Arguments for nlm. |
steptol |
Arguments for nlm. |
iterlim |
Arguments for nlm. |
fscale |
Arguments for nlm. |
eps |
Arguments for nlm. |
points |
Arguments for nlm. |
Details
It is recommended that initial estimates for pmu
and pshape
be obtained from gnlr
.
These nonlinear regression models must be supplied as formulae where
parameters are unknowns. (See finterp
.)
Value
A list of class hnlmix
is returned that contains all of the
relevant information calculated, including error codes.
The two variances and shrinkage estimates of the random effects are provided.
Author(s)
J.K. Lindsey
Examples
dose <- c(9,12,4,9,11,10,2,11,12,9,9,9,4,9,11,9,14,7,9,8)
#y <- rgamma(20,2+0.3*dose,scale=2)+rep(rnorm(4,0,4),rep(5,4))
y <- c(8.674419, 11.506066, 11.386742, 27.414532, 12.135699, 4.359469,
1.900681, 17.425948, 4.503345, 2.691792, 5.731100, 10.534971,
11.220260, 6.968932, 4.094357, 16.393806, 14.656584, 8.786133,
20.972267, 17.178012)
resp <- restovec(matrix(y, nrow=4, byrow=TRUE), name="y")
reps <- rmna(resp, tvcov=tvctomat(matrix(dose, nrow=4, byrow=TRUE), name="dose"))
# same linear normal model with random normal intercept fitted four ways
# compare with growth::elliptic(reps, model=~dose, preg=c(0,0.6), pre=4)
glmm(y~dose, nest=individuals, data=reps)
gnlmm(reps, mu=~dose, pmu=c(8.7,0.25), psh=3.5, psd=3)
hnlmix(reps, mu=~a+b*dose+rand, random="rand", pmu=c(8.7,0.25),
pshape=3.44, prandom=0)
# gamma model with log link and random normal intercept fitted three ways
glmm(y~dose, family=Gamma(link=log), nest=individuals, data=reps, points=8)
gnlmm(reps, distribution="gamma", mu=~exp(a+b*dose), pmu=c(2,0.03),
psh=1, psd=0.3)
hnlmix(reps, distribution="gamma", mu=~exp(a+b*dose+rand), random="rand",
pmu=c(2,0.04), pshape=1, prandom=0)
# gamma model with log link and random gamma mixtures
hnlmix(reps, distribution="gamma", mixture="gamma",
mu=~exp(a*rand+b*dose), random="rand", pmu=c(2,0.04),
pshape=1.24, prandom=1)
hnlmix(reps, distribution="gamma", mixture="gamma",
mu=~exp(a+b*dose)*rand, random="rand", pmu=c(2,0.04),
pshape=1.24, prandom=1)