<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>statalgo &#187; Time Series</title>
	<atom:link href="http://www.statalgo.com/tag/time-series/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.statalgo.com</link>
	<description>Computational Statistics, Machine Learning, et. al.</description>
	<lastBuildDate>Sat, 19 Nov 2011 17:34:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Time Series in R</title>
		<link>http://www.statalgo.com/2010/05/08/time-series-in-r/</link>
		<comments>http://www.statalgo.com/2010/05/08/time-series-in-r/#comments</comments>
		<pubDate>Sat, 08 May 2010 20:25:45 +0000</pubDate>
		<dc:creator>Shane</dc:creator>
				<category><![CDATA[R]]></category>
		<category><![CDATA[Time Series]]></category>
		<category><![CDATA[fts]]></category>
		<category><![CDATA[its]]></category>
		<category><![CDATA[timeSeries]]></category>
		<category><![CDATA[ts]]></category>
		<category><![CDATA[xts]]></category>
		<category><![CDATA[zoo]]></category>

		<guid isPermaLink="false">http://www.statalgo.com/?p=480</guid>
		<description><![CDATA[There are many time series packages in R, so someone coming from a commercial application (e.g. Matlab or S-Plus) can experience a learning curve (and some amount of frustration) trying to learn the best toolkit. R comes with one object called ts() which is useful for regularly spaced time series, such as daily, monthly, or [...]]]></description>
			<content:encoded><![CDATA[<p>There are many time series packages in R, so someone coming from a commercial application (e.g. Matlab or S-Plus) can experience a learning curve (and some amount of frustration) trying to learn the best toolkit.</p>
<p>R comes with one object called <code>ts()</code> which is useful for regularly spaced time series, such as daily, monthly, or yearly data (see <code>help(ts)</code> for more details).  See<a href="http://www.statoek.wiso.uni-goettingen.de/veranstaltungen/zeitreihen/sommer03/ts_r_intro.pdf"> "Time Series Analysis with R"</a> for an example of how to work with this.</p>
<p>This is frequently insufficient for our purposes. As such, I will primarily use the <a href="http://cran.r-project.org/web/packages/zoo/index.html"><strong>zoo </strong></a>and <a href="http://cran.r-project.org/web/packages/xts/index.html"><strong>xts </strong></a>packages on this blog.  The other options are timeSeries (which is part of <strong><a href="https://www.rmetrics.org/">Rmetrics</a></strong>), its, or fts (from Whit Armstrong).  I will touch on some of the differences along the way.  You can find more about <a href="http://cran.r-project.org/web/views/TimeSeries.html">the time series package on the CRAN view</a>.</p>
<p><a href="http://cran.r-project.org/web/packages/zoo/index.html"><strong>zoo </strong></a>was created originally by Achim Zeileis in 2005, and it stands for "Zeileis's ordered observations", with many subsequent contributions from Gabor Grothendieck.  One of the nice things about zoo is that it is an S3 class in R, and it works with most of the standard R matrix functions (such as <code>summary</code>, <code>cbind</code>, <code>merge</code>, and <code>aggregate</code>).  Hence it has a relatively small learning curve and the authors put a lot of thought into making it just work as expected.</p>
<p>Here's a quick example creating a dummy multivariate time series, getting a summary of the output, and plotting it:</p>
<p><code>&gt; x1 &lt;- zoo(matrix(rnorm(12), nrow = 6), as.Date("2008-08-01") + 0:10)<br />
&gt; colnames (x1) &lt;- c ("A", "B")<br />
&gt; summary(x1)<br />
     Index                  A                 B<br />
 Min.   :2008-08-01   Min.   :-1.6231   Min.   :-1.3363<br />
 1st Qu.:2008-08-03   1st Qu.:-0.9867   1st Qu.:-0.7071<br />
 Median :2008-08-06   Median :-0.5078   Median :-0.5753<br />
 Mean   :2008-08-06   Mean   :-0.1310   Mean   :-0.1270<br />
 3rd Qu.:2008-08-08   3rd Qu.: 0.6633   3rd Qu.: 0.6533<br />
 Max.   :2008-08-11   Max.   : 1.8866   Max.   : 1.0704<br />
&gt; plot(x1)</code></p>
<p>Read <a href="http://cran.r-project.org/web/packages/zoo/vignettes/zoo.pdf">the zoo vignette</a> for more details.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.statalgo.com/2010/05/08/time-series-in-r/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

