Usage
saddle(A = NULL, u = NULL, wdist = "m", type = "simp", d = NULL, d1 = 1, init = rep(0.1, d), mu = rep(0.5, n), LR = FALSE, strata = NULL, K.adj = NULL, K2 = NULL)
Arguments
A
A vector or matrix of known coefficients of the linear combinations
of W. It is a required argument unless K.adj
and
K2
are supplied, in which case it is ignored.
u
The value at which it is desired to calculate the saddlepoint
approximation to the distribution of the linear combination of
W. It is a required argument unless K.adj
and
K2
are supplied, in which case it is ignored.
wdist
The distribution of W. This can be one of "m"
(multinomial), "p"
(Poisson), "b"
(binary) or
"o"
(other). If K.adj
and K2
are given
wdist
is set to "o"
.
type
The type of saddlepoint approximation. Possible types are
"simp"
for simple saddlepoint and "cond"
for the
conditional saddlepoint. When wdist
is "o"
or
"m"
, type
is automatically set to "simp"
, which
is the only type of saddlepoint currently implemented for those
distributions.
d
This specifies the dimension of the whole statistic. This argument
is required only when wdist = "o"
and defaults to 1 if not
supplied in that case. For other distributions it is set to
ncol(A)
.
d1
When type
is "cond"
this is the dimension of the
statistic of interest which must be less than length(u)
.
Then the saddlepoint approximation to the conditional distribution
of the first d1
linear combinations given the values of the
remaining combinations is found. Conditional distribution function
approximations can only be found if the value of d1
is 1.
init
Used if wdist
is either "m"
or "o"
, this gives
initial values to nlmin
which is used to solve the
saddlepoint equation.
mu
The values of the parameters of the distribution of W when
wdist
is "m"
, "p"
"b"
. mu
must
be of the same length as W (i.e. nrow(A)
). The default is
that all values of mu
are equal and so the elements of
W are identically distributed.
LR
If TRUE
then the Lugananni-Rice approximation to the cdf is used,
otherwise the approximation used is based on Barndorff-Nielsen's r*.
strata
The strata for stratified data.
K.adj
The adjusted cumulant generating function used when wdist
is
"o"
. This is a function of a single parameter, zeta
,
which calculates K(zeta)-u%*%zeta
, where K(zeta)
is
the cumulant generating function of W.
K2
This is a function of a single parameter zeta
which returns the
matrix of second derivatives of K(zeta)
for use when
wdist
is "o"
. If K.adj
is given then this must
be given also. It is called only once with the calculated solution
to the saddlepoint equation being passed as the argument. This
argument is ignored if K.adj
is not supplied.