dAR1 {VGAM} | R Documentation |
The AR-1 Autoregressive Process
Description
Density for the AR-1 model.
Usage
dAR1(x, drift = 0, var.error = 1, ARcoef1 = 0.0,
type.likelihood = c("exact", "conditional"), log = FALSE)
Arguments
x |
vector of quantiles. |
drift |
the scaled mean (also known as the drift parameter),
|
log |
Logical.
If |
type.likelihood , var.error , ARcoef1 |
See |
Details
Most of the background to this function is given
in AR1
.
All the arguments are converted into matrices, and then
all their dimensions are obtained. They are then coerced
into the same size: the number of rows is the maximum
of all the single rows, and ditto for the number of columns.
Value
dAR1
gives the density.
Author(s)
T. W. Yee and Victor Miranda
See Also
AR1
.
Examples
nn <- 100; set.seed(1)
tdata <- data.frame(index = 1:nn,
TS1 = arima.sim(nn, model = list(ar = -0.50),
sd = exp(1)))
fit1 <- vglm(TS1 ~ 1, AR1, data = tdata, trace = TRUE)
rhobitlink(-0.5)
coef(fit1, matrix = TRUE)
(Cfit1 <- Coef(fit1))
summary(fit1) # SEs are useful to know
logLik(fit1)
sum(dAR1(depvar(fit1), drift = Cfit1[1], var.error = (Cfit1[2])^2,
ARcoef1 = Cfit1[3], log = TRUE))
fit2 <- vglm(TS1 ~ 1, AR1(type.likelihood = "cond"), data = tdata, trace = TRUE)
(Cfit2 <- Coef(fit2)) # Okay for intercept-only models
logLik(fit2)
head(keep <- dAR1(depvar(fit2), drift = Cfit2[1], var.error = (Cfit2[2])^2,
ARcoef1 = Cfit2[3], type.likelihood = "cond", log = TRUE))
sum(keep[-1])