Displaying 6 results from an estimated 6 matches for "varresult".
2011 Jun 01
0
Simulating SVAR Data
...,xreg=cbind(L1.y,L2.y,y))
error[z,1,1] <- m2$coef[3] - b0
error[z,1,2:3] <- m2$coef[1:2] - c(b1,b2)
error[z,1,4:6] <- m2$coef[4:6] - c(b3,b4,b5)
##### SVAR of x and y #####
m3 <- VAR(cbind(y,x),p=2)
A <- matrix(c(1,NA,0,1),ncol=2)
m4 <- SVAR(m3,Amat=A)
error[z,2,1] <- m4$var$varresult$x$coeff[5] - b0
error[z,2,2] <- m4$var$varresult$x$coeff[2] - b1
error[z,2,3] <- m4$var$varresult$x$coeff[4] - b2
error[z,2,4] <- m4$var$varresult$x$coeff[1] - b3
error[z,2,5] <- m4$var$varresult$x$coeff[3] - b4
error[z,2,6] <- m4$A[2,1] - b5
}
mse <- error^2
means <- array(...
2012 Jul 27
2
Extracting results from the VAR output
...son why I want to do
this is, that this would help me to automize the process, since I may not
use the variable Liabilities next time.
Here is an example when the process works, but I have to do it manually by
typing in $Liabilities
VARrow<-VAR(data,p=1,type="const")
row<-VARrow$varresult$Liabilities$coefficient
row[1]
Liabilities.l1
0.06898797
It would be nice if I could type in e.g. colnames(data)[1] instead of
Liabilities (because colnames(data)[1] referes to Liabilites) but this
command just says the value is NULL instead 0.06898797....
Any help is much appriciated...
2007 May 23
0
Changing sequential regression code to call systemfit
...package and its directly below
) to do a sequence of lm calls and the data I use from the matrix
depends on restrictions.
for(i in 1:K){
datares <- datasub[, which(x$restrictions[i, ] == 1),drop=FALSE]
y <- yendog[, i]
lmres <- lm(y ~ -1 + ., data=datares)
# x$varresult[[i]] <- lmres
# x$resid[, i] <- resid(x$varresult[[i]])
}
I would like to modify the code to make one call to systemfit because I
really should be using SUR rather than a sequence of lms.
But, systemfit needs the following type of setup.
#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
2010 Feb 07
1
Out-of-sample prediction with VAR
...]);
ts_XGL <- ts(salesmodeldata$gtrends_local[1:104]);
training_matrix <- data.frame(ts_Y, ts_XGG, ts_XGL);
### Try VAR(3)
var_model <- VAR (y=training_matrix, p=3, type="both", season=NULL,
exogen=NULL, lag.max=NULL);
## Out of sample forecasting
var.lm = lm(var_model$varresult$ts_Y); # the generated LM
ts_Y <- ts(log_residuals[105:155]);
ts_XGG <- ts(salesmodeldata$gtrends_global[105:155]);
ts_XGL <- ts(salesmodeldata$gtrends_local[105:155]);
# Notice how I manually create the lagged values to be used in the
Linear Model
holdout_matrix <- na.omit(...
2011 Feb 16
1
VAR with HAC
Hello,
I would like to estimate a VAR model with HAC corrected standard errors. I tried to do this by using the sandwich package, for example:
> library(vars)
> data(Canada)
> myvar = VAR(Canada, p = 2, type = "const")
> coeftest(myvar, vcov = vcovHAC)
Error in umat - res : non-conformable arrays
Which suggests that this function is not compatible with the VAR command.
2011 Jul 26
0
Extensión de propiedades de una función
...n anexada para que pueda utilizar la respectiva función de manera directa?? O saben algun manual para incorporar funciones u propiedades adicionales a programas desarrollados??
Gracias
Atte
Diego
Anexo la programación de interes
".fecov" <-
function(x, n.ahead) {
n.par<-sapply(x$varresult, function(x) summary(x)$df[2])
sigma.u <- crossprod(resid(x))/n.par
Sigma.yh <- array(NA, dim = c(x$K, x$K, n.ahead))
Sigma.yh[, , 1] <- sigma.u
Phi <- Phi(x, nstep = n.ahead)
if (n.ahead > 1) {
for (i in 2:n.ahead) {
temp <- matrix(0, nrow = x$K, ncol = x$K)...