gnlr: Generalized Nonlinear Regression Models for One and Two...

Description Usage Arguments Details Value Author(s) See Also Examples

Description

gnlr fits user-specified nonlinear regression equations to one or both parameters of the common one and two parameter distributions. A user-specified -log likelihood can also be supplied for the distribution. Most distributions allow data to be left, right, and/or interval censored.

Usage

1
2
3
4
5
6
gnlr(y = NULL, distribution = "normal", pmu = NULL, pshape = NULL,
  mu = NULL, shape = NULL, linear = NULL, exact = FALSE, wt = 1,
  delta = 1, shfn = FALSE, 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)

Arguments

y

A response vector for 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, response (created by restovec) or repeated (created by rmna or lvna). If the repeated data object contains more than one response variable, give that object in envir and give the name of the response variable to be used here. The beta, simplex, and two-sided power distributions for proportions do not allow left or right censoring (only interval censoring).

distribution

Either a character string containing the name of the distribution or a function giving the -log likelihood. (In the latter case, all initial parameter estimates are supplied in pmu.)

Distributions are 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, and two-sided power. All but the binomial-based distributions and the beta, simplex, and two-sided power distributions may be right and/or left censored. (For definitions of distributions, see the corresponding [dpqr]distribution help.)

pmu

Vector of initial estimates for the location parameters. If mu is a formula with unknown parameters, their estimates must be supplied either in their order of appearance in the expression or in a named list. If distribution is a user-supplied -log likelihood function, all initial estimates must be supplied here.

pshape

Vector of initial estimates for the shape parameters. If shape is a formula with unknown parameters, their estimates must be supplied either in their order of appearance in the expression or in a named list.

mu

A user-specified function of pmu, and possibly linear, giving the regression equation for the location. This may contain a linear part as the second argument to the function. It may also be a formula beginning with ~, specifying either a linear regression function for the location parameter in the Wilkinson and Rogers notation or a general function with named unknown parameters. If it contains unknown parameters, the keyword linear may be used to specify a linear part. If nothing is supplied, the location is taken to be constant unless the linear argument is given.

shape

A user-specified function of pshape, and possibly linear and/or mu, giving the regression equation for the dispersion or shape parameter. This may contain a linear part as the second argument to the function and the location function as last argument (in which case shfn must be set to TRUE). It may also be a formula beginning with ~, specifying either a linear regression function for the shape parameter in the Wilkinson and Rogers notation or a general function with named unknown parameters. If it contains unknown parameters, the keyword linear may be used to specify a linear part and the keyword mu to specify a function of the location parameter. If nothing is supplied, this parameter is taken to be constant unless the linear argument is given. This parameter is the logarithm of the usual one.

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.

exact

If TRUE, fits the exact likelihood function for continuous data by integration over intervals of observation given in delta, i.e. interval censoring.

wt

Weight vector.

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, delta=0.01. If the response is transformed, this must be multiplied by the Jacobian. The transformation cannot contain unknown parameters. For example, with a log transformation, delta=1/y. (The delta values for the censored response are ignored.)

shfn

If true, the supplied shape function depends on the location (function). The name of this location function must be the last argument of the shape function.

common

If TRUE, mu and shape must both be either functions with, as argument, a vector of parameters having some or all elements in common between them so that indexing is in common between them or formulae with unknowns. All parameter estimates must be supplied in pmu. If FALSE, parameters are distinct between the two functions and indexing starts at one in each function.

envir

Environment in which model formulae are to be interpreted or a data object of class, repeated, tccov, or tvcov; the name of the response variable should be given in y. If y has class repeated, it is used as the environment.

print.level

Arguments controlling nlm.

typsize

Arguments controlling nlm.

ndigit

Arguments controlling nlm.

gradtol

Arguments controlling nlm.

stepmax

Arguments controlling nlm.

steptol

Arguments controlling nlm.

iterlim

Arguments controlling nlm.

fscale

Arguments controlling nlm.

Details

