Learn R Programming

mapfit (version 0.9.9)

mapfit.group: MAP fitting with grouped data

Description

Estimates MAP parameters from grouped data.

Usage

mapfit.group(
  map,
  counts,
  breaks,
  intervals,
  instant,
  stationary = TRUE,
  control = list(),
  verbose = list(),
  ...
)

Arguments

map

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

counts

A vector for the number of arrivals in time interval.

breaks

A vector for time sequence to determine time interval. This is equivalent to c(0,cumsum(intervals)). If this is missing, it is assigned to 0:length(counts).

intervals

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

instant

A vector of integer to indicate whether an arrival occurs at the last time of interval. If instant is 1, an arrival occurs at the last time of interval. If instant is 0, no arrival occurs at the last time of interval. By using instant, time point data can be expressed by grouped data class. If instant is missing, it is given by rep(0,length(counts)), i.e., there are no arrivals at the end of interval.

stationary

A logical value that determine whether initial probability is given by a stationary vector of underlying Markov process or not.

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 mapfit.result;

model

an object for estimated MAP class ('>map, '>erhmm).

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

stationary

a logical value for the argument stationary.

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.

See Also

mapfit.point, '>map and '>gmmpp

Examples

Run this code
# NOT RUN {
## load trace data
data(BCpAug89)
BCpAug89s <- head(BCpAug89, 50)

## make grouped data
BCpAug89.group <- hist(cumsum(BCpAug89s),
                         breaks=seq(0, 0.15, 0.005),
                         plot=FALSE)
                         
## MAP fitting for general MAP
(result1 <- mapfit.group(map=map(2),
                        counts=BCpAug89.group$counts,
                        breaks=BCpAug89.group$breaks))
## MAP fitting for MMPP
(result2 <- mapfit.group(map=mmpp(2),
                         counts=BCpAug89.group$counts,
                         breaks=BCpAug89.group$breaks))
                         
## MAP fitting with approximate MMPP
(result3 <- mapfit.group(map=gmmpp(2),
                         counts=BCpAug89.group$counts,
                         breaks=BCpAug89.group$breaks))

## marginal moments for estimated MAP
map.mmoment(k=3, map=result1$model)
map.mmoment(k=3, map=result2$model)
map.mmoment(k=3, map=result3$model)

## joint moments for estimated MAP
map.jmoment(lag=1, map=result1$model)
map.jmoment(lag=1, map=result2$model)
map.jmoment(lag=1, map=result3$model)

## lag-k correlation
map.acf(map=result1$model)
map.acf(map=result2$model)
map.acf(map=result3$model)

# }

Run the code above in your browser using DataLab