Description Usage Arguments Value Examples
Simulate from a stationary Gaussian AR(1) process at n
consecutive
time points.
1 2 | ar1_sim_conditional(pred_times, obs_times, x_obs, rho, sigma, mu_pred = 0,
mu_obs = 0)
|
pred_times |
A vector of time points to simulate at. |
obs_times |
A vector of time points at which observations have been made. |
x_obs |
The observed values of the process. |
rho |
A real number strictly less than 1 in absolute value. |
sigma |
A positive real number. |
mu_pred |
A vector or scalar with expected values. |
mu_obs |
A vector or scalar with expected values. |
A vector of length length(pred_times)
with the process
values.
1 2 3 4 5 6 7 8 9 10 11 12 | t_pred <- c(1, 3, 6:8, 10)
t_obs <- c(2, 5, 11:12)
x_obs <- rnorm(4)
rho <- 0.5
sigma <- 1
# Means equal 0
ar1_sim_conditional(t_pred, t_obs, x_obs, rho, sigma)
# Time-varying means
mu_pred <- t_pred + rnorm(length(t_pred))
mu_obs <- t_obs + rnorm(length(t_obs))
ar1_sim_conditional(t_pred, t_obs, x_obs + mu_obs, rho, sigma,
mu_pred, mu_obs)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.