Nonlinear regression models can be supplied as formulae where parameters are unknowns in which case factor variables cannot be used and parameters must be scalars. (See finterp.)

The printed output includes the -log likelihood (not the deviance), the corresponding AIC, the maximum likelihood estimates, standard errors, and correlations.

Value

A list of class gnlm is returned that contains all of the relevant information calculated, including error codes.

Author(s)

J.K. Lindsey

See Also

finterp, fmr, glm, gnlmix, glmm, gnlmm, gnlr3, lm, nlr, nls.

Examples

 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
sex <- c(rep(0,10),rep(1,10))
sexf <- gl(2,10)
age <- c(8,10,12,12,8,7,16,7,9,11,8,9,14,12,12,11,7,7,7,12)
y <- cbind(c(9.2, 7.3,13.0, 6.9, 3.9,14.9,17.8, 4.8, 6.4, 3.3,17.2,
	14.4,17.0, 5.0,17.3, 3.8,19.4, 5.0, 2.0,19.0),
	c(0,1,0,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1))
# y <- cbind(rweibull(20,2,2+2*sex+age),rbinom(20,1,0.7))
# linear regression with inverse Gauss distribution
mu <- function(p) p[1]+p[2]*sex+p[3]*age
gnlr(y, dist="inverse Gauss", mu=mu, pmu=c(3,0,0), pshape=1)
# or equivalently
gnlr(y, dist="inverse Gauss", mu=~sexf+age, pmu=c(3,0,0), pshape=1)
# or
gnlr(y, dist="inverse Gauss", linear=~sexf+age, pmu=c(3,0,0), pshape=1)
# or
gnlr(y, dist="inverse Gauss", mu=~b0+b1*sex+b2*age,
	pmu=list(b0=3,b1=0,b2=0), pshape=1)
#
# nonlinear regression with inverse Gauss distribution
mu <- function(p, linear) exp(linear)
gnlr(y, dist="inverse Gauss", mu=mu, linear=~sexf+age, pmu=c(3,0,0),
	pshape=-1)
# or equivalently
gnlr(y, dist="inverse Gauss", mu=~exp(b0+b1*sex+b2*age),
	pmu=list(b0=3,b1=0,b2=0), pshape=-1)
# or
gnlr(y, dist="inverse Gauss", mu=~exp(linear), linear=~sexf+age,
	pmu=c(3,0,0), pshape=-1)
#
# include regression for the shape parameter with same mu function
shape <- function(p) p[1]+p[2]*sex+p[3]*age
gnlr(y, dist="inverse Gauss", mu=mu, linear=~sexf+age, shape=shape,
	pmu=c(3,0,0), pshape=c(3,0,0))
# or equivalently
gnlr(y, dist="inverse Gauss", mu=mu, linear=~sexf+age,
	shape=~sexf+age, pmu=c(3,0,0), pshape=c(3,0,0))
# or
gnlr(y, dist="inverse Gauss", mu=mu, linear=list(~sex+age,~sex+age),
	pmu=c(3,0,0),pshape=c(3,0,0))
# or
gnlr(y, dist="inverse Gauss", mu=mu, linear=~sex+age,
	shape=~c0+c1*sex+c2*age, pmu=c(3,0,0),
	pshape=list(c0=3,c1=0,c2=0))
#
# shape as a function of the location
shape <- function(p, mu) p[1]+p[2]*sex+p[3]*mu
gnlr(y, dist="inverse Gauss", mu=~age, shape=shape, pmu=c(3,0),
	pshape=c(3,0,0), shfn=TRUE)
# or
gnlr(y, dist="inverse Gauss", mu=~age, shape=~a+b*sex+c*mu, pmu=c(3,0),
	pshape=c(3,0,0), shfn=TRUE)
#
# common parameter in location and shape functions for age
mu <- function(p) exp(p[1]+p[2]*age)
shape <- function(p, mu) p[3]+p[4]*sex+p[2]*age
gnlr(y, dist="inverse Gauss", mu=mu, shape=shape, pmu=c(3,0,1,0),
	common=TRUE)
