afx111
2009-Aug-17 05:43 UTC
[R] Newbie question re stddev, quantmod and performanceanalytics
Hi, I am trying to calculate the std dev of returns of YHOO so far i got: getSymbols("YHOO") retYHOO <- Return.calculate(Cl(YHOO))> sd(retYHOO)YHOO.Close NA but i received an NA....can any assist? tks! -- View this message in context: http://www.nabble.com/Newbie-question-re-stddev%2C-quantmod-and-performanceanalytics-tp25001293p25001293.html Sent from the R help mailing list archive at Nabble.com.
Stefan Grosse
2009-Aug-17 12:01 UTC
[R] Newbie question re stddev, quantmod and performanceanalytics
On Sun, 16 Aug 2009 22:43:14 -0700 (PDT) afx111 <afx111 at yahoo.com> wrote: A> getSymbols("YHOO") A> retYHOO <- Return.calculate(Cl(YHOO)) A> > sd(retYHOO) A> A> YHOO.Close A> NA A> A> but i received an NA....can any assist? tks! You receive NA because getSymbols went wrong, so YHOO was empty. Try getSymbols('YHOO',src='yahoo',return.class='ts') Btw. there is a r-finance mailing list which is a good place for such questions. Hth Stefan
John Kane
2009-Aug-17 14:27 UTC
[R] Newbie question re stddev, quantmod and performanceanalytics
What package or library are you using? What is YHOO.Close ? Try str(retYHOO) to see what it looks like. --- On Mon, 8/17/09, afx111 <afx111 at yahoo.com> wrote:> From: afx111 <afx111 at yahoo.com> > Subject: [R] Newbie question re stddev, quantmod and performanceanalytics > To: r-help at r-project.org > Received: Monday, August 17, 2009, 1:43 AM > > Hi, > > I am trying to calculate the std dev of returns of YHOO so > far i got: > > getSymbols("YHOO") > retYHOO <- Return.calculate(Cl(YHOO)) > > sd(retYHOO) > > YHOO.Close > ? ? ? ? NA > > but i received an NA....can any assist? tks! > -- > View this message in context: http://www.nabble.com/Newbie-question-re-stddev%2C-quantmod-and-performanceanalytics-tp25001293p25001293.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org > mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, > reproducible code. >__________________________________________________________________ Be smarter than spam. See how smart SpamGuard is at giving junk email the boot with
jim holtman
2009-Aug-17 15:55 UTC
[R] Newbie question re stddev, quantmod and performanceanalytics
try: ?sd sd(retYHOO, na.rm=TRUE) On Mon, Aug 17, 2009 at 1:43 AM, afx111<afx111 at yahoo.com> wrote:> > Hi, > > I am trying to calculate the std dev of returns of YHOO so far i got: > > getSymbols("YHOO") > retYHOO <- Return.calculate(Cl(YHOO)) >> sd(retYHOO) > > YHOO.Close > ? ? ? ?NA > > but i received an NA....can any assist? tks! > -- > View this message in context: http://www.nabble.com/Newbie-question-re-stddev%2C-quantmod-and-performanceanalytics-tp25001293p25001293.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?