ar1_sim_conditional: Simulate from a stationary Gaussian AR(1) process.

Description Usage Arguments Value Examples

View source: R/simulation.R

Description

Simulate from a stationary Gaussian AR(1) process at n consecutive time points.

Usage

1
2
ar1_sim_conditional(pred_times, obs_times, x_obs, rho, sigma, mu_pred = 0,
  mu_obs = 0)

Arguments

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.

Value

A vector of length length(pred_times) with the process values.

Examples

 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)

irregulAR1 documentation built on May 2, 2019, 8:49 a.m.