phfit.density: PH fitting with density function

Description Usage Arguments Value Note See Also Examples

View source: R/fit_phfit.R

Description

estimates PH parameters from density function.

Usage

1
2
3
4
5
phfit.density(ph, f, deformula = zero.to.inf,
  weight.zero = .Machine$double.eps,
  weight.reltol = sqrt(.Machine$double.eps),
  method = c("all", "increment"), lbound = 1, ubound = NULL,
  control = list(), verbose = list(), ...)

Arguments

ph

an object of S4 class for MAP. The estimation algorithm is selected depending on thie class.

f

a faunction object for a density function.

deformula

an object for formulas of numerical integration. It is not necessary to change it when the density function is defined on the positive domain [0,infinity).

weight.zero

a absolute value which is regarded as zero in numerical integration.

weight.reltol

a value for precision of numerical integration.

method

the name of estimation method for hyper Erlang (herlang).

lbound

a value for lower limit for the number of states in hyper Erlang (herlang).

ubound

a value for upper limit for the number of states in hyper Erlang (herlang).

control

a list of parameters for controlling the fitting process.

verbose

a list of parameters for displaying the fitting process.

...

further arguments for methods, which are also used to send the arguments to density function.

Value

returns a list with components, which is an object of S3 class phfit.result;

model

an object for estimated PH class (ph, cf1, herlang).

llf

a value of the maximum log-likelihood (a netative value of the cross entropy).

df

a value of degrees of freedom of the model.

aic

a value of Akaike information criterion (this is not meaningless in this case).

iter

the number of iterations.

convergence

a logical value for the convergence of estimation algorithm.

ctime

computation time (user time).

data

an object for MAP data class

aerror

a value of absolute error for llf at the last step of algorithm.

rerror

a value of relative error for llf at the last step of algorithm.

control

a list of the argument of control.

verbose

a list of the argument of verbose.

call

the matched call.

Note

Any of density function can be applied to the argument f, where f should be defined f <- function(x, ...). The first argument of f should be an integral parameter. The other parameters are set in the argument ... of phfit.density. The truncated density function can also be used directly.

See Also

phfit.point, phfit.group, ph, cf1 and herlang

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
####################
##### truncated density
####################

## PH fitting for general PH
(result1 <- phfit.density(ph=ph(2), f=dnorm,
                          mean=3, sd=1))

## PH fitting for CF1
(result2 <- phfit.density(ph=cf1(2), f=dnorm,
                          mean=3, sd=1))

## PH fitting for hyper Erlang
(result3 <- phfit.density(ph=herlang(3), f=dnorm,
                          mean=3, sd=1))

## mean
ph.mean(result1$model)
ph.mean(result2$model)
ph.mean(result3$model)

## variance
ph.var(result1$model)
ph.var(result2$model)
ph.var(result3$model)

## up to 5 moments 
ph.moment(5, result1$model)
ph.moment(5, result2$model)
ph.moment(5, result3$model)

mapfit documentation built on May 29, 2017, 3:44 p.m.