Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Basic programming

  • To: mathgroup at smc.vnet.net
  • Subject: [mg93582] Re: Basic programming
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Sun, 16 Nov 2008 07:03:19 -0500 (EST)

On 11/15/08 at 6:03 AM, frankflip at hotmail.com (BionikBlue) wrote:

>I have daily stock prices for a stock on a 100 day period, I want to
>compute the standard deviation for a rolling 10 days period for the
>whole list of data.

>So basically, I would like to do something like this : stdev(1;;10)
>then stdev(2;;11) until stdev(91;;100) and get the results in a list

If I understand what you want correctly, then

StandardDeviation/@Partition[data, 10, 1]

will create the list you want

Partition with the syntax above creates sublists of length 10
with offsets of 1 for the starting element of each sublist. The
rest simply maps StandardDeviation to each sublist to create a
list of standard deviations


  • Prev by Date: Re: Visulizing the content of a variable
  • Next by Date: Re: Bug in DateString with TimeZone?
  • Previous by thread: Re: Basic programming
  • Next by thread: Re: Basic programming