random_ind {uGMAR} | R Documentation |
Create random GMAR, StMAR, or G-StMAR model compatible parameter vector
Description
random_ind
creates a random GMAR, StMAR, or G-StMAR model compatible mean-parametrized parameter vector.
smart_ind
creates a random GMAR, StMAR, or G-StMAR model compatible parameter vector close to argument params
.
Sometimes returns exactly the given parameter vector.
Usage
random_ind(
p,
M,
model = c("GMAR", "StMAR", "G-StMAR"),
restricted = FALSE,
constraints = NULL,
mu_scale,
sigma_scale,
forcestat = FALSE
)
smart_ind(
p,
M,
params,
model = c("GMAR", "StMAR", "G-StMAR"),
restricted = FALSE,
constraints = NULL,
mu_scale,
sigma_scale,
accuracy,
which_random = numeric(0),
forcestat = FALSE
)
Arguments
p |
a positive integer specifying the autoregressive order of the model. |
M |
|
model |
is "GMAR", "StMAR", or "G-StMAR" model considered? In the G-StMAR model, the first |
restricted |
a logical argument stating whether the AR coefficients |
constraints |
specifies linear constraints imposed to each regime's autoregressive parameters separately.
The symbol |
mu_scale |
a real valued vector of length two specifying the mean (the first element) and standard deviation (the second element)
of the normal distribution from which the |
sigma_scale |
a positive real number specifying the standard deviation of the (zero mean, positive only by taking absolute value) normal distribution from which the component variance parameters (for random regimes) should be generated. |
forcestat |
use the algorithm by Monahan (1984) to force stationarity on the AR parameters (slower) for random regimes? Not supported for constrained models. |
params |
a real valued parameter vector specifying the model.
Symbol |
accuracy |
a real number larger than zero specifying how close to |
which_random |
a numeric vector of maximum length |
Details
These functions can be used, for example, to create initial populations for the genetic algorithm. Mean-parametrization
(instead of intercept terms \phi_{m,0}
) is assumed.
Value
Returns estimated parameter vector with the form described in initpop
.
References
Monahan J.F. 1984. A Note on Enforcing Stationarity in Autoregressive-Moving Average Models. Biometrica 71, 403-404.
Examples
set.seed(1)
# GMAR model parameter vector
params22 <- random_ind(p=2, M=2, mu_scale=c(0, 1), sigma_scale=1)
smart22 <- smart_ind(p=2, M=2, params22, accuracy=10)
cbind(params22, smart22)
# Restricted GMAR parameter vector
params12r <- random_ind(p=1, M=2, restricted=TRUE, mu_scale=c(-2, 2), sigma_scale=2)
smart12r <- smart_ind(p=1, M=2, params12r, restricted=TRUE, accuracy=20)
cbind(params12r, smart12r)
# StMAR parameter vector: first regime is random in the "smart individual"
params13t <- random_ind(p=1, M=3, model="StMAR", mu_scale=c(3, 1), sigma_scale=3)
smart13t <- smart_ind(p=1, M=3, params13t, model="StMAR", accuracy=15,
mu_scale=c(3, 3), sigma_scale=3, which_random=1)
cbind(params13t, smart13t)
# Restricted StMAR parameter vector
params22tr <- random_ind(p=2, M=2, model="StMAR", restricted=TRUE,
mu_scale=c(3, 2), sigma_scale=0.5)
smart22tr <- smart_ind(p=2, M=2, params22tr, model="StMAR", restricted=TRUE,
accuracy=30)
cbind(params22tr, smart22tr)
# G-StMAR parameter vector
params12gs <- random_ind(p=1, M=c(1, 1), model="G-StMAR", mu_scale=c(0, 1),
sigma_scale=1)
smart12gs <- smart_ind(p=1, M=c(1, 1), params12gs, model="G-StMAR",
accuracy=20)
cbind(params12gs, smart12gs)
# Such StMAR(3,2) that the AR coefficients are restricted to be
# the same for both regimes and that the second AR coefficients are
# constrained to zero. Second regime is random in the "smart individual".
params32trc <- random_ind(p=3, M=2, model="StMAR", restricted=TRUE,
constraints=matrix(c(1, 0, 0, 0, 0, 1), ncol=2),
mu_scale=c(-2, 0.5), sigma_scale=4)
smart32trc <- smart_ind(p=3, M=2, params32trc, model="StMAR", restricted=TRUE,
constraints=matrix(c(1, 0, 0, 0, 0, 1), ncol=2),
mu_scale=c(0, 0.1), sigma_scale=0.1, which_random=2,
accuracy=20)
cbind(params32trc, smart32trc)