Description Usage Arguments Details Value Author(s) Examples
gnlrim
fits userspecified 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.
1 2 3 4 5 6 7 8 9 10 11 12  gnlrim(y = NULL, distribution = "normal", mixture = "normalvar",
random = NULL, nest = NULL, mu = NULL, shape = NULL,
linear = NULL, pmu = NULL, pshape = NULL, pmix = NULL,
delta = 1, common = FALSE, envir = parent.frame(),
print.level = 0, typsize = abs(p), ndigit = 10, gradtol = 1e05,
stepmax = 10 * sqrt(p %*% p), steptol = 1e05, iterlim = 100,
compute_hessian = TRUE, compute_kkt = TRUE, fscale = 1,
eps = 1e04, trace = 0, maxfun.bobyqa = 10000, npt.bobyqa = min(p
* 2, p + 2), abs.tol.nlminb = 1e20, xf.tol.nlminb = 2.2e14,
x.tol.nlminb = 1.5e08, rel.tol.nlminb = 1e10, method = "nlminb",
ooo = FALSE, p_lowb = Inf, p_uppb = Inf, points = 5,
steps = 10)

y 
A response vector of uncensored data, a two column matrix for
binomial data, or an object of class, 
distribution 
The distribution for the response: binomial, beta
binomial,
(removed: double binomial, use 
mixture 
The mixing distribution for the random parameter: logitbridgevar, logitbridgephi, normalvar (default), normalphi, Cauchyscl, Cauchyphi, stabledistsubgaussscl, stabledistsubgaussphi, libstableRsubgaussscl, libstableRsubgaussphi, logistic, Laplace, inverse Gauss, gamma, inverse gamma, Weibull, beta, simplex, or twosided power. The first twelve have zero location parameter, the next three have unit location parameter, and the last two have location parameter set to 0.5. 
random 
The name of the random parameter in the 
nest 
The variable classifying observations by the unit upon which
they were observed. Ignored if 
mu 
A userspecified formula containing named unknown parameters,
giving the regression equation for the location parameter. This may contain
the keyword, 
shape 
A userspecified 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 in their order of appearance in the formula as 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 
Initial estimate for the untransformed (not logarithm)
of the dispersion parameter of the mixing distribution. For

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 optimx (itnmax). 
compute_hessian 
Argument (logical) 
compute_kkt 
Argument (logical) 
fscale 
Arguments for nlm. 
eps 
Precision of the Romberg integration. 
trace 
Arguments for nlminb. 
maxfun.bobyqa 
Argument for bobyqa 
npt.bobyqa 
Argument for bobyqa 
abs.tol.nlminb 
Argument for nlminb. Default 1e20 assumes known nonnegative function. Set to 0 if you don't know if function is nonnegative. 
xf.tol.nlminb 
Argument for nlminb. Default is 2.2e14 
x.tol.nlminb 
Argument for nlminb. Default is 1.5e8 
rel.tol.nlminb 
Argument for nlminb. Default is 1e10 
method 
Arguments for optimx – a string denoting which
optimization to use. Accommodate vector of strings, however
traditional 
ooo 
*o*ptimx *o*utput *o*nly. Default is FALSE, which
means that the traditional 
p_lowb 
Argument to nlminb / optimx for the 
p_uppb 
Argument to nlminb / optimx for the 
points 
For the Romberg integration, the number of extrapolation points so that 2*points is the order of integration, by default set to 5; points=2 is Simpson's rule. 
steps 
For the Romberg integration, the maximum number of steps, by default set to 10. 
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
.)
If ooo=TRUE
, A list of class gnlm
is
returned that contains all of the relevant information
calculated, including error codes. If ooo=FALSE
, then
just the optimx output.
Bruce Swihart and J.K. Lindsey
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44  dose < c(9,12,4,9,11,10,2,11,12,9,9,9,4,9,11,9,14,7,9,8)
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)
id < rep(1:4, each=5)
gnlrim(y, mu=~a+b*dose+rand, random="rand", nest=id, pmu=c(a=8.7,b=0.25),
pshape=3.44, pmix=2.3)
## Not run:
## from repeated::gnlmix
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,shape=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)
gnlmix(reps, mu=~a+b*dose+rand, random="rand", pmu=c(8.7,0.25),
pshape=3.44, pmix=2.3)
# 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)
gnlmix(reps, distribution="gamma", mu=~exp(a+b*dose+rand), random="rand",
pmu=c(2,0.04), pshape=1, pmix=2)
# gamma model with log link and random gamma mixtures
gnlmix(reps, distribution="gamma", mixture="gamma",
mu=~exp(a*rand+b*dose), random="rand", pmu=c(2,0.04),
pshape=1.24, pmix=3.5)
gnlmix(reps, distribution="gamma", mixture="gamma",
mu=~exp(a+b*dose)*rand, random="rand", pmu=c(2,0.04),
pshape=1.24, pmix=2.5)
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.