y.fit: Fitted Time Series from Simulated Parameters

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/y.fit.R

Description

Returns fitted time series for each set of simulated parameter values used in the calculation of the log-likelihood.

Usage

1
y.fit(bug, sims, ysim = NULL, pre.beg = FALSE)

Arguments

bug

A BUGS model created in the tsbugs package.

sims

A data.frame of simulated parameter values with column names labelled according to output from the R2OpenBUGS package.

ysim

A data.frame of simulated y values with column names labelled according to output from the R2OpenBUGS package.

pre.beg

Logical value to include or exclude NA outputs in time periods (columns) before the starting value for which data are considered in the likelihood of the BUGS model. The number of columns will be dependent on the value of the bug argument used when setting up the BUGS model using the tsbugs package. By default this argument is FALSE, i.e. there are no columns of missing values returned.

Details

Returns mean series for each set of simulated parameter values. When y, the observed time series contains missing values, users need to supply a data frame of simulated y values for ysim. This will allow the calculation of mean values for $y$ in the presence of missing data.

Value

A data.frame where rows are simulations and columns are time.

Note

The suggestion of the use of ysim to account for missing values was taken from discussion on Cross Validated: http://stats.stackexchange.com/questions/47877/calculating-the-likelihood-of-time-series-data-when-there-are-missing-data

Author(s)

Guy J. Abel

See Also

h.fit, tslogl

Examples

1
2
3
4
5
6
## Not run: 
# demo example with constant variance models for differenced growth rate
# of England and Wales population as used in Abel et. al. (2013)
demo("cv_bma", "tsbridge")

## End(Not run)

tsbridge documentation built on May 30, 2017, 1:14 a.m.