stableglm               package:stable               R Documentation

_S_t_a_b_l_e _G_e_n_e_r_a_l_i_z_e_d _L_i_n_e_a_r _R_e_g_r_e_s_s_i_o_n _M_o_d_e_l

_U_s_a_g_e:

     stableglm(y, Delta=1,
              loc=0, disp=1, skew=0, tail=1.5, 
              iloc=NULL, idisp=NULL,iskew=NULL, itail=NULL,
              oloc=T,odisp=T, oskew=T, otail=T, noopt=F,
              wt=1, exact=F, censor=F,
              integration="Romberg", eps=1e-6, up=10, npoint=501,
              hessian=T, msg=0, ndigit=-1, steptol=1e-12,
              gradtol=0.0001, typf=1, typsize=1, stepmax=1, iterlim=50,
              output=F, llik.output=T)

     mode.stable(obj.stable)
     fitted.values.stable(obj.stable)
     coefficients.stable(obj.stable)
     weights.stable(obj.stable)
     df.residual.stable(obj.stable)
     llik.stable(obj.stable)
     llik.comp.stable(obj.stable)
     deviance.stable(obj.stable)
     deviance.comp.stable(obj.stable)
     aic.stable(obj.stable)
     aic.opt.stable(obj.stable)

_A_r_g_u_m_e_n_t_s:

       y: The response vector. For censored data, two columns with the
          second being the censoring indicator (1: uncensored, 0: right
          censored, -1: left censored.)

   Delta: Scalar or vector giving the unit of measurement 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.  For example, with a log transformation,
          `Delta=1/y'. (The `Delta' values for the censored response
          are ignored.) The transformation cannot contain unknown
          parameters.

loc, oloc and iloc: Describe the linear model considered for the
          location parameter of the fitted stable distribution, after
          transformation by the link function `loc.g' (set to the
          identity by default. The inverse link function is denoted by
          `loc.h'. Note that these functions cannot contain unknown
          parameters).

          Two specifications are possible:

          (1) `loc' is a language expression beginning with ~,
          describing the linear part of the regression function for the
          location parameter (after transformation by `loc.g', the link
          function).

          `iloc' is a vector of initial conditions for the parameters 
          in the linear part.

          `oloc' is a boolean indicating if an optimization of the
          likelihood has to be carried out on these parameters. If
          `oloc' is set to TRUE, a default zero value is considered for
          the starting values `iloc'. But if no optimization is desired
          on the location parameters, i.e. when the likelihood has to
          be evaluated or optimized at a fixed location, then `iloc'
          has to be explicitely specified.

          (2) `loc' is a numeric expression (i.e. a scalar or a vector
          of the same  size as the data vector `y', or `y[,1]' when
          censoring is considered).

          If `oloc' is set to TRUE, i.e. when an optimization of the
          likelihood has to be carried out on the location parameter,
          then the location parameter (after transformation by the link
          function loc.g) is set to an unknown parameter with initial
          value equal to `iloc[1]' or `loc[1]' when `iloc' is not
          specified.

          But when `oloc' is set to FALSE, i.e. when the likelihood has
          to be evaluated  or optimized at a fixed location, then the
          transformed location is assumed to be equal to `loc' when it
          is of the same length as the data vector `y' (or `y[,1]' when
          censoring is considered), and to `loc[1]' otherwise.

          Specification (1) is especially useful in ANOVA-like
          situations where the location is assumed to change with the
          levels of some factor variable. 

disp, odisp and idisp: describe the linear model considered for the
          dispersion parameter of the fitted stable distribution, after
          transformation by the link function `disp.g' (set to the
          `log' function by default). The inverse link function is
          denoted by `disp.h'. Again these functions cannot contain
          unknown parameters. The same rules as above apply when
          specifying the generalized linear model for the dispersion
          parameter.

skew, oskew and iskew: describe the linear model considered for the
          skewness parameter of the fitted stable distribution, after
          transformation by the link function `skew.g' (set to  `log{(1
          + [.])/(1 - [.])}' by default). The inverse link function is
          denoted by `skew.h'. Again these functions cannot contain
          unknown parameters. The same rules as above apply when
          specifying the generalized linear model for the skewness
          parameter.

tail, otail and itail: describe the linear model considered for the
          tail parameter of the fitted stable distribution, after
          transformation by the link function `tail.g' (set to 
          `log{([.] - 1)/(2 - [.])}' by default. The inverse link
          function is denoted by `tail.h'. Again these functions cannot
          contain unknown parameters). The same rules as above apply
          when specifying the generalized linear model for the tail
          parameter.

   noopt: When set to TRUE, it forces `oloc', `odisp', `oskew' and
          `otail' to FALSE, whatever the user choice for these last
          three arguments. It is especially useful when looking  for
          appropriate initial values for the linear model parameters,
          before undertaking the optimization of the likelihood.

      wt: Weight vector.

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

  censor: TRUE if data are censored, in which case `y' must be a two
          column matrix.

