The code is as follows:



monthreturns<-read.zoo('monthlyReturn date.csv',sep=",",header=T)

monthreturns<-as.xts(monthreturns,order.by
=index(monthreturns),frequency=NULL)*W0

head(monthreturns)

dim(monthreturns)



portnames<-c('acc','cipla','cmc','idbi','ifci')  ----portfolio names (5
stocks)

mu.vec<-c(0.1,0.2,0.2,0.4,0.1)

names(mu.vec)<-portnames

covmatr<-cov(monthreturns,use='complete')

sigma.matr<-sqrt(covmatr)

head(sigma.matr)

dim(sigma.matr)



library(PerformanceAnalytics)

VaR(r=monnthreturns,p=0.99,method='historical',mu=mu.vec,sigma=sigma.matr,weights=NULL)*W0



*But here I am getting the following error: *

>
VaR(r=monnthreturns,p=0.99,method='historical',mu=mu.vec,sigma=sigma.matr,weights=NULL)*W0

Error in VaR(r = monnthreturns, p = 0.99, method = "historical", mu =
mu.vec,  :

  number of items in weights not equal to number of items in the mean vector

* *

*could anyone help*

	[[alternative HTML version deleted]]

