[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-sig-finance
Subject:    Re: [R-SIG-Finance] fPortfolio and minimum variance portfolio
From:       amarjit chandhial <a.chandhial () btinternet ! com>
Date:       2014-05-13 8:19:55
Message-ID: 1399969195.87488.YahooMailNeo () web186002 ! mail ! ir2 ! yahoo ! com
[Download RAW message or body]

Try:


 library(fPortfolio)

 ?minvariancePortfolio


#>From the Examples

## data -
   Data = SMALLCAP.RET
   Data = Data[, c("BKE", "GG", "GYMB", "KRON")]
   Data
   
## spec -
   Spec = portfolioSpec()
   setTargetReturn(Spec) = mean(colMeans(Data))
   Spec
   
## constraints -
   Constraints = "LongOnly"
   Constraints
   
## efficientPortfolio -
#   efficientPortfolio(Data, Spec, Constraints)
   
## tangency Portfolio -
#   tangencyPortfolio(Data, Spec, Constraints)   
   
## minvariancePortfolio -
   result <- minvariancePortfolio(Data, Spec, Constraints)


##########

#Via result
#-------------

 print(result)
 attributes(result)

 result@portfolio
 result@portfolio@portfolio
 result@portfolio@portfolio$targetReturn[1]
 result@portfolio@portfolio$targetRisk[2]




Amarjit

 

________________________________
 From: Albert Darenberg <albert.darenberg@gmail.com>
To: r-sig-finance@r-project.org 
Sent: Tuesday, 13 May 2014, 0:01
Subject: [R-SIG-Finance] fPortfolio and minimum variance portfolio
  

I'm using fPortfolio to determine the minimum variance portfolio which
works fine. However, I can't seem to get direct access to the Target Return
and Risk values.

result <- minvariancePortfolio(data, globminSpec, "LongOnly")


will output


[..]

Target Return and Risks:
  mean     mu    Cov  Sigma
0.0302 0.0302 0.0143 0.0143

[..]


The question is how can I directly access "mean" and "Sigma"?


I tried  getTargetReturn(result) but it returns "NA"

    [[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.
	[[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.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic