| To: | "Leeds, Mark" <mleeds@mlp.com>, <s-news@wubios.wustl.edu> |
|---|---|
| Subject: | Re: a movjng average median |
| From: | "Eric Zivot" <ezivot@u.washington.edu> |
| Date: | Mon, 20 Oct 2003 13:58:48 -0700 |
| Importance: | Normal |
| In-reply-to: | <37DA35FDF352A24AB931404B856180FA02FB0B@MAIL002.AD.MLP.COM> |
|
Something like this is particularly easy using the S-PLUS command
aggregateSeries. To illustrate, suppose you have a time series object ret.ts
containing daily returns on an asset. To compute the median over a window of
length say 24 days incremented by one day use
roll.median =
aggregateSeries(ret.ts,moving=24,adj=1,FUN=median)
The
arguments moving=24, adj=1 and FUN=median tell the splus function
aggregateSeries to evaluate the median function on a moving window of length 24
and to adjust the output positions to the end of each window.
I
discuss several extensions of calculations like this in chapter 9 of my book
Modeling Financial Time Series with Splus. ez
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | a movjng average median, Leeds, Mark |
|---|---|
| Next by Date: | combine dataframes with continuous id, Mathangi Gopalakrishnan |
| Previous by Thread: | a movjng average median, Leeds, Mark |
| Next by Thread: | combine dataframes with continuous id, Mathangi Gopalakrishnan |
| Indexes: | [Date] [Thread] [Top] [All Lists] |