phfit.group: PH fitting with grouped data

Description Usage Arguments Value Note See Also Examples

View source: R/fit_phfit.R

Description

estimates PH parameters from grouped data.

Usage

1
2
3
phfit.group(ph, counts, breaks, intervals, instant, 
  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.

counts

a vector of the number of points in intervals.

breaks

a vector for a sequence of points of boundaries of intervals. This is equivalent to c(0,cumsum(intervals)). If this is missing, it is assigned to 0:length(counts).

intervals

a vector of time lengths for intervals. This is equivalent to diff(breaks)). If this is missing, it is assigned to rep(1,length(counts)).

instant

a vector of integers to indicate whether sample is drawn at the last of interval. If instant is 1, a sample is drawn at the last of interval. If instant is 0, no sample is drawn at the last of interval. By using instant, point data can be expressed by grouped data. If instant is missing, it is given by rep(0L,length(counts)), i.e., there are no sampels at the last of interval.

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.

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.

df

a value of degrees of freedom of the model.

aic

a value of Akaike information criterion.

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

In this method, we can handle truncated data using NA and Inf;

phfit.group(ph=cf1(5), counts=c(countsdata, NA), breaks=c(breakdata, +Inf))

NA means missing of count data at the conrredponding interval, and Inf ia allowed to put the last of breaks or intervals which represents a special interval [the last break point,infinity).

See Also

phfit.point, phfit.density, 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
## make sample
wsample <- rweibull(n=100, shape=2, scale=1)
wgroup <- hist(x=wsample, breaks="fd", plot=FALSE)

## PH fitting for general PH
(result1 <- phfit.group(ph=ph(2), counts=wgroup$counts,
                        breaks=wgroup$breaks))

## PH fitting for CF1
(result2 <- phfit.group(ph=cf1(2), counts=wgroup$counts,
                        breaks=wgroup$breaks))

## PH fitting for hyper Erlang
(result3 <- phfit.group(ph=herlang(3), counts=wgroup$counts,
                        breaks=wgroup$breaks))

## 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.