| reconstruct | R Documentation |
Reconstructs the most likely series.
reconstruct(object)
object |
object of class |
the function returns a vector of the same length of data containing the reconstruction of the most likely series.
David Moriña, Amanda Fernández-Fontelo, Alejandra Cabaña, Pedro Puig, Biel Abarca Galván
D. Moriña, A. Fernández-Fontelo, A. Cabaña, P. Puig (2021): New statistical model for misreported data with application to current public health challenges. arXiv preprint (https://arxiv.org/pdf/2003.09202.pdf)
Davison, A. C. and Hinkley, D. V. (1997) Bootstrap Methods and Their Applications. Cambridge University Press, Cambridge. ISBN 0-521-57391-2
MisRepARMA-package, fitMisRepARMA
### Example 1: frequentist reconstruction
set.seed(12345)
x <- arima.sim(model = list(ar = 0.4), n = 100)
ind <- rbinom(100, 1, 0.6)
y <- ifelse(ind == 0, x, x * 0.3)
fit <- fitMisRepARMA(y, tol = 1e-6, B = 50, p_AR = 1, q_MA = 0,
covars = NULL, misReport = "U", method = "freq")
x_hat <- reconstruct(fit)
plot(y, type = "l", col = "black", ylab = "Series",
main = "Observed (black) vs reconstructed (red)")
lines(x_hat, col = "red", lty = 2)
## Not run:
### Example 2: Bayesian reconstruction (requires R2jags and JAGS)
fit_b <- fitMisRepARMA(y, tol = 1e-6, B = 5000, p_AR = 1, q_MA = 0,
covars = NULL, misReport = "U", method = "bayes",
n_chains = 3, n_burnin = 1000)
x_hat_b <- reconstruct(fit_b)
lines(x_hat_b, col = "blue", lty = 3)
legend("topright", legend = c("Observed", "Freq.", "Bayes"),
col = c("black","red","blue"), lty = c(1,2,3))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.