integration, eps, up and npoint: `integration' indicates which
          algorithm must be used to evaluate the stable density when
          the likelihood is computed with `exact' set to FALSE. See the
          man page on `dstable' for extra information.

llik.output: is TRUE when the likelihood has to be displayed  at each
          iteration of the optimization.

  others: Arguments controlling the optimization procedure `nlm'.

obj.stable: Object of class stable, as produced by `stableglm'

_V_a_l_u_e:

     A list of class `sable' is returned. The printed output includes
     the -log-likelihood, the corresponding AIC, the maximum likelihood
     estimates, standard errors, and correlations. It also include  all
     the relevant information calculated, including error codes.

_A_u_t_h_o_r(_s):

     Philippe Lambert (University of Liege, Belgium,
     plambert@ulg.ac.be) and Jim Lindsey.

_S_e_e _A_l_s_o:

     `lm', `glm', `stable' and  `stable.mode'.

_E_x_a_m_p_l_e_s:

     library(stable)
     ## Share return over a 50 day period (see reference above)
     # share
     y <- c(296,296,300,302,300,304,303,299,293,294,294,293,295,287,288,297,305,
     307,307,304,303,304,304,309,309,309,307,306,304,300,296,301,298,295,
     295,293,292,297,294,293,306,303,301,303,308,305,302,301,297,299)  

     #return
     ret <- (y[2:50]-y[1:49])/y[1:49]
     hist(ret, breaks=seq(-0.035,0.045,0.01))

     day <- seq(0,0.48,by=0.01) # time measured in days/100
     x <- seq(1,length(ret))-1

     # Classic stationary normal model tail=2
     print(z1  <- stableglm(y = ret, Delta = 1/y[1:49],
          loc = ret ~ 1, disp= ret ~ 1, skew = ret ~ 1, tail = tail.g(1.9999999),
          iloc = 0,idisp = 0, iskew = 0,
          otail = F, oskew = F))

     # Normal model (tail=2) with dispersion=disp.h(b0+b1*day)
     print(z2 <- stableglm(y = ret,Delta = 1/y[1:49],
           loc = ~ day,disp = ret ~ 1, skew = ret ~ 1,tail = tail.g(1.999999),
           iloc = c(0,0),idisp = 0,iskew = 0,
           oskew = F,otail =F))

     # Stable model with loc(ation)=loc.h(b0+b1*day)
     print(z3 <- stableglm(y = ret, Delta = 1/y[1:49],
           loc = ~ day, disp = ret ~ 1, skew = ret ~ 1, tail = ret ~ 1,
           iloc = c(0.001,0),idisp = 0,iskew = 0, itail = 0))

     # Stable model with disp(ersion)=disp.h(b0+b1*day)
     print(z4 <- stableglm(y = ret, Delta = 1/y[1:49],
           loc = ret ~ 1, disp = ret ~ day, skew = ret ~ 1, tail = ret ~ 1,
           iloc = 0,idisp = c(-4.5,0),iskew = -2, itail = 1))

     # Stable model with skew(ness)=skew.h(b0+b1*day)
     # Evaluation at fixed parameter values (since noopt is set to TRUE)
     print(z5 <- stableglm(y = ret, Delta = 1/y[1:49],
           loc = ret ~ 1, disp = ret ~ 1, skew = ~ day, tail = ret ~ 1,
           iloc = 5.557e-04,idisp = -4.957,iskew = c(2.811,-2.158),itail = -5.261e-1,
           noopt=T))

     # Stable model with tail=tail.h(b0+b1*day)
     print(z6 <- stableglm(y = ret, Delta = 1/y[1:49],
           loc = ret ~ 1, disp = ret ~ 1, skew = ret ~ 1, tail = ret ~ day,
           iloc = 0.001,idisp = -5,iskew = -3, itail = c(2,-7),hessian=F))

