Displaying 2 results from an estimated 2 matches for "forecastingfinancialrisk".
2013 Jul 26
1
number of items to replace is not a multiple of replacement length
Hi All,
I have 5 stock values and i am calculating EWMA
followed the logic as given ind following link.[
http://www.orecastingfinancialrisk.com/3.html<http://www.forecastingfinancialrisk.com/3.html>
]
library('tseries')
returns[,1]<-returns[,1]-mean(returns[,1])
returns[,2]<-returns[,2]-mean(returns[,2])
returns[,3]<-returns[,3]-mean(returns[,3])
returns[,4]<-returns[,4]-mean(returns[,4])
returns[,5]<-returns[,5]-mean(returns[,5])
T<-length(returns[,1]...
2013 Jul 17
2
EWMA error
hi,
Could anyone help me in solving the following error:
I have 5 stocks returns data (returns)
EWMA = matrix(nrow=T,ncol=5) # create a matrix to hold the
covariance matrix for each t
lambda = 0.94
S<-cov(returns) # initial (t=1) covariance matrix
EWMA[1,] = c(S)[c(1,4,2)] ---ERROR # extract the
variances and covariancefor (i in 2:T)
{ # loop