We are attempting to create a short Poisson time series (between 10 and 50
datapoints) for a simulation. We want these time series to have no counts
of over 100 and not be zero-inflated. We also are trying generate various
nonlinearities, particularly of a cyclic nature. We have been attempting to
generate this data using higher order polynomials. An example with a
seventh-order trend (and a treatment effect):

Time <- 0:(T-1) ##T is the desired number of time points in the time series.
beta <- c(B0 = 1.585, B1 = Btrt, B2 = 1.229, B3 = -3.364e-01, B4 =
-6.610e-02, B5 = 2.697e-02, B6 = -2.905e-03, B7 =  1.304e-04, B8 =
-2.130e-06)
pmat <- cbind(const = 1, tx = tx, Time = Time, Time2 = Time^2, Time3 =
Time^3, Time4 = Time^4, Time5 = Time^5,Time6 = Time^6, Time7 = Time^7)
##Btrt is the treatment effect
 y <- pmat %*% beta
 y <- rpois(T, exp(y))

This code works. However, when manipulating the factors such as the length
of the time series, the same beta coefficients do not always produce the
same desirable properties - the most common problem being the end of the
time series results in a line of zeros. We are hoping to use a consistent
data generating method across simulation cells (e.g. not changing the set
of beta coefficients for each cell), so they are comparable in the analysis
stage of the simulation.

Does anyone have any other ways they create cyclic Poisson time series
data? Or good references for doing so?

Thanks in advance,

Kristynn Sullivan

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to