简体   繁体   中英

R PerformanceAnalytics::Return.portfolio() generates NaN when geometric=TRUE

I am struggling with PerformanceAnalytics::Return.portfolio() where if I try to set the parameter geometric=TRUE I get NaN as the return series. If I set the geometric=FALSE then I get the returns calculated.

I have obviously made sure that there are no "na" or "nan" or "inf" values in the input return series and the weights series.

Any pointers?

The call is:

stratRets <- PerformanceAnalytics::Return.portfolio(R = rets, weights = weights, geometric = TRUE)

I can't copy the return and weights dataframes here as they contain thousands of rows. I will try to come up with a smaller example to reproduce the issue and post it here shortly.

Meanwhile any quick pointers on what to check will be greatly appreciated.

答案是删除权重总计为0的开头的任何行。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM