

   FFiitt aa GGeenneerraalliizzeedd NNoonnlliinneeaarr RReeggrreessssiioonn MMooddeell wwiitthh aa TTwwoo
   PPooiinntt MMiixxttuurree

        fmr(y, dist="normal", pmu=NULL, pshape=NULL, pmix=NULL, mu=NULL,
        mix=NULL, linear=NULL, censor="right", exact=F, wt=1, delta=1,
        print.level=0, typsiz=abs(p), ndigit=10, gradtol=0.00001,
        stepmax=10*sqrt(p%*%p), steptol=0.00001, iterlim=100, fscale=1)

   AArrgguummeennttss::

          y: The response vector for Poisson and negative bino-
             mial distributions or a two column matrix for
             (beta) binomial data. For censored data, two
             columns with the second being the censoring indi-
             cator (1: uncensored, 0: right censored, -1: left
             censored.)  It may also be an object of class,
             response.

       dist: Either a character string containing the name of
             the distribution or a function giving the -log
             likelihood and calling the location and mixture
             functions.

        pmu: Vector of initial estimates for the location
             parameters.

     pshape: Initial estimate for the shape parameter.

       pmix: Vector of initial estimates for the mixture param-
             eters.

         mu: User-specified function of `p', and possibly lin-
             ear, giving the regression equation for the loca-
             tion. This may contain a linear part that must
             simply be given the name, linear, in the function.
             It may also be a language expression beginning
             with ~, specifying a linear regression function
             for the location parameter.  If neither is sup-
             plied, the location is taken to be constant unless
             the linear argument is given.

        mix: User-specified function of `p', and possibly lin-
             ear, giving the regression equation for the mix-
             ture parameter. This may contain a linear part
             that must simply be given the name, linear, in the
             function. It may also be a language expression
             beginning with ~, specifying a linear regression
             function for the mixture parameter. If no function
             is supplied, this parameter is taken to be con-
             stant. This parameter is the logit of the mixture
             probability.

     linear: Language expression beginning with ~, or list of
             two such expressions, specifying the linear part
             of the regression function for the location or
             location and mixture parameters.

     censor: `right', `left', or `both' indicating where the
             mixing distribution is placed. `both' is only pos-
             sible for binomial data.

      exact: If TRUE, fits the exact likelihood function for
             continuous data by integration over intervals of
             observation, 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 mul-
             tiplied by the Jacobian. The transformation cannot
             contain unknown parameters.  For example, with a
             log transformation, `delta=1/y'.

     others: Arguments controlling `nlm'.

   DDeessccrriippttiioonn::

        `fmr' fits user specified nonlinear regression equa-
        tions to the location parameter of the common one and
        two parameter distributions (binomial, beta binomial,
        double binomial, multiplicative binomial, Poisson, neg-
        ative binomial, double Poisson, multiplicative Poisson,
        geometric, normal, inverse Gauss, logistic, exponen-
        tial, gamma, Weibull, extreme value, Cauchy, Student t,
        and Laplace). For the Poisson and negative binomial,
        the mixture involves the zero category.  For the (beta)
        binomial, it involves the two extreme categories. For
        all other distributions, it involves either left or
        right censored individuals. A user-specified -log like-
        lihood can also be supplied for the distribution.

   VVaalluuee::

        A list of class fmr is returned.  The printed output
        includes the -log likelihood (not the deviance), the
        corresponding AIC, the maximum likelihood estimates,
        standard errors, and correlations. A list is returned
        that contains all of the relevant information calcu-
        lated, including error codes.

   SSeeee AAllssoo::

        `lm', `glm', `gnlr', `gnlr3'.

   EExxaammpplleess::

        # linear regression with inverse Gauss distribution with a point mass
        # for right censored individuals
        mu <- function(p) p[1]+p[2]*sex+p[3]*age
        fmr(data, dist="inverse Gauss", pmu=rep(1,3), pmix=1, mu=mu)
        # or equivalently
        fmr(data, dist="inverse Gauss", pmu=rep(1,3), pmix=1, mu=~sex+age)
        # or
        fmr(data, dist="inverse Gauss", pmu=rep(1,3), pmix=1, linear=~sex+age)
        #
        # nonlinear regression with inverse Gauss distribution
        mu <- function(p, linear) p[4]*exp(linear)
        fmr(data, dist="inverse Gauss", pmu=rep(1,4), pmix=1, mu=mu,
             linear=~sex+age)
        #
        # include logistic regression for the mixture parameter with
        # same mu function
        mix <- function(p) p[5]+p[6]*sex+p[7]*age
        fmr(data, dist="inverse Gauss", pmu=rep(1,4), pmix=rep(1,3), mu=mu,
             mix=mix)
        # or equivalently
        fmr(data, dist="inverse Gauss", pmu=rep(1,4), pmix=rep(1,3), mu=mu,
             linear=list(~sex+age,~sex+age))