# or
gnlr(y, dist="inverse Gauss", mu=~exp(a+b*age), shape=~c+d*sex+b*age,
	pmu=c(3,0,1,0), common=TRUE)
#
# user-supplied -log likelihood function
y <- rnorm(20,2+3*sex,2)
dist <- function(p)-sum(dnorm(y,p[1]+p[2]*sex,p[3],log=TRUE))
gnlr(y, dist=dist,pmu=1:3)
dist <- ~-sum(dnorm(y,a+b*sex,v,log=TRUE))
gnlr(y, dist=dist,pmu=1:3)

Example output

Loading required package: rmutil

Attaching package: 'rmutil'

The following object is masked from 'package:stats':

    nobs

The following objects are masked from 'package:base':

    as.data.frame, units


Call:
gnlr(y, dist = "inverse Gauss", mu = mu, pmu = c(3, 0, 0), pshape = 1)

censored inverse Gauss distribution

Response: y 

Log likelihood function:
{
    m <- mu1(p)
    t <- sh1(p)
    s <- exp(t)
    -sum(wt * (cc * (-(t + (y[, 1] - m)^2/(y[, 1] * s * m^2))/2) + 
        log(lc - rc * pinvgauss(y[, 1], m, s))))
}

Location function:
p[1] + p[2] * sex + p[3] * age

Log shape function:
p[1] * rep(1, n)

-Log likelihood    54.1341 
Degrees of freedom 16 
AIC                58.1341 
Iterations         34 

Location parameters:
      estimate      se
p[1]     2.204  10.432
p[2]    -0.193   5.121
p[3]     1.072   1.165

Shape parameters:
      estimate     se
p[1]    -2.797  0.341

Correlations:
         1        2        3        4
1  1.00000 -0.33276 -0.91821 -0.04008
2 -0.33276  1.00000  0.01445 -0.16563
3 -0.91821  0.01445  1.00000  0.13327
4 -0.04008 -0.16563  0.13327  1.00000

Call:
gnlr(y, dist = "inverse Gauss", mu = ~sexf + age, pmu = c(3, 
    0, 0), pshape = 1)

censored inverse Gauss distribution

Response: y 

Log likelihood function:
{
    m <- mu1(p)
    t <- sh1(p)
    s <- exp(t)
    -sum(wt * (cc * (-(t + (y[, 1] - m)^2/(y[, 1] * s * m^2))/2) + 
        log(lc - rc * pinvgauss(y[, 1], m, s))))
}

Location function:
~sexf + age

Log shape function:
p[1] * rep(1, n)

-Log likelihood    54.1341 
Degrees of freedom 16 
AIC                58.1341 
Iterations         34 

Location parameters:
             estimate      se
(Intercept)     2.204  10.432
sexf2          -0.193   5.121
age             1.072   1.165

Shape parameters:
      estimate     se
p[1]    -2.797  0.341

Correlations:
         1        2        3        4
1  1.00000 -0.33276 -0.91821 -0.04008
2 -0.33276  1.00000  0.01445 -0.16563
3 -0.91821  0.01445  1.00000  0.13327
4 -0.04008 -0.16563  0.13327  1.00000

Call:
gnlr(y, dist = "inverse Gauss", linear = ~sexf + age, pmu = c(3, 
    0, 0), pshape = 1)

censored inverse Gauss distribution

Response: y 

Log likelihood function:
{
    m <- mu1(p)
    t <- sh1(p)
    s <- exp(t)
    -sum(wt * (cc * (-(t + (y[, 1] - m)^2/(y[, 1] * s * m^2))/2) + 
        log(lc - rc * pinvgauss(y[, 1], m, s))))
}

Location function:
~sexf + age

Log shape function:
p[1] * rep(1, n)

-Log likelihood    54.1341 
Degrees of freedom 16 
AIC                58.1341 
Iterations         34 

Location parameters:
             estimate      se
(Intercept)     2.204  10.432
sexf2          -0.193   5.121
age             1.072   1.165

Shape parameters:
      estimate     se
p[1]    -2.797  0.341

Correlations:
         1        2        3        4
1  1.00000 -0.33276 -0.91821 -0.04008
2 -0.33276  1.00000  0.01445 -0.16563
3 -0.91821  0.01445  1.00000  0.13327
4 -0.04008 -0.16563  0.13327  1.00000

Call:
gnlr(y, dist = "inverse Gauss", mu = ~b0 + b1 * sex + b2 * age, 
    pmu = list(b0 = 3, b1 = 0, b2 = 0), pshape = 1)

censored inverse Gauss distribution

Response: y 

Log likelihood function:
{
    m <- mu1(p)
    t <- sh1(p)
    s <- exp(t)
    -sum(wt * (cc * (-(t + (y[, 1] - m)^2/(y[, 1] * s * m^2))/2) + 
        log(lc - rc * pinvgauss(y[, 1], m, s))))
}

Location function:
~b0 + b1 * sex + b2 * age

Log shape function:
p[1] * rep(1, n)

-Log likelihood    54.1341 
Degrees of freedom 16 
AIC                58.1341 
Iterations         34 

Location parameters:
    estimate      se
b0     2.204  10.432
b1    -0.193   5.121
b2     1.072   1.165

Shape parameters:
      estimate     se
p[1]    -2.797  0.341

Correlations:
         1        2        3        4
1  1.00000 -0.33276 -0.91821 -0.04008
2 -0.33276  1.00000  0.01445 -0.16563
3 -0.91821  0.01445  1.00000  0.13327
4 -0.04008 -0.16563  0.13327  1.00000

Call:
gnlr(y, dist = "inverse Gauss", mu = mu, linear = ~sexf + age, 
    pmu = c(3, 0, 0), pshape = -1)

censored inverse Gauss distribution

Response: y 

Log likelihood function:
{
    m <- mu1(p)
    t <- sh1(p)
    s <- exp(t)
    -sum(wt * (cc * (-(t + (y[, 1] - m)^2/(y[, 1] * s * m^2))/2) + 
        log(lc - rc * pinvgauss(y[, 1], m, s))))
}

Location function:
exp(linear)
Linear part:
~sexf + age

Log shape function:
p[1] * rep(1, n)

-Log likelihood    54.04785 
Degrees of freedom 16 
AIC                58.04785 
Iterations         12 

Location parameters:
             estimate      se
(Intercept)   1.63332  0.8649
sexf2        -0.03960  0.4631
age           0.09204  0.0858

Shape parameters:
      estimate      se
p[1]    -2.799  0.3426

Correlations:
          1        2        3         4
1  1.000000 -0.38964 -0.90026  0.005675
2 -0.389637  1.00000  0.04022 -0.194441
3 -0.900263  0.04022  1.00000  0.112301
4  0.005675 -0.19444  0.11230  1.000000

Call:
gnlr(y, dist = "inverse Gauss", mu = ~exp(b0 + b1 * sex + b2 * 
    age), pmu = list(b0 = 3, b1 = 0, b2 = 0), pshape = -1)

censored inverse Gauss distribution

Response: y 

Log likelihood function:
{
    m <- mu1(p)
    t <- sh1(p)
    s <- exp(t)
    -sum(wt * (cc * (-(t + (y[, 1] - m)^2/(y[, 1] * s * m^2))/2) + 
        log(lc - rc * pinvgauss(y[, 1], m, s))))
}

Location function:
~exp(b0 + b1 * sex + b2 * age)

Log shape function:
p[1] * rep(1, n)

-Log likelihood    54.04785 
Degrees of freedom 16 
AIC                58.04785 
Iterations         12 

Location parameters:
    estimate      se
b0   1.63332  0.8649
b1  -0.03960  0.4631
b2   0.09204  0.0858

Shape parameters:
      estimate      se
p[1]    -2.799  0.3426

