Well, your code is completely mangled by posting in HTML, as Josh told
you would likely happen.

In any case, You haven't provided a reproducible example.

require(PerformanceAnalytics)
data(edhec) # also monthly data
VaR(edhec,
p=0.95, method='modified') 
# the last two parameters are defaults, and
didn't need to be specified

works fine, so I think you need to provide more information.

Your csv data file (as text) could easily be attached to your email, or
posted online somewhere, or added to a github issue on the
PerformanceAnalytics repository, or something.

I don't understand why you are doing as.matrix on your data when you
already have a time series.  You should prefer to use the time series
whenever possible. Just pass 'testdata' to the VaR function

One issue if you were doing component VaR is that you have a rank-
deficient moments matrix. You are windowing only 100-ish months of data
for 216 instruments.  For the univariate calculation in your example,
this shouldn't matter though.

Perhaps you should open a github issue that actually contains all the
information required to examine your problem.

Regards,

Brian

On Tue, 2018-03-13 at 14:30 +0000, Pankaj K Agarwal via R-SIG-Finance
wrote:
> Dear Joshua SirHere is my data and my code:
> R Version 3.4.2
> 1. Data:File:data.csvMonthly returns of 210 assets from April 2006
> till March 2015
> 2. Code:#Reading filedat1<-
> read.csv("data.csv",header=TRUE,stringsAsFactors=FALSE)#Load
> zoolibrary(zoo)#Creating a zoo objectdat1.z<-read.zoo(dat1, header =
> TRUE, FUN =function(x) as.yearmon(format(x, nsmall = 2),"%b-
> %y"))#Subseting datatestdata<-window(dat1.z,start=as.yearmon("Apr
> 2006"),end=as.yearmon("Mar 2010"))#Computing
> VaRlibrary(PerformanceAnalytics)library(PortfolioAnalytics)VaR(as.mat
> rix(testdata)/100,p=0.95,method="modified")
> Problem:The last command gives the following output:
> Error in dimnames(cd) <- list(as.character(index(x)), colnames(x))
> :   'dimnames' applied to non-array
> Kindly advise how to resolve it. 
> 
> Regards,Pankaj K Agarwal
> +91-98397-11444http://in.linkedin.com/in/pankajkagarwal/ 
> 
>     On Monday, 12 March, 2018, 6:30:27 PM IST, Joshua Ulrich <josh.m.
> ulr...@gmail.com> wrote:  
>  
>  It would be easier for others to help you if you provided a
> reproducible example.  Here are some tips on how to create one:
> https://stackoverflow.com/q/5963269/271616
> 
> Also, please follow the posting guide and send plain text emails, not
> HTML.  The latter are likely to be mangled by the list server, which
> makes them hard to read (and is another impediment to someone trying
> to help).
> 
> On Mon, Mar 12, 2018 at 7:52 AM, Pankaj K Agarwal via R-SIG-Finance
> <r-sig-finance@r-project.org> wrote:
> > Dear all,I am using a dataset of monthly asset returns. I subset it
> > with window() call of package zoo. When i try to compute Modified
> > VaR on this subset, i am getting the following error:
> > Error in dimnames(cd) <- list(as.character(index(x)), colnames(x))
> > :  'dimnames' applied to non-array
> > Can someone help? I googled it a lot but still nothing seems to be
> > working.
> > Regards,
> > Pankaj K Agarwal
> > +91-98397-11444http://in.linkedin.com/in/pankajkagarwal/
> > 
> >         [[alternative HTML version deleted]]
> > 
> > _______________________________________________
> > R-SIG-Finance@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> > -- Subscriber-posting only. If you want to post, subscribe first.
> > -- Also note that this is not the r-help list where general R
> > questions should go.
> 
> 
>

_______________________________________________
R-SIG-Finance@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should 
go.

Reply via email to