| fit_wiener | R Documentation |
Implement the EM algorithm to perform inference on the parameters of a Wiener process with mixed drift effects.
fit_wiener(df,
mu = "at^1",
tol = 1e-4,
max_iter = 100,
theta = NULL,
M = 100,
verbose = TRUE,
mu_dlt = NULL,
n_mcmc = 1000,
burnin = 500)
df |
Data frame with the observed data. It must include the columns |
mu |
Functional form of the drift. Supported drifts include
|
tol |
Convergence tolerance for the EM algorithm. The algorithm stops when
the maximum absolute difference between the parameter estimates at two
consecutive EM iterations is smaller than |
max_iter |
Maximum number of EM iterations. |
theta |
Optional named vector of initial parameter values. If |
M |
Number of Monte Carlo samples used to approximate the conditional expectations in the E-step. |
verbose |
Logical indicating whether to print EM iteration progress. |
mu_dlt |
Optional user-supplied function defining the integrated drift
term. If |
n_mcmc |
Number of MCMC iterations used in the E-step to sample the random effects. |
burnin |
Number of initial MCMC iterations discarded. |
The model is a one-dimensional Wiener diffusion defined by
dY_{kt} = \mu(t, a_k)dt + \sigma dW_{kt}
,
where \mu(t, a_k) is a user-specified drift function depending on a
unit-specific random effect a_k \sim \mathcal{N}(\mu_a, \sigma_a^2).
For discretely observed trajectories, the mean of the increments is given by the integrated drift
\mu_{\Delta}(a_k, t_i, t_{i-1}) = \int_{t_{i-1}}^{t_i} \mu(s, a_k)\, ds.
The function mu_dlt represents this integrated drift. If not provided, it
is constructed automatically from mu using closed-form expressions for
common drift specifications.
A named numeric vector containing the estimated model parameters:
mu_a |
Estimated mean of the random effects distribution. |
sigma2_a |
Estimated variance of the random effects distribution. |
sigma2 |
Estimated diffusion variance of the Wiener process. |
library(mixediffusion)
data(datasim01)
plot_paths(df = datasim01)
## Not run:
fit <- fit_wiener(df = datasim01, mu = "at^1",
verbose = FALSE, max_iter = 20)
fit
## End(Not run)
# mu(ak,t) = ak*sin(pi*t)
data(datasim02)
plot_paths(df = datasim02)
mu_dlt_new <- function(ak,ti,ti_1){
value <- -ak*(cos(pi*ti) - cos(pi*ti_1))
return(value)
}
fit <- fit_wiener(df = datasim02, mu_dlt = mu_dlt_new,
verbose = FALSE, max_iter = 2)
fit
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.