Correlations:
          1        2        3         4
1  1.000000 -0.38964 -0.90026  0.005675
2 -0.389637  1.00000  0.04022 -0.194441
3 -0.900263  0.04022  1.00000  0.112301
4  0.005675 -0.19444  0.11230  1.000000

Call:
gnlr(y, dist = "inverse Gauss", mu = ~exp(linear), linear = ~sexf + 
    age, pmu = c(3, 0, 0), pshape = -1)

censored inverse Gauss distribution

Response: y 

Log likelihood function:
{
    m <- mu1(p)
    t <- sh1(p)
    s <- exp(t)
    -sum(wt * (cc * (-(t + (y[, 1] - m)^2/(y[, 1] * s * m^2))/2) + 
        log(lc - rc * pinvgauss(y[, 1], m, s))))
}

Location function:
~exp(linear)
Linear part:
~sexf + age

Log shape function:
p[1] * rep(1, n)

-Log likelihood    54.04785 
Degrees of freedom 16 
AIC                58.04785 
Iterations         12 

Location parameters:
             estimate      se
(Intercept)   1.63332  0.8649
sexf2        -0.03960  0.4631
age           0.09204  0.0858

Shape parameters:
      estimate      se
p[1]    -2.799  0.3426

Correlations:
          1        2        3         4
1  1.000000 -0.38964 -0.90026  0.005675
2 -0.389637  1.00000  0.04022 -0.194441
3 -0.900263  0.04022  1.00000  0.112301
4  0.005675 -0.19444  0.11230  1.000000

Call:
gnlr(y, dist = "inverse Gauss", mu = mu, linear = ~sexf + age, 
    shape = shape, pmu = c(3, 0, 0), pshape = c(3, 0, 0))

censored inverse Gauss distribution

Response: y 

Log likelihood function:
{
    m <- mu1(p)
    t <- sh1(p)
    s <- exp(t)
    -sum(wt * (cc * (-(t + (y[, 1] - m)^2/(y[, 1] * s * m^2))/2) + 
        log(lc - rc * pinvgauss(y[, 1], m, s))))
}

Location function:
exp(linear)
Linear part:
~sexf + age

Log shape function:
p[1] + p[2] * sex + p[3] * age

-Log likelihood    53.29904 
Degrees of freedom 14 
AIC                59.29904 
Iterations         29 

Location parameters:
             estimate       se
(Intercept)   1.56432  0.83173
sexf2        -0.05123  0.45930
age           0.09534  0.06906

Shape parameters:
      estimate      se
p[1]  -1.01686  1.8218
p[2]   0.07446  0.7231
p[3]  -0.19480  0.1704

Correlations:
         1       2        3        4       5        6
1  1.00000 -0.4748 -0.89143  0.02607 -0.2404  0.04569
2 -0.47478  1.0000  0.11558 -0.19937  0.2960  0.09680
3 -0.89143  0.1156  1.00000  0.04066  0.1043 -0.05590
4  0.02607 -0.1994  0.04066  1.00000 -0.3955 -0.95355
5 -0.24036  0.2960  0.10432 -0.39549  1.0000  0.17413
6  0.04569  0.0968 -0.05590 -0.95355  0.1741  1.00000
Warning messages:
1: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
2: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
3: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
4: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value

Call:
gnlr(y, dist = "inverse Gauss", mu = mu, linear = ~sexf + age, 
    shape = ~sexf + age, pmu = c(3, 0, 0), pshape = c(3, 0, 0))

censored inverse Gauss distribution

Response: y 

Log likelihood function:
{
    m <- mu1(p)
    t <- sh1(p)
    s <- exp(t)
    -sum(wt * (cc * (-(t + (y[, 1] - m)^2/(y[, 1] * s * m^2))/2) + 
        log(lc - rc * pinvgauss(y[, 1], m, s))))
}

Location function:
exp(linear)
Linear part:
~sexf + age

Log shape function:
~sexf + age

