search for: portfoliospec

Displaying 11 results from an estimated 11 matches for "portfoliospec".

2011 Jul 10
1
Code Help
Am I missing a Package? I'm not sure why is won't read the functions. Any help is much appreciated. > PData = Data[,3:10] > Spec = portfolioSpec() Error: could not find function "portfolioSpec" > setTargetReturn(Spec) = mean(colMeans(PData)) Error in setTargetReturn(Spec) = mean(colMeans(PData)) : object 'Spec' not found > Constraints = "LongOnly" > efficientPortfolio(PData, Spec, Constraints) Error:...
2009 Sep 16
2
I want to get a reference to this time series object
...int errorOccurred,nx,ny,i,j; double *v; const char *x,*y; Rf_initEmbeddedR(argc, argv); // loading fPortfolio PROTECT(e = lang2(install("library"), mkString("fPortfolio"))); R_tryEval(e, R_GlobalEnv, NULL); UNPROTECT(1); // creating a default portfolioSpec object PROTECT(e=lang1(install("portfolioSpec"))); PROTECT(portSpec=R_tryEval(e,R_GlobalEnv, NULL)); // creating a portfolioData object PROTECT(e=lang4(install("c"),mkString("SBI"),mkString("SPI"),mkString("SII"))); PROTECT(c=R_tr...
2009 Sep 29
3
How do I access class slots from C?
Hi I'm trying to implement something similar to the following R snippet using C. I seem to have hit the wall on accessing class slots using C. library(fPortfolio) lppData <- 100 * LPP2005.RET[, 1:6] ewSpec <- portfolioSpec() nAssets <- ncol(lppData) setWeights(ewSpec) <- rep(1/nAssets, times = nAssets) ewPortfolio <- feasiblePortfolio( data = lppData, spec = ewSpec, constraints = "LongOnly") ewSpec is an object of type Portfolio Spec which has the following slots: model slot type =...
2008 Aug 12
1
fPortfolio constraints, maxsumW
...straint, "maxsumW[1:2Assets]=13.63" fails. The relevant section of my code file and the resulting error message are pasted below. Suggestions about how to correct my coding would be most welcome. *************Code beings here************************ Data = as.timeSeries(Jdata) Spec = portfolioSpec() setNFrontierPoints(Spec) = 150 Spec Constraint = c("minW[1:nAssets]=0", "maxsumW[1:2Assets]=13.63") frontier = portfolioFrontier(Data, Spec, Constraint) **************Error message begins here*************** Error in parse(text = constraints[i]) : unexpected symbol in &quot...
2012 Feb 15
2
Control number of assets in resulting portfolio with optimizations using package fPortfolio
Dear All, I am using package fPortfolio to run minimum variance portfolio optimizations in R. I already know how to set portfolioSpecs, portfolio objects and constraints. Unfortunately I am not able to set the following type of constraints. I have a timeSeries object with returns data for roughly 1.5k assets for 261 subperiods (workingdays) and want to compute the global minimum variance portfolio, considering following constrai...
2008 Sep 03
1
portfolio.optim and assets with weigth equals to zero...
Hello. I don't understand a particular output of portfolio.optim (tseries). I have 4 assets and the portfolio.optim returns an asset with weight equals to zero. If I do a portfolio.optim with 3 assets, without the asset with weight equals to zero, it returns a completely different result. That's I would expected the same weights as the run with 4 assets. Below the code. Thanks in
2017 Dec 27
1
Error in dimnames in R
...t;) colnames(PAGEX) <- c("PAGEX") # Merging returns of the assets (excluding NA's) portfolio_returns <- merge(LUTAX, PFODX,BRGAX,GFAFX,NMSAX,EGINX,IPOYX,SCWFX,FGLDX,PAGEX,all=F) data <- as.timeSeries(portfolio_returns) #Optimisation portfolio library(fPortfolio) spec <- portfolioSpec() setNFrontierPoints <- 25 setSolver(spec) <- "solveRquadprog" constraints <- c("minW[1:1]=0.12","maxW[1:1]=0.18","minW[2:2]=0.12","maxW[2:2]=0.18", "minW[3:3]=0.10","maxW[3:3]=0.15","minW[4:4]=0.08","max...
2010 Feb 03
0
About the risk code in the fportfolio package
...ata[, c("CA", "SS", "EM", "EMN", "ED", "DS", "MS", "RA", "FIA", "GM", "LSE", "MF", "SP500", "NASDAQ", "JPM")] d = as.timeSeries(Data) class(d) Spec = portfolioSpec() setNFrontierPoints(Spec) = 1000 setRiskFreeRate(Spec) = 3 Constraints = "both" Frontier = portfolioFrontier(d, Spec, Constraints) frontierPlot(Frontier, pch = 19, col = c("black", "grey"), add = FALSE, labels = TRUE, return = c("mean"), risk = c("Cov&...
2011 Jan 25
0
Problems plotting the efficient frontier with fPortfolio
Hello, I have some simulations of financial data, I have 17 variables simulated 1000 times to three horizons. I am tring to plot the efficient frontier which I already obtained using th fPortfolio package. I am using the following commands: Data=timeSeries(X[1,,]) lppSpec <- portfolioSpec() longFrontier <- portfolioFrontier(Data, lppSpec) plot(longFrontier) Selección: 1 Error en dimnames(x) <- dn : la longitud de 'dimnames' [1] no es igual a la extensión del arreglo > tailoredFrontierPlot(object = longFrontier, mText = "MV Portfolio - LongOnlyConstraints&quot...
2012 Sep 04
0
Calculate a minimum-variance portfolio with fPortfolio
...# Constraints box.1 <- paste0("minW[1:nAssets] = ", 0) box.2 <- paste0("maxW[1:nAssets] = ", 0.10) box.3 <- "maxsumW[1:nAssets] = 1" box.4 <- "minsumW[1:nAssets] = 1" boxConstraints <- c(box.1, box.2, box.3, box.4) # Portfolio Specs Spec <- portfolioSpec() # Calculate MinVar Portfolio minvar <- minvariancePortfolio( data = data, spec = Spec, constraints = boxConstraints) 5. Thanks a lot for your help! Markus Douglas, Jr. -- View this message in context: http://r.789695.n4.nabble.com/Calculate-a-minimum-variance-portfolio-wi...
2013 Jan 06
0
fPortfolio-portfolio optimization
...stopifnot(inherits(x, "timeSeries")) x.mat = x mu = mu.pred Sigma = .cov.shrink(x = x.mat, verbose = FALSE, ...) attr(Sigma, "lambda.var") <- NULL attr(Sigma, "lambda.var.estimated") <- NULL list(mu = mu, Sigma = Sigma) } portfolio1=portfolioSpec() a=ts(ret.mat[(1:60),(1:n.assets)]) setEstimator(portfolio1)="myEstimator" portfolio2=tangencyPortfolio(data=a, spec=portfolio1) [[alternative HTML version deleted]]