-Log likelihood    53.29904 
Degrees of freedom 14 
AIC                59.29904 
Iterations         29 

Location parameters:
             estimate       se
(Intercept)   1.56432  0.83173
sexf2        -0.05123  0.45930
age           0.09534  0.06906

Shape parameters:
             estimate      se
(Intercept)  -1.01686  1.8218
sexf2         0.07446  0.7231
age          -0.19480  0.1704

Correlations:
         1       2        3        4       5        6
1  1.00000 -0.4748 -0.89143  0.02607 -0.2404  0.04569
2 -0.47478  1.0000  0.11558 -0.19937  0.2960  0.09680
3 -0.89143  0.1156  1.00000  0.04066  0.1043 -0.05590
4  0.02607 -0.1994  0.04066  1.00000 -0.3955 -0.95355
5 -0.24036  0.2960  0.10432 -0.39549  1.0000  0.17413
6  0.04569  0.0968 -0.05590 -0.95355  0.1741  1.00000
Warning messages:
1: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
2: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
3: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
4: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value

Call:
gnlr(y, dist = "inverse Gauss", mu = mu, linear = list(~sex + 
    age, ~sex + age), pmu = c(3, 0, 0), pshape = c(3, 0, 0))

censored inverse Gauss distribution

Response: y 

Log likelihood function:
{
    m <- mu1(p)
    t <- sh1(p)
    s <- exp(t)
    -sum(wt * (cc * (-(t + (y[, 1] - m)^2/(y[, 1] * s * m^2))/2) + 
        log(lc - rc * pinvgauss(y[, 1], m, s))))
}

Location function:
exp(linear)
Linear part:
~sex + age

Log shape function:
~sex + age

-Log likelihood    53.29904 
Degrees of freedom 14 
AIC                59.29904 
Iterations         29 

Location parameters:
             estimate       se
(Intercept)   1.56432  0.83173
sex          -0.05123  0.45930
age           0.09534  0.06906

Shape parameters:
             estimate      se
(Intercept)  -1.01686  1.8218
sex           0.07446  0.7231
age          -0.19480  0.1704

Correlations:
         1       2        3        4       5        6
1  1.00000 -0.4748 -0.89143  0.02607 -0.2404  0.04569
2 -0.47478  1.0000  0.11558 -0.19937  0.2960  0.09680
3 -0.89143  0.1156  1.00000  0.04066  0.1043 -0.05590
4  0.02607 -0.1994  0.04066  1.00000 -0.3955 -0.95355
5 -0.24036  0.2960  0.10432 -0.39549  1.0000  0.17413
6  0.04569  0.0968 -0.05590 -0.95355  0.1741  1.00000
Warning messages:
1: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
2: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
3: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
4: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value

Call:
gnlr(y, dist = "inverse Gauss", mu = mu, linear = ~sex + age, 
    shape = ~c0 + c1 * sex + c2 * age, pmu = c(3, 0, 0), pshape = list(c0 = 3, 
        c1 = 0, c2 = 0))

censored inverse Gauss distribution

Response: y 

Log likelihood function:
{
    m <- mu1(p)
    t <- sh1(p)
    s <- exp(t)
    -sum(wt * (cc * (-(t + (y[, 1] - m)^2/(y[, 1] * s * m^2))/2) + 
        log(lc - rc * pinvgauss(y[, 1], m, s))))
}

Location function:
exp(linear)
Linear part:
~sex + age

Log shape function:
~c0 + c1 * sex + c2 * age

-Log likelihood    53.29904 
Degrees of freedom 14 
AIC                59.29904 
Iterations         29 

Location parameters:
             estimate       se
(Intercept)   1.56432  0.83173
sex          -0.05123  0.45930
age           0.09534  0.06906

Shape parameters:
    estimate      se
c0  -1.01686  1.8218
c1   0.07446  0.7231
c2  -0.19480  0.1704

Correlations:
         1       2        3        4       5        6
1  1.00000 -0.4748 -0.89143  0.02607 -0.2404  0.04569
2 -0.47478  1.0000  0.11558 -0.19937  0.2960  0.09680
3 -0.89143  0.1156  1.00000  0.04066  0.1043 -0.05590
4  0.02607 -0.1994  0.04066  1.00000 -0.3955 -0.95355
5 -0.24036  0.2960  0.10432 -0.39549  1.0000  0.17413
6  0.04569  0.0968 -0.05590 -0.95355  0.1741  1.00000
Warning messages:
1: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
2: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
3: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
4: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value

Call:
gnlr(y, dist = "inverse Gauss", mu = ~age, shape = shape, pmu = c(3, 
    0), pshape = c(3, 0, 0), shfn = TRUE)

censored inverse Gauss distribution

Response: y 

Log likelihood function:
{
    m <- mu1(p)
    t <- sh1(p)
    s <- exp(t)
    -sum(wt * (cc * (-(t + (y[, 1] - m)^2/(y[, 1] * s * m^2))/2) + 
        log(lc - rc * pinvgauss(y[, 1], m, s))))
}

Location function:
~age

Log shape function:
p[1] + p[2] * sex + p[3] * mu

-Log likelihood    53.46555 
Degrees of freedom 15 
AIC                58.46555 
Iterations         25 

Location parameters:
             estimate      se
(Intercept)     1.656  8.2270
age             1.085  0.8752

Shape parameters:
      estimate      se
p[1]  -0.86983  2.4570
p[2]   0.06949  0.6877
p[3]  -0.16672  0.1975

Correlations:
         1         2       3         4       5
1  1.00000 -0.953448  0.5797 -0.050577 -0.5864
2 -0.95345  1.000000 -0.5558  0.009936  0.6299
3  0.57967 -0.555784  1.0000 -0.319035 -0.9541
4 -0.05058  0.009936 -0.3190  1.000000  0.1414
5 -0.58641  0.629867 -0.9541  0.141396  1.0000
Warning messages:
1: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
2: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
3: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
4: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
5: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
6: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
7: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value

Call:
gnlr(y, dist = "inverse Gauss", mu = ~age, shape = ~a + b * sex + 
    c * mu, pmu = c(3, 0), pshape = c(3, 0, 0), shfn = TRUE)

censored inverse Gauss distribution

Response: y 

Log likelihood function:
{
    m <- mu1(p)
    t <- sh1(p)
    s <- exp(t)
    -sum(wt * (cc * (-(t + (y[, 1] - m)^2/(y[, 1] * s * m^2))/2) + 
        log(lc - rc * pinvgauss(y[, 1], m, s))))
}

Location function:
~age

Log shape function:
~a + b * sex + c * mu

-Log likelihood    53.46555 
Degrees of freedom 15 
AIC                58.46555 
Iterations         25 

Location parameters:
             estimate      se
(Intercept)     1.656  8.2270
age             1.085  0.8752

Shape parameters:
   estimate      se
a  -0.86983  2.4570
b   0.06949  0.6877
c  -0.16672  0.1975

Correlations:
         1         2       3         4       5
1  1.00000 -0.953448  0.5797 -0.050577 -0.5864
2 -0.95345  1.000000 -0.5558  0.009936  0.6299
3  0.57967 -0.555784  1.0000 -0.319035 -0.9541
4 -0.05058  0.009936 -0.3190  1.000000  0.1414
5 -0.58641  0.629867 -0.9541  0.141396  1.0000
Warning messages:
1: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
2: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
3: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
4: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
5: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
6: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
7: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value

Call:
gnlr(y, dist = "inverse Gauss", mu = mu, shape = shape, pmu = c(3, 
    0, 1, 0), common = TRUE)

censored inverse Gauss distribution

Response: y 

Log likelihood function:
{
    m <- mu1(p)
    t <- sh1(p)
    s <- exp(t)
    -sum(wt * (cc * (-(t + (y[, 1] - m)^2/(y[, 1] * s * m^2))/2) + 
        log(lc - rc * pinvgauss(y[, 1], m, s))))
}

Location function:
exp(p[1] + p[2] * age)

Log shape function:
p[3] + p[4] * sex + p[2] * age

-Log likelihood    54.5085 
Degrees of freedom 16 
AIC                58.5085 
Iterations         39 

Common parameters:
      estimate       se
p[1]   2.05692  0.67920
p[2]   0.04257  0.06443
p[3]  -3.35220  0.85535
p[4]   0.28373  0.69463

Correlations:
        1       2       3       4
1  1.0000 -0.9443  0.8053 -0.2531
2 -0.9443  1.0000 -0.8004  0.2051
3  0.8053 -0.8004  1.0000 -0.6059
4 -0.2531  0.2051 -0.6059  1.0000
Warning messages:
1: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
2: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
3: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
4: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
5: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
6: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
7: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value

Call:
gnlr(y, dist = "inverse Gauss", mu = ~exp(a + b * age), shape = ~c + 
    d * sex + b * age, pmu = c(3, 0, 1, 0), common = TRUE)

censored inverse Gauss distribution

Response: y 

Log likelihood function:
{
    m <- mu1(p)
    t <- sh1(p)
    s <- exp(t)
    -sum(wt * (cc * (-(t + (y[, 1] - m)^2/(y[, 1] * s * m^2))/2) + 
        log(lc - rc * pinvgauss(y[, 1], m, s))))
}

Location function:
~exp(a + b * age)

Log shape function:
~c + d * sex + b * age

-Log likelihood    54.5085 
Degrees of freedom 16 
AIC                58.5085 
Iterations         39 

Common parameters:
   estimate       se
a   2.05692  0.67920
b   0.04257  0.06443
c  -3.35220  0.85535
d   0.28373  0.69463

Correlations:
        1       2       3       4
1  1.0000 -0.9443  0.8053 -0.2531
2 -0.9443  1.0000 -0.8004  0.2051
3  0.8053 -0.8004  1.0000 -0.6059
4 -0.2531  0.2051 -0.6059  1.0000
Warning messages:
1: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
2: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
3: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
4: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
5: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
6: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value
7: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value

Call:
gnlr(y, dist = dist, pmu = 1:3)

own distribution

Response: y 

Log likelihood function:
-sum(dnorm(y, p[1] + p[2] * sex, p[3], log = TRUE))

-Log likelihood    43.59446 
Degrees of freedom 17 
AIC                46.59446 
Iterations         12 

Model parameters:
      estimate      se
p[1]     1.752  0.6767
p[2]     4.218  0.9570
p[3]     2.140  0.3389

Correlations:
           1          2          3
1  1.000e+00 -0.7071068 -7.279e-05
2 -7.071e-01  1.0000000  3.742e-04
3 -7.279e-05  0.0003742  1.000e+00
Warning messages:
1: In dnorm(y, p[1] + p[2] * sex, p[3], log = TRUE) : NaNs produced
2: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value

Call:
gnlr(y, dist = dist, pmu = 1:3)

own distribution

Response: y 

Log likelihood function:
~-sum(dnorm(y, a + b * sex, v, log = TRUE))

-Log likelihood    43.59446 
Degrees of freedom 17 
AIC                46.59446 
Iterations         12 

Model parameters:
   estimate      se
a     1.752  0.6767
b     4.218  0.9570
v     2.140  0.3389

Correlations:
           1          2          3
1  1.000e+00 -0.7071068 -7.279e-05
2 -7.071e-01  1.0000000  3.742e-04
3 -7.279e-05  0.0003742  1.000e+00
Warning messages:
1: In dnorm(y, .p[1] + .p[2] * sex, .p[3], log = TRUE) : NaNs produced
2: In nlm(fcn, p = p, hessian = TRUE, print.level = print.level, typsize = typsize,  :
  NA/Inf replaced by maximum positive value

gnlm documentation built on May 2, 2019, 7:26 a.m.

Related to gnlr in gnlm...