<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Research tips</title>
	
	<link>http://robjhyndman.com/researchtips</link>
	<description>A blog by Rob J Hyndman</description>
	<lastBuildDate>Wed, 23 May 2012 01:34:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/RobJHyndman-ResearchTips" /><feedburner:info uri="robjhyndman-researchtips" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>RobJHyndman-ResearchTips</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>My new forecasting textbook</title>
		<link>http://feedproxy.google.com/~r/RobJHyndman-ResearchTips/~3/87pQfr2r1jA/</link>
		<comments>http://robjhyndman.com/researchtips/fpp/#comments</comments>
		<pubDate>Wed, 23 May 2012 01:34:03 +0000</pubDate>
		<dc:creator>Rob J Hyndman</dc:creator>
				<category><![CDATA[Research tips]]></category>
		<category><![CDATA[forecasting]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[references]]></category>
		<category><![CDATA[writing]]></category>

		<guid isPermaLink="false">http://robjhyndman.com/researchtips/?p=1846</guid>
		<description><![CDATA[After years of saying that I was going to write a book to replace Makridakis, Wheelwright and Hyndman (1998), I’m finally ready to make an announcement! My new book is Forecasting: principles and practice, co-authored with George Athanasopoulos. It is available online and free-of-charge. We have written about 2/3 of the book so far (all of which is already available online), and we plan to finish it by the end of 2012. We hope to make a print version of the book available on Amazon in early 2013. This textbook is intended to provide a comprehensive introduction to forecasting methods and present enough information about each method for readers to use them sensibly. We don’t attempt to give a thorough discussion of the theoretical details behind each method, although the references at the end of each chapter will fill in many of those details. We use R throughout the book and we intend students to learn how to forecast with R. The book has it’s own R package: fpp. This contains all the data sets used in the book, and also loads a few other packages that are necessary to complete the examples. The book is different from other forecasting textbooks in<a href="http://robjhyndman.com/researchtips/fpp/"> <br /><br /> (More)…</a>]]></description>
			<content:encoded><![CDATA[<p>After years of saying that I was going to write a book to replace <a href="http://robjhyndman.com/forecasting/">Makridakis, Wheelwright and Hyndman (1998)</a>, I’m finally ready to make an announcement!</p>
<p>My new book is <em><strong><a href="http://otexts.com/fpp/">Forecasting: principles and practice</a></strong></em>, co-authored with George Athanasopoulos. It is available online and free-of-charge. We have written about 2/3 of the book so far (all of which is already available online), and we plan to finish it by the end of 2012. We hope to make a print version of the book available on Amazon in early 2013.</p>
<p>This textbook is intended to provide a comprehensive introduction to forecasting methods and present enough information about each method for readers to use them sensibly. We don’t attempt to give a thorough discussion of the theoretical details behind each method, although the references at the end of each chapter will fill in many of those details. We use R throughout the book and we intend students to learn how to forecast with R.</p>
<p>The book has it’s own R package: <a href="http://robjhyndman.com/software/fpp/">fpp</a>. This contains all the data sets used in the book, and also loads a few other packages that are necessary to complete the examples.</p>
<p>The book is different from other forecasting textbooks in several ways.</p>
<ul>
<li>It is free and online, making it accessible to a wide audience.</li>
<li>It is based around the <a href="http://robjhyndman.com/software/forecast/">forecast package for R</a>.</li>
<li>It is continuously updated. You don’t have to wait until the next edition for errors to be removed or new methods to be discussed. We will update the book frequently.</li>
<li>There are dozens of real data examples taken from our own consulting practice. We have worked with hundreds of businesses and organizations helping them with forecasting issues, and this experience has contributed directly to many of the examples given here, as well as guiding our general philosophy of forecasting.</li>
<li>We emphasise graphical methods more than most forecasters. We use graphs to explore the data, analyse the validity of the models fitted and present the forecasting results.</li>
</ul>
<p> </p>

<p><a href="http://feedads.g.doubleclick.net/~a/-Jg2x9LNl5V1TsIZaE6CPsdZHOQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/-Jg2x9LNl5V1TsIZaE6CPsdZHOQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/-Jg2x9LNl5V1TsIZaE6CPsdZHOQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/-Jg2x9LNl5V1TsIZaE6CPsdZHOQ/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/RobJHyndman-ResearchTips/~4/87pQfr2r1jA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://robjhyndman.com/researchtips/fpp/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://robjhyndman.com/researchtips/fpp/</feedburner:origLink></item>
		<item>
		<title>Blog aggregators</title>
		<link>http://feedproxy.google.com/~r/RobJHyndman-ResearchTips/~3/R3SDPHUbOLs/</link>
		<comments>http://robjhyndman.com/researchtips/blog-aggregators/#comments</comments>
		<pubDate>Tue, 15 May 2012 10:34:39 +0000</pubDate>
		<dc:creator>Rob J Hyndman</dc:creator>
				<category><![CDATA[Research tips]]></category>
		<category><![CDATA[journals]]></category>
		<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[statistics]]></category>

		<guid isPermaLink="false">http://robjhyndman.com/researchtips/?p=1840</guid>
		<description><![CDATA[A very useful way of keeping up with blogs in a particular area is to subscribe to a blog aggregator. These will syndicate posts from a large number of blogs and provide links back to the original sources. So you only need to subscribe once to get all the good stuff in that area. There are now several blog aggregators available that might be of interest to readers here. And this blog is now syndicated on several other sites including those listed below. R-bloggers: for all R-related blogs. The posts tagged R from this blog are syndicated there along with about 300 other R blogs. Statsblogs for statistical blogs. This is a very new aggregator, but is growing fast. There is naturally some overlap with R-bloggers. All posts from this blog are syndicated there. TeX community for TeX related blogs. The posts tagged LaTeX from this blog are syndicated there along with about 40 other TeX blogs. Mathblogging.org aggregates a number of mathematics blogs. All posts from this blog are syndicated there. In addition, for those interested in economics, EconAcademics.org aggregates a number of economics blogs (but does not include this blog as I rarely post anything about economics). I have also set<a href="http://robjhyndman.com/researchtips/blog-aggregators/"> <br /><br /> (More)…</a>]]></description>
			<content:encoded><![CDATA[<p>A very useful way of keeping up with blogs in a particular area is to subscribe to a blog aggregator. These will syndicate posts from a large number of blogs and provide links back to the original sources. So you only need to subscribe once to get all the good stuff in that area.</p>
<p>There are now several blog aggregators available that might be of interest to readers here. And this blog is now syndicated on several other sites including those listed below.<span id="more-1840"></span></p>
<ul>
<li><strong><a class="vt-p" href="http://www.r-bloggers.com/">R-bloggers</a></strong>: for all R-related blogs. The posts tagged R from this blog are syndicated there along with about 300 other R blogs.</li>
<li><strong><a class="vt-p" href="http://www.statsblogs.com/">Statsblogs</a></strong> for statistical blogs. This is a very new aggregator, but is growing fast. There is naturally some overlap with R-bloggers. All posts from this blog are syndicated there.</li>
<li><strong><a class="vt-p" href="http://www.texample.net/community/">TeX community</a></strong> for TeX related blogs. The posts tagged LaTeX from this blog are syndicated there along with about 40 other TeX blogs.</li>
<li><strong><a class="vt-p" href="http://www.mathblogging.org/">Mathblogging.org</a></strong> aggregates a number of mathematics blogs. All posts from this blog are syndicated there.</li>
</ul>
<p>In addition, for those interested in economics, <strong><a class="vt-p" href="http://econacademics.org/">EconAcademics.org</a></strong> aggregates a number of economics blogs (but does not include this blog as I rarely post anything about economics).</p>
<p>I have also set up two aggregations for new research papers:</p>
<ul>
<li><strong><a class="vt-p" href="http://feeds.feedburner.com/StatisticsPapers">StatisticsPapers</a></strong> includes all papers appearing in over 60 of the major statistics journals as well as the <a class="vt-p" href="http://arxiv.org/archive/stat">statistics section of arXiv</a>.</li>
<li><strong><a class="vt-p" href="http://feeds.feedburner.com/Forecasting">Forecasting papers</a></strong> includes all new papers on forecasting that have appeared on <a class="vt-p" href="http://econpapers.repec.org/">RePEc</a> or in either the <a class="vt-p" href="http://www.forecasters.org/ijf/"><em>International Journal of Forecasting</em></a> or the <a class="vt-p" href="http://www3.interscience.wiley.com/journal/2966/home"><em>Journal of Forecasting</em></a>. The papers from RePEc constitute the weekly <a class="vt-p" href="http://lists.repec.org/mailman/listinfo/nep-for/">NEP-FOR report</a>.</li>
</ul>
<p>So if all the blogs around are overwhelming, and you don’t know where to start, select one or two of these aggregators and you’re off and running.</p>
<p>If you’ve no idea how to subscribe to a blog, see my post on <a class="vt-p" href="http://robjhyndman.com/researchtips/google-reader/">using Google Reader</a>.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/ZGKqcDE7kJjQPH1Z1xf5ZpwXupw/0/da"><img src="http://feedads.g.doubleclick.net/~a/ZGKqcDE7kJjQPH1Z1xf5ZpwXupw/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/ZGKqcDE7kJjQPH1Z1xf5ZpwXupw/1/da"><img src="http://feedads.g.doubleclick.net/~a/ZGKqcDE7kJjQPH1Z1xf5ZpwXupw/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/RobJHyndman-ResearchTips/~4/R3SDPHUbOLs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://robjhyndman.com/researchtips/blog-aggregators/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://robjhyndman.com/researchtips/blog-aggregators/</feedburner:origLink></item>
		<item>
		<title>Global Energy Forecasting Competition</title>
		<link>http://feedproxy.google.com/~r/RobJHyndman-ResearchTips/~3/5E145kJyz2U/</link>
		<comments>http://robjhyndman.com/researchtips/gefcom2012/#comments</comments>
		<pubDate>Mon, 14 May 2012 01:24:32 +0000</pubDate>
		<dc:creator>Rob J Hyndman</dc:creator>
				<category><![CDATA[Research tips]]></category>
		<category><![CDATA[forecasting]]></category>
		<category><![CDATA[kaggle]]></category>

		<guid isPermaLink="false">http://robjhyndman.com/researchtips/?p=1824</guid>
		<description><![CDATA[Forecasting competitions are a great way to test new methods and obtain a realistic evaluation of how good they are. So I’m delighted that the IEEE is organizing an energy forecasting competition as outlined by Tao Hong below. Please upgrade your browser]]></description>
			<content:encoded><![CDATA[<p>Forecasting competitions are a great way to test new methods and obtain a realistic evaluation of how good they are. So I’m delighted that the IEEE is organizing an energy forecasting competition as outlined by Tao Hong below.<span id="more-1824"></span></p>
<div class="iframe-wrapper">
  <iframe src="https://docs.google.com/spreadsheet/viewform?formkey=dDdWT1d1NGdnMXBxZ1VMaE4zYjhndUE6MQ" frameborder="0" style="height:1500px;width:620px;">Please upgrade your browser</iframe>
</div>

<p><a href="http://feedads.g.doubleclick.net/~a/ntNE6PmNVA6_gF7seM25eKGYT4M/0/da"><img src="http://feedads.g.doubleclick.net/~a/ntNE6PmNVA6_gF7seM25eKGYT4M/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/ntNE6PmNVA6_gF7seM25eKGYT4M/1/da"><img src="http://feedads.g.doubleclick.net/~a/ntNE6PmNVA6_gF7seM25eKGYT4M/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/RobJHyndman-ResearchTips/~4/5E145kJyz2U" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://robjhyndman.com/researchtips/gefcom2012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://robjhyndman.com/researchtips/gefcom2012/</feedburner:origLink></item>
		<item>
		<title>Seeking help</title>
		<link>http://feedproxy.google.com/~r/RobJHyndman-ResearchTips/~3/NfZoKR4qhLw/</link>
		<comments>http://robjhyndman.com/researchtips/seeking-help/#comments</comments>
		<pubDate>Tue, 08 May 2012 13:23:29 +0000</pubDate>
		<dc:creator>Rob J Hyndman</dc:creator>
				<category><![CDATA[Research tips]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[StackExchange]]></category>

		<guid isPermaLink="false">http://robjhyndman.com/researchtips/?p=1822</guid>
		<description><![CDATA[Every day I receive emails, or comments on this blog, asking for help with R, forecasting, LaTeX, possible research topics, how to install software, or some other thing I’m supposed to know something about. Unfortunately, I cannot provide a one-man help service to the rest of the world. I used to reply to all the requests explaining where to go for help, but I stopped replying a while ago as it took too much time to do even that. If you want help, please ask at either stats.stackexchange.com (for R or statistics questions) or tex.stackexchange.com (for LaTeX questions). Unless you are one of my students, the only questions I will answer are ones that concern my R packages or research papers. And even then, I won’t reply if the answer is in the help files. I write those help files for a reason, so please read them. I’m sorry I can’t do more, but if I did everything people ask me to do, I’d never write any papers or produce any R packages, and I think that’s a better use of my time.]]></description>
			<content:encoded><![CDATA[<p>Every day I receive emails, or comments on this blog, asking for help with R, forecasting, LaTeX, possible research topics, how to install software, or some other thing I’m supposed to know something about. Unfortunately, I cannot provide a one-man help service to the rest of the world. I used to reply to all the requests explaining where to go for help, but I stopped replying a while ago as it took too much time to do even that.</p>
<p>If you want help, please ask at either <a class="vt-p" href="http://stats.stackexchange.com">stats.stackexchange.com</a> (for R or statistics questions) or <a class="vt-p" href="http://tex.stackexchange.com">tex.stackexchange.com</a> (for LaTeX questions).</p>
<p>Unless you are one of my students, the <em>only</em> questions I will answer are ones that concern my R packages or research papers. And even then, I won’t reply if the answer is in the help files. I write those help files for a reason, so please read them.</p>
<p>I’m sorry I can’t do more, but if I did everything people ask me to do, I’d never write any papers or produce any R packages, and I think that’s a better use of my time.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/q_a8QVXgH8ueartB9j4fnCgoE6I/0/da"><img src="http://feedads.g.doubleclick.net/~a/q_a8QVXgH8ueartB9j4fnCgoE6I/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/q_a8QVXgH8ueartB9j4fnCgoE6I/1/da"><img src="http://feedads.g.doubleclick.net/~a/q_a8QVXgH8ueartB9j4fnCgoE6I/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/RobJHyndman-ResearchTips/~4/NfZoKR4qhLw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://robjhyndman.com/researchtips/seeking-help/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://robjhyndman.com/researchtips/seeking-help/</feedburner:origLink></item>
		<item>
		<title>Measuring time series characteristics</title>
		<link>http://feedproxy.google.com/~r/RobJHyndman-ResearchTips/~3/c7ZtHS5NLVQ/</link>
		<comments>http://robjhyndman.com/researchtips/tscharacteristics/#comments</comments>
		<pubDate>Wed, 02 May 2012 07:51:05 +0000</pubDate>
		<dc:creator>Rob J Hyndman</dc:creator>
				<category><![CDATA[Research tips]]></category>
		<category><![CDATA[forecasting]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[statistics]]></category>

		<guid isPermaLink="false">http://robjhyndman.com/researchtips/?p=1796</guid>
		<description><![CDATA[A few years ago, I was working on a project where we measured various characteristics of a time series and used the information to determine what forecasting method to apply or how to cluster the time series into meaningful groups. The two main papers to come out of that project were: Wang, Smith and Hyndman (2006) Characteristic-​​based clustering for time series data. Data Mining and Knowledge Discovery, 13(3), 335–364. Wang, Smith-Miles and Hyndman (2009) “Rule induction for forecasting method selection: meta-​​learning the characteristics of univariate time series”, Neurocomputing, 72, 2581–2594. I’ve since had a lot of requests for the code which one of my coauthors has been helpfully emailing to anyone who asked. But to make it easier, we thought it might be helpful if I post some updated code here. This is not the same as the R code we used in the paper, as I’ve improved it in several ways (so it will give different results). If you just want the code, skip to the bottom of the post. Finding the period of the data Usually in time series work, we know the period of the data (if the observations are monthly, the period is 12, for example).<a href="http://robjhyndman.com/researchtips/tscharacteristics/"> <br /><br /> (More)…</a>]]></description>
			<content:encoded><![CDATA[<p>A few years ago, I was working on a project where we measured various characteristics of a time series and used the information to determine what forecasting method to apply or how to cluster the time series into meaningful groups. The two main papers to come out of that project were:</p>
<ol>
<li><a href="http://robjhyndman.com/papers/characteristic-based-clustering-for-time-series-data/">Wang, Smith and Hyndman (2006) Characteristic-​​based clustering for time series data. <em>Data Mining and Knowledge Discovery</em>, <strong>13</strong>(3), 335–364.</a></li>
<li><a href="http://robjhyndman.com/papers/forecast-rules/">Wang, Smith-Miles and Hyndman (2009) “Rule induction for forecasting method selection: meta-​​learning the characteristics of univariate time series”, <em>Neurocomputin</em>g, <strong>72</strong>, 2581–2594.</a></li>
</ol>
<p>I’ve since had a lot of requests for the code which one of my coauthors has been helpfully emailing to anyone who asked. But to make it easier, we thought it might be helpful if I post some updated code here. This is not the same as the R code we used in the paper, as I’ve improved it in several ways (so it will give different results). If you just want the code, skip to the bottom of the post.<span id="more-1796"></span></p>
<h2>Finding the period of the data</h2>
<p>Usually in time series work, we know the period of the data (if the observations are monthly, the period is 12, for example). But in this project, some of our data was of unknown period and we wanted a method to automatically determine the appropriate period. The method we used was based on local peaks and troughs in the ACF. But I’ve since devised a better approach (<a href="http://stats.stackexchange.com/a/1214/159">prompted on crossvalidated.com</a>) using an estimate of the spectral density:</p>

<div class="wp_codebox"><table><tr id="p17966"><td class="code" id="p1796code6"><pre class="rsplus" style="font-family:monospace;">find.<span style="">freq</span> <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">function</span><span style="color: #080;">&#40;</span>x<span style="color: #080;">&#41;</span>
<span style="color: #080;">&#123;</span>
  n <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">length</span><span style="color: #080;">&#40;</span>x<span style="color: #080;">&#41;</span>
  spec <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">spec.<span style="">ar</span></span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">na.<span style="">contiguous</span></span><span style="color: #080;">&#40;</span>x<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>,<span style="color: #0000FF; font-weight: bold;">plot</span><span style="color: #080;">=</span>FALSE<span style="color: #080;">&#41;</span>
  <span style="color: #0000FF; font-weight: bold;">if</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">max</span><span style="color: #080;">&#40;</span>spec$spec<span style="color: #080;">&#41;</span><span style="color: #080;">&gt;</span><span style="color: #ff0000;">10</span><span style="color: #080;">&#41;</span> <span style="color: #228B22;"># Arbitrary threshold chosen by trial and error.</span>
  <span style="color: #080;">&#123;</span>
    period <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">round</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">1</span><span style="color: #080;">/</span>spec$freq<span style="color: #080;">&#91;</span><span style="color: #0000FF; font-weight: bold;">which.<span style="">max</span></span><span style="color: #080;">&#40;</span>spec$spec<span style="color: #080;">&#41;</span><span style="color: #080;">&#93;</span><span style="color: #080;">&#41;</span>
    <span style="color: #0000FF; font-weight: bold;">if</span><span style="color: #080;">&#40;</span>period<span style="color: #080;">==</span>Inf<span style="color: #080;">&#41;</span> <span style="color: #228B22;"># Find next local maximum</span>
    <span style="color: #080;">&#123;</span>
      j <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">which</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">diff</span><span style="color: #080;">&#40;</span>spec$spec<span style="color: #080;">&#41;</span><span style="color: #080;">&gt;</span><span style="color: #ff0000;">0</span><span style="color: #080;">&#41;</span>
      <span style="color: #0000FF; font-weight: bold;">if</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">length</span><span style="color: #080;">&#40;</span>j<span style="color: #080;">&#41;</span><span style="color: #080;">&gt;</span><span style="color: #ff0000;">0</span><span style="color: #080;">&#41;</span>
      <span style="color: #080;">&#123;</span>
        nextmax <span style="color: #080;">&lt;-</span> j<span style="color: #080;">&#91;</span><span style="color: #ff0000;">1</span><span style="color: #080;">&#93;</span> <span style="color: #080;">+</span> <span style="color: #0000FF; font-weight: bold;">which.<span style="">max</span></span><span style="color: #080;">&#40;</span>spec$spec<span style="color: #080;">&#91;</span>j<span style="color: #080;">&#91;</span><span style="color: #ff0000;">1</span><span style="color: #080;">&#93;</span><span style="color: #080;">:</span><span style="color: #ff0000;">500</span><span style="color: #080;">&#93;</span><span style="color: #080;">&#41;</span>
        <span style="color: #0000FF; font-weight: bold;">if</span><span style="color: #080;">&#40;</span>nextmax <span style="color: #080;">&lt;=</span> <span style="color: #0000FF; font-weight: bold;">length</span><span style="color: #080;">&#40;</span>spec$freq<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
          period <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">round</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">1</span><span style="color: #080;">/</span>spec$freq<span style="color: #080;">&#91;</span>nextmax<span style="color: #080;">&#93;</span><span style="color: #080;">&#41;</span>
        <span style="color: #0000FF; font-weight: bold;">else</span>
          period <span style="color: #080;">&lt;-</span> <span style="color: #ff0000;">1</span>
      <span style="color: #080;">&#125;</span>
      <span style="color: #0000FF; font-weight: bold;">else</span>
        period <span style="color: #080;">&lt;-</span> <span style="color: #ff0000;">1</span>
    <span style="color: #080;">&#125;</span>
  <span style="color: #080;">&#125;</span>
  <span style="color: #0000FF; font-weight: bold;">else</span>
    period <span style="color: #080;">&lt;-</span> <span style="color: #ff0000;">1</span>
&nbsp;
  <span style="color: #0000FF; font-weight: bold;">return</span><span style="color: #080;">&#40;</span>period<span style="color: #080;">&#41;</span>
<span style="color: #080;">&#125;</span></pre></td></tr></table></div>

<p> <br />
The function is called <code>find.freq</code> because time series people often call the period of seasonality the “frequency” (which is of course highly confusing).</p>
<h2>Decomposing the data into trend and seasonal components</h2>
<p>We needed a measure of the strength of trend and the strength of seasonality, and to do this we decomposed the data into trend, seasonal and error terms.</p>
<p>Because not all data could be decomposed additively, we first needed to apply an automated Box-Cox transformation. We tried a range of Box-Cox parameters on a grid, and selected the one which gave the most normal errors. That worked ok, but I’ve since found some papers that provide quite good automated Box-Cox algorithms that I’ve implemented in the forecast package. So this code uses Guerrero’s (1993) method instead.</p>
<p>For seasonal time series, we decomposed the transformed data using an stl decomposition with periodic seasonality.</p>
<p>For non-seasonal time series, we estimated the trend of the transformed data using penalized regression splines via the <a href="cran.r-project.org/package=mgcv">mgcv package</a>.</p>

<div class="wp_codebox"><table><tr id="p17967"><td class="code" id="p1796code7"><pre class="rsplus" style="font-family:monospace;">decomp <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">function</span><span style="color: #080;">&#40;</span>x,<span style="color: #0000FF; font-weight: bold;">transform</span><span style="color: #080;">=</span>TRUE<span style="color: #080;">&#41;</span>
<span style="color: #080;">&#123;</span>
  <span style="color: #0000FF; font-weight: bold;">require</span><span style="color: #080;">&#40;</span>forecast<span style="color: #080;">&#41;</span>
  <span style="color: #228B22;"># Transform series</span>
  <span style="color: #0000FF; font-weight: bold;">if</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">transform</span> <span style="color: #080;">&amp;</span> <span style="color: #0000FF; font-weight: bold;">min</span><span style="color: #080;">&#40;</span>x,na.<span style="">rm</span><span style="color: #080;">=</span>TRUE<span style="color: #080;">&#41;</span> <span style="color: #080;">&gt;=</span> <span style="color: #ff0000;">0</span><span style="color: #080;">&#41;</span>
  <span style="color: #080;">&#123;</span>
    lambda <span style="color: #080;">&lt;-</span> BoxCox.<span style="">lambda</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">na.<span style="">contiguous</span></span><span style="color: #080;">&#40;</span>x<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
    x <span style="color: #080;">&lt;-</span> BoxCox<span style="color: #080;">&#40;</span>x,lambda<span style="color: #080;">&#41;</span>
  <span style="color: #080;">&#125;</span>
  <span style="color: #0000FF; font-weight: bold;">else</span>
  <span style="color: #080;">&#123;</span>
    lambda <span style="color: #080;">&lt;-</span> NULL
    <span style="color: #0000FF; font-weight: bold;">transform</span> <span style="color: #080;">&lt;-</span> FALSE
  <span style="color: #080;">&#125;</span>
  <span style="color: #228B22;"># Seasonal data</span>
  <span style="color: #0000FF; font-weight: bold;">if</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">frequency</span><span style="color: #080;">&#40;</span>x<span style="color: #080;">&#41;</span><span style="color: #080;">&gt;</span><span style="color: #ff0000;">1</span><span style="color: #080;">&#41;</span>
  <span style="color: #080;">&#123;</span>
    x.<span style="">stl</span> <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">stl</span><span style="color: #080;">&#40;</span>x,s.<span style="">window</span><span style="color: #080;">=</span><span style="color: #ff0000;">&quot;periodic&quot;</span>,<span style="color: #0000FF; font-weight: bold;">na.<span style="">action</span></span><span style="color: #080;">=</span><span style="color: #0000FF; font-weight: bold;">na.<span style="">contiguous</span></span><span style="color: #080;">&#41;</span>
    trend <span style="color: #080;">&lt;-</span> x.<span style="">stl</span>$time.<span style="">series</span><span style="color: #080;">&#91;</span>,<span style="color: #ff0000;">2</span><span style="color: #080;">&#93;</span>
    season <span style="color: #080;">&lt;-</span> x.<span style="">stl</span>$time.<span style="">series</span><span style="color: #080;">&#91;</span>,<span style="color: #ff0000;">1</span><span style="color: #080;">&#93;</span>
    remainder <span style="color: #080;">&lt;-</span> x <span style="color: #080;">-</span> trend <span style="color: #080;">-</span> season
  <span style="color: #080;">&#125;</span>
  <span style="color: #0000FF; font-weight: bold;">else</span> <span style="color: #228B22;">#Nonseasonal data</span>
  <span style="color: #080;">&#123;</span>
    <span style="color: #0000FF; font-weight: bold;">require</span><span style="color: #080;">&#40;</span>mgcv<span style="color: #080;">&#41;</span>
    tt <span style="color: #080;">&lt;-</span> <span style="color: #ff0000;">1</span><span style="color: #080;">:</span><span style="color: #0000FF; font-weight: bold;">length</span><span style="color: #080;">&#40;</span>x<span style="color: #080;">&#41;</span>
    trend <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">rep</span><span style="color: #080;">&#40;</span>NA,<span style="color: #0000FF; font-weight: bold;">length</span><span style="color: #080;">&#40;</span>x<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
    trend<span style="color: #080;">&#91;</span><span style="color: #080;">!</span><span style="color: #0000FF; font-weight: bold;">is.<span style="">na</span></span><span style="color: #080;">&#40;</span>x<span style="color: #080;">&#41;</span><span style="color: #080;">&#93;</span> <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">fitted</span><span style="color: #080;">&#40;</span>gam<span style="color: #080;">&#40;</span>x ~ s<span style="color: #080;">&#40;</span>tt<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
    season <span style="color: #080;">&lt;-</span> NULL
    remainder <span style="color: #080;">&lt;-</span> x <span style="color: #080;">-</span> trend
  <span style="color: #080;">&#125;</span>
  <span style="color: #0000FF; font-weight: bold;">return</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">list</span><span style="color: #080;">&#40;</span>x<span style="color: #080;">=</span>x,trend<span style="color: #080;">=</span>trend,season<span style="color: #080;">=</span>season,remainder<span style="color: #080;">=</span>remainder,
    <span style="color: #0000FF; font-weight: bold;">transform</span><span style="color: #080;">=</span><span style="color: #0000FF; font-weight: bold;">transform</span>,lambda<span style="color: #080;">=</span>lambda<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
<span style="color: #080;">&#125;</span></pre></td></tr></table></div>

<p> </p>
<h2>Putting everything on a [0,1] scale</h2>
<p>We wanted to measure a range of characteristics such as strength of seasonality, strength of trend, level of nonlinearity, skewness, kurtosis, serial correlatedness, self-similarity, level of chaoticity (is that a word?) and the periodicity of the data. But we wanted all these on the same scale which meant mapping the natural range of each measure onto [0,1]. The following two functions were used to do this.</p>

<div class="wp_codebox"><table><tr id="p17968"><td class="code" id="p1796code8"><pre class="rsplus" style="font-family:monospace;"><span style="color: #228B22;"># f1 maps [0,infinity) to [0,1]</span>
f1 <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">function</span><span style="color: #080;">&#40;</span>x,a,b<span style="color: #080;">&#41;</span>
<span style="color: #080;">&#123;</span>
  eax <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">exp</span><span style="color: #080;">&#40;</span>a<span style="color: #080;">*</span>x<span style="color: #080;">&#41;</span>
  <span style="color: #0000FF; font-weight: bold;">if</span> <span style="color: #080;">&#40;</span>eax <span style="color: #080;">==</span> Inf<span style="color: #080;">&#41;</span>
    f1eax <span style="color: #080;">&lt;-</span> <span style="color: #ff0000;">1</span>
  <span style="color: #0000FF; font-weight: bold;">else</span>
    f1eax <span style="color: #080;">&lt;-</span> <span style="color: #080;">&#40;</span>eax<span style="color: #080;">-</span><span style="color: #ff0000;">1</span><span style="color: #080;">&#41;</span><span style="color: #080;">/</span><span style="color: #080;">&#40;</span>eax<span style="color: #080;">+</span>b<span style="color: #080;">&#41;</span>
  <span style="color: #0000FF; font-weight: bold;">return</span><span style="color: #080;">&#40;</span>f1eax<span style="color: #080;">&#41;</span>
<span style="color: #080;">&#125;</span>
&nbsp;
<span style="color: #228B22;"># f2 maps [0,1] onto [0,1]</span>
f2 <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">function</span><span style="color: #080;">&#40;</span>x,a,b<span style="color: #080;">&#41;</span>
<span style="color: #080;">&#123;</span>
  eax <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">exp</span><span style="color: #080;">&#40;</span>a<span style="color: #080;">*</span>x<span style="color: #080;">&#41;</span>
  ea <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">exp</span><span style="color: #080;">&#40;</span>a<span style="color: #080;">&#41;</span>
  <span style="color: #0000FF; font-weight: bold;">return</span><span style="color: #080;">&#40;</span><span style="color: #080;">&#40;</span>eax<span style="color: #080;">-</span><span style="color: #ff0000;">1</span><span style="color: #080;">&#41;</span><span style="color: #080;">/</span><span style="color: #080;">&#40;</span>eax<span style="color: #080;">+</span>b<span style="color: #080;">&#41;</span><span style="color: #080;">*</span><span style="color: #080;">&#40;</span>ea<span style="color: #080;">+</span>b<span style="color: #080;">&#41;</span><span style="color: #080;">/</span><span style="color: #080;">&#40;</span>ea<span style="color: #080;">-</span><span style="color: #ff0000;">1</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
<span style="color: #080;">&#125;</span></pre></td></tr></table></div>

<p> <br />
The values of <img src="http://robjhyndman.com/researchtips/wp-content/ql-cache/quicklatex.com-c63f5a3a084d567b6d62758d1c9bc8b8_l3.png" class="ql-img-inline-formula" alt="&#97;" title="Rendered by QuickLaTeX.com" style="vertical-align: 0px;"/> and <img src="http://robjhyndman.com/researchtips/wp-content/ql-cache/quicklatex.com-173b5c22c5ff048f406b49d642c938f4_l3.png" class="ql-img-inline-formula" alt="&#98;" title="Rendered by QuickLaTeX.com" style="vertical-align: 0px;"/> in each function were chosen so the measure had a 90th percentile of 0.10 when the data were iid standard normal, and a value of 0.9 using a well-known benchmark time series.</p>
<h2>Calculating the measures</h2>
<p>Now we are ready to calculate the measures on the original data, as well as on the adjusted data (after removing trend and seasonality).</p>

<div class="wp_codebox"><table><tr id="p17969"><td class="code" id="p1796code9"><pre class="rsplus" style="font-family:monospace;">measures <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">function</span><span style="color: #080;">&#40;</span>x<span style="color: #080;">&#41;</span>
<span style="color: #080;">&#123;</span>
  <span style="color: #0000FF; font-weight: bold;">require</span><span style="color: #080;">&#40;</span>forecast<span style="color: #080;">&#41;</span>
&nbsp;
  N <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">length</span><span style="color: #080;">&#40;</span>x<span style="color: #080;">&#41;</span>
  freq <span style="color: #080;">&lt;-</span> find.<span style="">freq</span><span style="color: #080;">&#40;</span>x<span style="color: #080;">&#41;</span>
  fx <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">frequency</span><span style="color: #080;">=</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">exp</span><span style="color: #080;">&#40;</span><span style="color: #080;">&#40;</span>freq<span style="color: #080;">-</span><span style="color: #ff0000;">1</span><span style="color: #080;">&#41;</span><span style="color: #080;">/</span><span style="color: #ff0000;">50</span><span style="color: #080;">&#41;</span><span style="color: #080;">-</span><span style="color: #ff0000;">1</span><span style="color: #080;">&#41;</span><span style="color: #080;">/</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">1</span><span style="color: #080;">+</span><span style="color: #0000FF; font-weight: bold;">exp</span><span style="color: #080;">&#40;</span><span style="color: #080;">&#40;</span>freq<span style="color: #080;">-</span><span style="color: #ff0000;">1</span><span style="color: #080;">&#41;</span><span style="color: #080;">/</span><span style="color: #ff0000;">50</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
  x <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">ts</span><span style="color: #080;">&#40;</span>x,f<span style="color: #080;">=</span>freq<span style="color: #080;">&#41;</span>
&nbsp;
  <span style="color: #228B22;"># Decomposition</span>
  decomp.<span style="">x</span> <span style="color: #080;">&lt;-</span> decomp<span style="color: #080;">&#40;</span>x<span style="color: #080;">&#41;</span>
&nbsp;
  <span style="color: #228B22;"># Adjust data</span>
  <span style="color: #0000FF; font-weight: bold;">if</span><span style="color: #080;">&#40;</span>freq <span style="color: #080;">&gt;</span> <span style="color: #ff0000;">1</span><span style="color: #080;">&#41;</span>
    fits <span style="color: #080;">&lt;-</span> decomp.<span style="">x</span>$trend <span style="color: #080;">+</span> decomp.<span style="">x</span>$season
  <span style="color: #0000FF; font-weight: bold;">else</span> <span style="color: #228B22;"># Nonseasonal data</span>
    fits <span style="color: #080;">&lt;-</span> decomp.<span style="">x</span>$trend
  adj.<span style="">x</span> <span style="color: #080;">&lt;-</span> decomp.<span style="">x</span>$x <span style="color: #080;">-</span> fits <span style="color: #080;">+</span> <span style="color: #0000FF; font-weight: bold;">mean</span><span style="color: #080;">&#40;</span>decomp.<span style="">x</span>$trend, na.<span style="">rm</span><span style="color: #080;">=</span>TRUE<span style="color: #080;">&#41;</span>
&nbsp;
  <span style="color: #228B22;"># Backtransformation of adjusted data</span>
  <span style="color: #0000FF; font-weight: bold;">if</span><span style="color: #080;">&#40;</span>decomp.<span style="">x</span>$transform<span style="color: #080;">&#41;</span>
    tadj.<span style="">x</span> <span style="color: #080;">&lt;-</span> InvBoxCox<span style="color: #080;">&#40;</span>adj.<span style="">x</span>,decomp.<span style="">x</span>$lambda<span style="color: #080;">&#41;</span>
  <span style="color: #0000FF; font-weight: bold;">else</span>
    tadj.<span style="">x</span> <span style="color: #080;">&lt;-</span> adj.<span style="">x</span>
&nbsp;
  <span style="color: #228B22;"># Trend and seasonal measures</span>
  v.<span style="">adj</span> <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">var</span><span style="color: #080;">&#40;</span>adj.<span style="">x</span>, na.<span style="">rm</span><span style="color: #080;">=</span>TRUE<span style="color: #080;">&#41;</span>
  <span style="color: #0000FF; font-weight: bold;">if</span><span style="color: #080;">&#40;</span>freq <span style="color: #080;">&gt;</span> <span style="color: #ff0000;">1</span><span style="color: #080;">&#41;</span>
  <span style="color: #080;">&#123;</span>
    detrend <span style="color: #080;">&lt;-</span> decomp.<span style="">x</span>$x <span style="color: #080;">-</span> decomp.<span style="">x</span>$trend
    deseason <span style="color: #080;">&lt;-</span> decomp.<span style="">x</span>$x <span style="color: #080;">-</span> decomp.<span style="">x</span>$season
    trend <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">ifelse</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">var</span><span style="color: #080;">&#40;</span>deseason,na.<span style="">rm</span><span style="color: #080;">=</span>TRUE<span style="color: #080;">&#41;</span> <span style="color: #080;">&lt;</span> 1e<span style="color: #080;">-</span>10, <span style="color: #ff0000;">0</span>, 
      <span style="color: #0000FF; font-weight: bold;">max</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">0</span>,<span style="color: #0000FF; font-weight: bold;">min</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">1</span>,<span style="color: #ff0000;">1</span><span style="color: #080;">-</span>v.<span style="">adj</span><span style="color: #080;">/</span><span style="color: #0000FF; font-weight: bold;">var</span><span style="color: #080;">&#40;</span>deseason,na.<span style="">rm</span><span style="color: #080;">=</span>TRUE<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
    season <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">ifelse</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">var</span><span style="color: #080;">&#40;</span>detrend,na.<span style="">rm</span><span style="color: #080;">=</span>TRUE<span style="color: #080;">&#41;</span> <span style="color: #080;">&lt;</span> 1e<span style="color: #080;">-</span>10, <span style="color: #ff0000;">0</span>,
      <span style="color: #0000FF; font-weight: bold;">max</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">0</span>,<span style="color: #0000FF; font-weight: bold;">min</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">1</span>,<span style="color: #ff0000;">1</span><span style="color: #080;">-</span>v.<span style="">adj</span><span style="color: #080;">/</span><span style="color: #0000FF; font-weight: bold;">var</span><span style="color: #080;">&#40;</span>detrend,na.<span style="">rm</span><span style="color: #080;">=</span>TRUE<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
  <span style="color: #080;">&#125;</span>
  <span style="color: #0000FF; font-weight: bold;">else</span> <span style="color: #228B22;">#Nonseasonal data</span>
  <span style="color: #080;">&#123;</span>
    trend <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">ifelse</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">var</span><span style="color: #080;">&#40;</span>decomp.<span style="">x</span>$x,na.<span style="">rm</span><span style="color: #080;">=</span>TRUE<span style="color: #080;">&#41;</span> <span style="color: #080;">&lt;</span> 1e<span style="color: #080;">-</span>10, <span style="color: #ff0000;">0</span>,
      <span style="color: #0000FF; font-weight: bold;">max</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">0</span>,<span style="color: #0000FF; font-weight: bold;">min</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">1</span>,<span style="color: #ff0000;">1</span><span style="color: #080;">-</span>v.<span style="">adj</span><span style="color: #080;">/</span><span style="color: #0000FF; font-weight: bold;">var</span><span style="color: #080;">&#40;</span>decomp.<span style="">x</span>$x,na.<span style="">rm</span><span style="color: #080;">=</span>TRUE<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
    season <span style="color: #080;">&lt;-</span> <span style="color: #ff0000;">0</span>
  <span style="color: #080;">&#125;</span>
&nbsp;
  m <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span>fx,trend,season<span style="color: #080;">&#41;</span>
&nbsp;
  <span style="color: #228B22;"># Measures on original data</span>
  xbar <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">mean</span><span style="color: #080;">&#40;</span>x,na.<span style="">rm</span><span style="color: #080;">=</span>TRUE<span style="color: #080;">&#41;</span>
  s <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">sd</span><span style="color: #080;">&#40;</span>x,na.<span style="">rm</span><span style="color: #080;">=</span>TRUE<span style="color: #080;">&#41;</span>
&nbsp;
  <span style="color: #228B22;"># Serial correlation</span>
  Q <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">Box.<span style="">test</span></span><span style="color: #080;">&#40;</span>x,<span style="color: #0000FF; font-weight: bold;">lag</span><span style="color: #080;">=</span><span style="color: #ff0000;">10</span><span style="color: #080;">&#41;</span>$statistic<span style="color: #080;">/</span><span style="color: #080;">&#40;</span>N<span style="color: #080;">*</span><span style="color: #ff0000;">10</span><span style="color: #080;">&#41;</span>
  fQ <span style="color: #080;">&lt;-</span> f2<span style="color: #080;">&#40;</span>Q,<span style="color: #ff0000;">7.53</span>,<span style="color: #ff0000;">0.103</span><span style="color: #080;">&#41;</span>
&nbsp;
  <span style="color: #228B22;"># Nonlinearity</span>
  p <span style="color: #080;">&lt;-</span> terasvirta.<span style="">test</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">na.<span style="">contiguous</span></span><span style="color: #080;">&#40;</span>x<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>$statistic
  fp <span style="color: #080;">&lt;-</span> f1<span style="color: #080;">&#40;</span>p,<span style="color: #ff0000;">0.069</span>,<span style="color: #ff0000;">2.304</span><span style="color: #080;">&#41;</span>
&nbsp;
  <span style="color: #228B22;"># Skewness</span>
  sk <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">abs</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">mean</span><span style="color: #080;">&#40;</span><span style="color: #080;">&#40;</span>x<span style="color: #080;">-</span>xbar<span style="color: #080;">&#41;</span><span style="color: #080;">^</span><span style="color: #ff0000;">3</span>,na.<span style="">rm</span><span style="color: #080;">=</span>TRUE<span style="color: #080;">&#41;</span><span style="color: #080;">/</span>s<span style="color: #080;">^</span><span style="color: #ff0000;">3</span><span style="color: #080;">&#41;</span>
  fs <span style="color: #080;">&lt;-</span> f1<span style="color: #080;">&#40;</span>sk,<span style="color: #ff0000;">1.510</span>,<span style="color: #ff0000;">5.993</span><span style="color: #080;">&#41;</span>
&nbsp;
  <span style="color: #228B22;"># Kurtosis</span>
  k <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">mean</span><span style="color: #080;">&#40;</span><span style="color: #080;">&#40;</span>x<span style="color: #080;">-</span>xbar<span style="color: #080;">&#41;</span><span style="color: #080;">^</span><span style="color: #ff0000;">4</span>,na.<span style="">rm</span><span style="color: #080;">=</span>TRUE<span style="color: #080;">&#41;</span><span style="color: #080;">/</span>s<span style="color: #080;">^</span><span style="color: #ff0000;">4</span>
  fk <span style="color: #080;">&lt;-</span> f1<span style="color: #080;">&#40;</span>k,<span style="color: #ff0000;">2.273</span>,<span style="color: #ff0000;">11567</span><span style="color: #080;">&#41;</span>
&nbsp;
  <span style="color: #228B22;"># Hurst=d+0.5 where d is fractional difference.</span>
  H <span style="color: #080;">&lt;-</span> fracdiff<span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">na.<span style="">contiguous</span></span><span style="color: #080;">&#40;</span>x<span style="color: #080;">&#41;</span>,<span style="color: #ff0000;">0</span>,<span style="color: #ff0000;">0</span><span style="color: #080;">&#41;</span>$d <span style="color: #080;">+</span> <span style="color: #ff0000;">0.5</span>
&nbsp;
  <span style="color: #228B22;"># Lyapunov Exponent</span>
  <span style="color: #0000FF; font-weight: bold;">if</span><span style="color: #080;">&#40;</span>freq <span style="color: #080;">&gt;</span> N<span style="color: #080;">-</span><span style="color: #ff0000;">10</span><span style="color: #080;">&#41;</span>
      <span style="color: #0000FF; font-weight: bold;">stop</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;Insufficient data&quot;</span><span style="color: #080;">&#41;</span>
  Ly <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">numeric</span><span style="color: #080;">&#40;</span>N<span style="color: #080;">-</span>freq<span style="color: #080;">&#41;</span>
  <span style="color: #0000FF; font-weight: bold;">for</span><span style="color: #080;">&#40;</span>i <span style="color: #0000FF; font-weight: bold;">in</span> <span style="color: #ff0000;">1</span><span style="color: #080;">:</span><span style="color: #080;">&#40;</span>N<span style="color: #080;">-</span>freq<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
  <span style="color: #080;">&#123;</span>
    idx <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">order</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">abs</span><span style="color: #080;">&#40;</span>x<span style="color: #080;">&#91;</span>i<span style="color: #080;">&#93;</span> <span style="color: #080;">-</span> x<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
    idx <span style="color: #080;">&lt;-</span> idx<span style="color: #080;">&#91;</span>idx <span style="color: #080;">&lt;</span> <span style="color: #080;">&#40;</span>N<span style="color: #080;">-</span>freq<span style="color: #080;">&#41;</span><span style="color: #080;">&#93;</span>
    j <span style="color: #080;">&lt;-</span> idx<span style="color: #080;">&#91;</span><span style="color: #ff0000;">2</span><span style="color: #080;">&#93;</span>
    Ly<span style="color: #080;">&#91;</span>i<span style="color: #080;">&#93;</span> <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">log</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">abs</span><span style="color: #080;">&#40;</span><span style="color: #080;">&#40;</span>x<span style="color: #080;">&#91;</span>i<span style="color: #080;">+</span>freq<span style="color: #080;">&#93;</span> <span style="color: #080;">-</span> x<span style="color: #080;">&#91;</span>j<span style="color: #080;">+</span>freq<span style="color: #080;">&#93;</span><span style="color: #080;">&#41;</span><span style="color: #080;">/</span><span style="color: #080;">&#40;</span>x<span style="color: #080;">&#91;</span>i<span style="color: #080;">&#93;</span><span style="color: #080;">-</span>x<span style="color: #080;">&#91;</span>j<span style="color: #080;">&#93;</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span><span style="color: #080;">/</span>freq
    <span style="color: #0000FF; font-weight: bold;">if</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">is.<span style="">na</span></span><span style="color: #080;">&#40;</span>Ly<span style="color: #080;">&#91;</span>i<span style="color: #080;">&#93;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">|</span> Ly<span style="color: #080;">&#91;</span>i<span style="color: #080;">&#93;</span><span style="color: #080;">==</span>Inf <span style="color: #080;">|</span> Ly<span style="color: #080;">&#91;</span>i<span style="color: #080;">&#93;</span><span style="color: #080;">==-</span>Inf<span style="color: #080;">&#41;</span>
      Ly<span style="color: #080;">&#91;</span>i<span style="color: #080;">&#93;</span> <span style="color: #080;">&lt;-</span> NA
  <span style="color: #080;">&#125;</span>
  Lyap <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">mean</span><span style="color: #080;">&#40;</span>Ly,na.<span style="">rm</span><span style="color: #080;">=</span>TRUE<span style="color: #080;">&#41;</span>
  fLyap <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">exp</span><span style="color: #080;">&#40;</span>Lyap<span style="color: #080;">&#41;</span><span style="color: #080;">/</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">1</span><span style="color: #080;">+</span><span style="color: #0000FF; font-weight: bold;">exp</span><span style="color: #080;">&#40;</span>Lyap<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
&nbsp;
  m <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span>m,fQ,fp,fs,fk,H,fLyap<span style="color: #080;">&#41;</span>
&nbsp;
  <span style="color: #228B22;"># Measures on adjusted data</span>
  xbar <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">mean</span><span style="color: #080;">&#40;</span>tadj.<span style="">x</span>, na.<span style="">rm</span><span style="color: #080;">=</span>TRUE<span style="color: #080;">&#41;</span>
  s <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">sd</span><span style="color: #080;">&#40;</span>tadj.<span style="">x</span>, na.<span style="">rm</span><span style="color: #080;">=</span>TRUE<span style="color: #080;">&#41;</span>
&nbsp;
  <span style="color: #228B22;"># Serial</span>
  Q <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">Box.<span style="">test</span></span><span style="color: #080;">&#40;</span>adj.<span style="">x</span>,<span style="color: #0000FF; font-weight: bold;">lag</span><span style="color: #080;">=</span><span style="color: #ff0000;">10</span><span style="color: #080;">&#41;</span>$statistic<span style="color: #080;">/</span><span style="color: #080;">&#40;</span>N<span style="color: #080;">*</span><span style="color: #ff0000;">10</span><span style="color: #080;">&#41;</span>
  fQ <span style="color: #080;">&lt;-</span> f2<span style="color: #080;">&#40;</span>Q,<span style="color: #ff0000;">7.53</span>,<span style="color: #ff0000;">0.103</span><span style="color: #080;">&#41;</span>
&nbsp;
  <span style="color: #228B22;"># Nonlinearity</span>
  p <span style="color: #080;">&lt;-</span> terasvirta.<span style="">test</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">na.<span style="">contiguous</span></span><span style="color: #080;">&#40;</span>adj.<span style="">x</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>$statistic
  fp <span style="color: #080;">&lt;-</span> f1<span style="color: #080;">&#40;</span>p,<span style="color: #ff0000;">0.069</span>,<span style="color: #ff0000;">2.304</span><span style="color: #080;">&#41;</span>
&nbsp;
  <span style="color: #228B22;"># Skewness</span>
  sk <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">abs</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">mean</span><span style="color: #080;">&#40;</span><span style="color: #080;">&#40;</span>tadj.<span style="">x</span><span style="color: #080;">-</span>xbar<span style="color: #080;">&#41;</span><span style="color: #080;">^</span><span style="color: #ff0000;">3</span>,na.<span style="">rm</span><span style="color: #080;">=</span>TRUE<span style="color: #080;">&#41;</span><span style="color: #080;">/</span>s<span style="color: #080;">^</span><span style="color: #ff0000;">3</span><span style="color: #080;">&#41;</span>
  fs <span style="color: #080;">&lt;-</span> f1<span style="color: #080;">&#40;</span>sk,<span style="color: #ff0000;">1.510</span>,<span style="color: #ff0000;">5.993</span><span style="color: #080;">&#41;</span>
&nbsp;
  <span style="color: #228B22;"># Kurtosis</span>
  k <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">mean</span><span style="color: #080;">&#40;</span><span style="color: #080;">&#40;</span>tadj.<span style="">x</span><span style="color: #080;">-</span>xbar<span style="color: #080;">&#41;</span><span style="color: #080;">^</span><span style="color: #ff0000;">4</span>,na.<span style="">rm</span><span style="color: #080;">=</span>TRUE<span style="color: #080;">&#41;</span><span style="color: #080;">/</span>s<span style="color: #080;">^</span><span style="color: #ff0000;">4</span>
  fk <span style="color: #080;">&lt;-</span> f1<span style="color: #080;">&#40;</span>k,<span style="color: #ff0000;">2.273</span>,<span style="color: #ff0000;">11567</span><span style="color: #080;">&#41;</span>
&nbsp;
  m <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span>m,fQ,fp,fs,fk<span style="color: #080;">&#41;</span>
  <span style="color: #0000FF; font-weight: bold;">names</span><span style="color: #080;">&#40;</span>m<span style="color: #080;">&#41;</span> <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;frequency&quot;</span>, <span style="color: #ff0000;">&quot;trend&quot;</span>,<span style="color: #ff0000;">&quot;seasonal&quot;</span>,
    <span style="color: #ff0000;">&quot;autocorrelation&quot;</span>,<span style="color: #ff0000;">&quot;non-linear&quot;</span>,<span style="color: #ff0000;">&quot;skewness&quot;</span>,<span style="color: #ff0000;">&quot;kurtosis&quot;</span>,
    <span style="color: #ff0000;">&quot;Hurst&quot;</span>,<span style="color: #ff0000;">&quot;Lyapunov&quot;</span>,
    <span style="color: #ff0000;">&quot;dc autocorrelation&quot;</span>,<span style="color: #ff0000;">&quot;dc non-linear&quot;</span>,<span style="color: #ff0000;">&quot;dc skewness&quot;</span>,<span style="color: #ff0000;">&quot;dc kurtosis&quot;</span><span style="color: #080;">&#41;</span>
&nbsp;
  <span style="color: #0000FF; font-weight: bold;">return</span><span style="color: #080;">&#40;</span>m<span style="color: #080;">&#41;</span>
<span style="color: #080;">&#125;</span></pre></td></tr></table></div>

<p> </p>
<p>Here is a quick example applied to Australian monthly gas production:</p>

<div class="wp_codebox"><table><tr id="p179610"><td class="code" id="p1796code10"><pre class="rsplus" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">library</span><span style="color: #080;">&#40;</span>forecast<span style="color: #080;">&#41;</span>
measures<span style="color: #080;">&#40;</span>gas<span style="color: #080;">&#41;</span>
     <span style="color: #0000FF; font-weight: bold;">frequency</span>              trend           seasonal    autocorrelation 
        <span style="color: #ff0000;">0.1096</span>             <span style="color: #ff0000;">0.9989</span>             <span style="color: #ff0000;">0.9337</span>             <span style="color: #ff0000;">0.9985</span> 
    non<span style="color: #080;">-</span>linear           skewness           kurtosis              Hurst 
        <span style="color: #ff0000;">0.4947</span>             <span style="color: #ff0000;">0.1282</span>             <span style="color: #ff0000;">0.0055</span>             <span style="color: #ff0000;">0.9996</span> 
      Lyapunov dc autocorrelation      dc non<span style="color: #080;">-</span>linear        dc skewness 
        <span style="color: #ff0000;">0.5662</span>             <span style="color: #ff0000;">0.1140</span>             <span style="color: #ff0000;">0.0538</span>             <span style="color: #ff0000;">0.1743</span> 
   dc kurtosis 
        <span style="color: #ff0000;">0.9992</span></pre></td></tr></table></div>

<p> <br />
The function is far from perfect, and it is not hard to find examples where it fails. For example, it doesn’t work with multiple seasonality — try <code>measure(taylor)</code> and check the seasonality. Also, I’m not convinced the kurtosis provides anything useful here, or that the skewness measure is done in the best way possible. But it was really a proof of concept, so we will leave it to others to revise and improve the code.</p>
<p>In our papers, we took the measures obtained using R, and produced self-organizing maps using <a href="http://www.viscovery.net/somine/">Viscovery</a>. There is now a <a href="http://cran.r-project.org/web/packages/som/">som package</a> in R for that, so it might be possible to integrate that step into R as well. The dendogram was generated in matlab, although that could now also be done in R using the <a href="http://cran.r-project.org/web/packages/ggdendro/">ggdendro package</a> for example.</p>
<hr />
<p><strong><a href="http://robjhyndman.com/papers/measures2.R">Download the code in a single file.</a></strong></p>

<p><a href="http://feedads.g.doubleclick.net/~a/u42BQG1fZ9NMNsJA1kc3O7T2-Ik/0/da"><img src="http://feedads.g.doubleclick.net/~a/u42BQG1fZ9NMNsJA1kc3O7T2-Ik/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/u42BQG1fZ9NMNsJA1kc3O7T2-Ik/1/da"><img src="http://feedads.g.doubleclick.net/~a/u42BQG1fZ9NMNsJA1kc3O7T2-Ik/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/RobJHyndman-ResearchTips/~4/c7ZtHS5NLVQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://robjhyndman.com/researchtips/tscharacteristics/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		<feedburner:origLink>http://robjhyndman.com/researchtips/tscharacteristics/</feedburner:origLink></item>
		<item>
		<title>LaTeX templates</title>
		<link>http://feedproxy.google.com/~r/RobJHyndman-ResearchTips/~3/9pn4SLzJVmE/</link>
		<comments>http://robjhyndman.com/researchtips/latex-templates/#comments</comments>
		<pubDate>Mon, 09 Apr 2012 01:42:16 +0000</pubDate>
		<dc:creator>Rob J Hyndman</dc:creator>
				<category><![CDATA[Research tips]]></category>
		<category><![CDATA[LaTeX]]></category>

		<guid isPermaLink="false">http://robjhyndman.com/researchtips/?p=1791</guid>
		<description><![CDATA[Some of the most popular pages on this site are my LaTeX templates: for a curriculum vitae, a beamer poster, a beamer talk, a Monash University working paper and a Monash University thesis. Almost all new LaTeX users begin with templates, so it is surprising that there aren’t more good templates around to get people started. Now there is a great new website for LaTeX templates: www.latextemplates.com. There are some nice templates for letters, lab reports, calendars, theses, assignments, essays, and CVs.  The templates are well-structured with lots of comments to make it easy to understand how they work, and to make modifications. Even experienced LaTeXers will probably learn some new tricks and new packages from browsing the templates.]]></description>
			<content:encoded><![CDATA[<p>Some of the most popular pages on this site are my LaTeX templates: for <a href="http://robjhyndman.com/researchtips/cv/">a curriculum vitae</a>, <a href="http://robjhyndman.com/researchtips/beamer-poster/">a beamer poster</a>, <a href="http://robjhyndman.com/researchtips/giving-a-research-seminar/">a beamer talk, </a>a <a href="http://robjhyndman.com/researchtips/latex-templates-for-monash/">Monash University working paper</a> and a <a href="http://robjhyndman.com/researchtips/latex-templates-for-monash/">Monash University thesis</a>. Almost all new LaTeX users begin with templates, so it is surprising that there aren’t more good templates around to get people started.</p>
<p>Now there is a great new website for LaTeX templates: <strong><a href="http://www.latextemplates.com/">www.latextemplates.com</a></strong>. There are some nice templates for letters, lab reports, calendars, theses, assignments, essays, and CVs.  The templates are well-structured with lots of comments to make it easy to understand how they work, and to make modifications. Even experienced LaTeXers will probably learn some new tricks and new packages from browsing the templates.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/Ea99QYOtro4BfL4cEFX9ik7nbh8/0/da"><img src="http://feedads.g.doubleclick.net/~a/Ea99QYOtro4BfL4cEFX9ik7nbh8/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/Ea99QYOtro4BfL4cEFX9ik7nbh8/1/da"><img src="http://feedads.g.doubleclick.net/~a/Ea99QYOtro4BfL4cEFX9ik7nbh8/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/RobJHyndman-ResearchTips/~4/9pn4SLzJVmE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://robjhyndman.com/researchtips/latex-templates/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://robjhyndman.com/researchtips/latex-templates/</feedburner:origLink></item>
		<item>
		<title>Google scholar metrics</title>
		<link>http://feedproxy.google.com/~r/RobJHyndman-ResearchTips/~3/ON887S-Hmz4/</link>
		<comments>http://robjhyndman.com/researchtips/google-scholar-metrics/#comments</comments>
		<pubDate>Mon, 02 Apr 2012 02:45:30 +0000</pubDate>
		<dc:creator>Rob J Hyndman</dc:creator>
				<category><![CDATA[Research tips]]></category>
		<category><![CDATA[journals]]></category>

		<guid isPermaLink="false">http://robjhyndman.com/researchtips/?p=1786</guid>
		<description><![CDATA[Google has produced another great tool for researchers, this time providing some metrics on journal citations. Google Scholar Metrics allows you to search on journals rather than articles, and to see the average or median h-index for each journal. For example, a search on “forecasting” yields the following results: The h-index is the largest number such that at least articles in that publication were cited at least times each. The h5-index is the h-index calculated using only articles published in the last five complete calendar years (2007–2011 in this example). So there were 29 articles published in the IJF between 2007 and 2011 that have each been cited at least 29 times. The h5-median is the median number of citations of the articles making up the h5-index. That is, for the IJF the 29 articles have received a median 43 citations. By clicking on the number in the h5-index column, you can see which articles have been included. Currently, any discussion of journal metrics is dominated by the ISI 2-year impact factor, equal to the average number of citations received per paper published in that journal during the two preceding years. In my view the h5-index is a far better measure<a href="http://robjhyndman.com/researchtips/google-scholar-metrics/"> <br /><br /> (More)…</a>]]></description>
			<content:encoded><![CDATA[<p>Google has produced another great tool for researchers, this time providing some metrics on journal citations. <a href="http://scholar.google.com/citations?view_op=top_venues">Google Scholar Metrics</a> allows you to search on journals rather than articles, and to see the average or median h-index for each journal.</p>
<p>For example, a <a href="http://scholar.google.com/citations?hl=en&amp;view_op=search_venues&amp;vq=forecasting">search on “forecasting”</a> yields the following results:</p>
<p style="text-align: center;"><a href="http://robjhyndman.com/researchtips/files/2012/04/googlescholarmetrics.png" rel="lightbox[1786]" title="googlescholarmetrics"><img class="aligncenter  wp-image-1787" title="googlescholarmetrics" src="http://robjhyndman.com/researchtips/files/2012/04/googlescholarmetrics.png" alt="" width="700" /></a></p>
<p><span id="more-1786"></span>The h-index is the largest number <img src="http://robjhyndman.com/researchtips/wp-content/ql-cache/quicklatex.com-1f60c707908cae43d340ee091916576c_l3.png" class="ql-img-inline-formula" alt="&#104;" title="Rendered by QuickLaTeX.com" style="vertical-align: 0px;"/> such that at least <img src="http://robjhyndman.com/researchtips/wp-content/ql-cache/quicklatex.com-1f60c707908cae43d340ee091916576c_l3.png" class="ql-img-inline-formula" alt="&#104;" title="Rendered by QuickLaTeX.com" style="vertical-align: 0px;"/> articles in that publication were cited at least <img src="http://robjhyndman.com/researchtips/wp-content/ql-cache/quicklatex.com-1f60c707908cae43d340ee091916576c_l3.png" class="ql-img-inline-formula" alt="&#104;" title="Rendered by QuickLaTeX.com" style="vertical-align: 0px;"/> times each. The h5-index is the h-index calculated using only articles published in the last five complete calendar years (2007–2011 in this example). So there were 29 articles published in the IJF between 2007 and 2011 that have each been cited at least 29 times.</p>
<p>The h5-median is the median number of citations of the articles making up the h5-index. That is, for the IJF the 29 articles have received a median 43 citations. By clicking on the number in the h5-index column, you can see <a href="http://scholar.google.com/citations?hl=en&amp;view_op=list_hcore&amp;venue=EJnkELQAL2YJ.20120401">which articles have been included</a>.</p>
<p>Currently, any discussion of journal metrics is dominated by the ISI 2-year impact factor, equal to the average number of citations received per paper published in that journal during the two preceding years. In my view the h5-index is a far better measure than the 2-year IF. Here are some reasons why.</p>
<ol>
<li>I like the fact that a 5-year index has been used, rather than the 2-year impact factor favoured by the ISI. Two years is much too short, and leads to a lot of year-to-year variation, at least in the fields I’m interested in. Five years provides a smoother measure that will not change so much from year to year, yet will still represent recent quality rather than what the journal might have been like many years ago.</li>
<li>The h5-index cannot be dominated by one star paper. If there is only one great paper in the journal, and everything else is not cited at all, the h5-index will be 1. On the other hand, the ISI 2-year impact factor will be greatly increased by that single paper due to the non-robustness of the mean.</li>
<li>It is harder to game the h5-index than the ISI impact factor. One of the games that some journals play is to force authors wanting their article published in the journal to cite other articles published in the journal, thus artificially increasing the number of citations. This has a direct and immediate impact on the ISI impact factor as it is based on average citations per article. But it will be harder to use this game on the journal h5-index.To see this, imagine that the <em>Journal of Forecasting</em> wanted to improve their h5-index to 30 and so beat the <em>IJF</em>. They currently only have 5 papers with 30 or more citations, so they would need to get another 25 papers up to that level, 14 of which currently have fewer than 16 citations. So that’s more than 14 extra <em>JF</em> citations for each of those 14 papers — even with bogus citations that’s not going to happen. (I am not suggesting that <em>JF</em> ever plays such games, only pointing out that it will be much harder for journals to game the h5-index than the ISI 2-year impact factor.)</li>
</ol>
<p>In summary, the h5-index is simple to understand, hard to manipulate, and provides a reasonable if crude measure of the respect accorded to a journal by scholars within its field. While journal metrics are no guarantee of the quality of a journal, if they are going to be used we should use the best available, and Google’s h5-index is a big improvement on the ISI impact factor.</p>
<p> </p>

<p><a href="http://feedads.g.doubleclick.net/~a/PEE9uoSVDcCtTEb9cqQWuom_6rc/0/da"><img src="http://feedads.g.doubleclick.net/~a/PEE9uoSVDcCtTEb9cqQWuom_6rc/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/PEE9uoSVDcCtTEb9cqQWuom_6rc/1/da"><img src="http://feedads.g.doubleclick.net/~a/PEE9uoSVDcCtTEb9cqQWuom_6rc/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/RobJHyndman-ResearchTips/~4/ON887S-Hmz4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://robjhyndman.com/researchtips/google-scholar-metrics/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://robjhyndman.com/researchtips/google-scholar-metrics/</feedburner:origLink></item>
		<item>
		<title>Forecasts and ggplot</title>
		<link>http://feedproxy.google.com/~r/RobJHyndman-ResearchTips/~3/LPgqW19tyfM/</link>
		<comments>http://robjhyndman.com/researchtips/forecasts-and-ggplot/#comments</comments>
		<pubDate>Thu, 22 Mar 2012 23:17:48 +0000</pubDate>
		<dc:creator>Rob J Hyndman</dc:creator>
				<category><![CDATA[Research tips]]></category>
		<category><![CDATA[forecasting]]></category>
		<category><![CDATA[R]]></category>

		<guid isPermaLink="false">http://robjhyndman.com/researchtips/?p=1783</guid>
		<description><![CDATA[The forecast package uses the base R graphics for all plots, but some people may prefer to use the nice graphics available using the ggplot2 package. In the following two posts, Frank Davenport shows how it can be done: Plotting forecast() objects in ggplot part 1: Extracting the Data Plotting forecast() objects in ggplot part 2: Visualize Observations, Fits, and Forecasts  ]]></description>
			<content:encoded><![CDATA[<p>The forecast package uses the base R graphics for all plots, but some people may prefer to use the nice graphics available using the ggplot2 package.</p>
<p>In the following two posts, Frank Davenport shows how it can be done:</p>
<ol>
<li><a href="http://davenportspatialanalytics.squarespace.com/blog/2012/3/14/plotting-forecast-objects-in-ggplot-part-1-extracting-the-da.html">Plotting forecast() objects in ggplot part 1: Extracting the Data</a></li>
<li><a href="http://davenportspatialanalytics.squarespace.com/blog/2012/3/21/plotting-forecast-objects-in-ggplot-part-2-visualize-observa.html">Plotting forecast() objects in ggplot part 2: Visualize Observations, Fits, and Forecasts</a></li>
</ol>
<p> </p>

<p><a href="http://feedads.g.doubleclick.net/~a/CV-pgTA3CNHJU1Ft1f_jeSWO2mI/0/da"><img src="http://feedads.g.doubleclick.net/~a/CV-pgTA3CNHJU1Ft1f_jeSWO2mI/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/CV-pgTA3CNHJU1Ft1f_jeSWO2mI/1/da"><img src="http://feedads.g.doubleclick.net/~a/CV-pgTA3CNHJU1Ft1f_jeSWO2mI/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/RobJHyndman-ResearchTips/~4/LPgqW19tyfM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://robjhyndman.com/researchtips/forecasts-and-ggplot/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://robjhyndman.com/researchtips/forecasts-and-ggplot/</feedburner:origLink></item>
		<item>
		<title>XeLaTeX with TeXstudio</title>
		<link>http://feedproxy.google.com/~r/RobJHyndman-ResearchTips/~3/3ksqgPG1eRQ/</link>
		<comments>http://robjhyndman.com/researchtips/xelatex-with-texstudio/#comments</comments>
		<pubDate>Mon, 05 Mar 2012 22:51:04 +0000</pubDate>
		<dc:creator>Rob J Hyndman</dc:creator>
				<category><![CDATA[Research tips]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[LaTeX]]></category>

		<guid isPermaLink="false">http://robjhyndman.com/researchtips/?p=1771</guid>
		<description><![CDATA[XeLaTeX is a replacement for pdfLaTeX that allows you to use the fonts on your computer (rather than only those fonts that come with your tex system). However, TeXstudio is not set up to use XeLaTeX yet. Fortunately, it is not difficult. Go to Options/Commands where all the commands used by TeXstudio are specified. You probably don’t need standard LaTeX these days, so replace the LaTeX command with the following. xelatex -interaction=nonstopmode %.tex Then click OK. Now the LaTeX button at the top of the screen is mapped to XeLaTeX rather than standard LaTeX. You can still access pdfLaTeX via its button for your non-XeLaTeX files. Before anyone comments that you need standard LaTeX for when eps graphics are used, see Converting eps to pdf.]]></description>
			<content:encoded><![CDATA[<p><a href="http://robjhyndman.com/researchtips/xelatex/">XeLaTeX</a> is a replacement for pdfLaTeX that allows you to use the fonts on your computer (rather than only those fonts that come with your tex system). However, <a href="http://texstudio.sourceforge.net/">TeXstudio</a> is not set up to use XeLaTeX yet.</p>
<p>Fortunately, it is not difficult. Go to Options/Commands where all the commands used by TeXstudio are specified. You probably don’t need standard LaTeX these days, so replace the LaTeX command with the following.</p>
<pre>xelatex -interaction=nonstopmode %.tex</pre>
<p>Then click OK.</p>
<p>Now the LaTeX button at the top of the screen is mapped to XeLaTeX rather than standard LaTeX. You can still access pdfLaTeX via its button for your non-XeLaTeX files.</p>
<p>Before anyone comments that you need standard LaTeX for when eps graphics are used, see <a href="http://robjhyndman.com/researchtips/converting-eps-to-pdf/">Converting eps to pdf</a>.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/UcvRjbEDbaJNiDjCjvXly4HLOGo/0/da"><img src="http://feedads.g.doubleclick.net/~a/UcvRjbEDbaJNiDjCjvXly4HLOGo/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/UcvRjbEDbaJNiDjCjvXly4HLOGo/1/da"><img src="http://feedads.g.doubleclick.net/~a/UcvRjbEDbaJNiDjCjvXly4HLOGo/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/RobJHyndman-ResearchTips/~4/3ksqgPG1eRQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://robjhyndman.com/researchtips/xelatex-with-texstudio/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://robjhyndman.com/researchtips/xelatex-with-texstudio/</feedburner:origLink></item>
		<item>
		<title>Data visualization</title>
		<link>http://feedproxy.google.com/~r/RobJHyndman-ResearchTips/~3/CUEI9UYRimw/</link>
		<comments>http://robjhyndman.com/researchtips/data-visualization/#comments</comments>
		<pubDate>Sun, 04 Mar 2012 22:37:45 +0000</pubDate>
		<dc:creator>Rob J Hyndman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[statistics]]></category>

		<guid isPermaLink="false">http://robjhyndman.com/researchtips/?p=1767</guid>
		<description><![CDATA[For those who have not read the seminal works of Tufte and Cleveland, please hang your heads in shame. To salvage some sense of self-worth, you can then head over to Solomon Messing’s blog where he is starting a series on data visualization based on the principles developed by Tufte and Cleveland (with R examples). The classics are also worth reading, and remain relevant despite the 20 or 30 years that have elapsed since they appeared.]]></description>
			<content:encoded><![CDATA[<p>For those who have not read the seminal works of Tufte and Cleveland, please hang your heads in shame. To salvage some sense of self-worth, you can then head over to <a href="http://solomonmessing.wordpress.com/">Solomon Messing’s blog</a> where he is starting <a href="http://solomonmessing.wordpress.com/2012/03/04/visualization-series-insight-from-cleveland-and-tufte-on-plotting-numeric-data-by-groups/">a series on data visualization</a> based on the principles developed by Tufte and Cleveland (with R examples).</p>
<p>The classics are also worth reading, and remain relevant despite the 20 or 30 years that have elapsed since they appeared.</p>
<p><iframe src="http://rcm.amazon.com/e/cm?lt1=_blank&#038;bc1=000000&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=000000&#038;lc1=0000FF&#038;t=prorobjhyn-20&#038;o=1&#038;p=8&#038;l=as4&#038;m=amazon&#038;f=ifr&#038;ref=ss_til&#038;asins=0961392142" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe><iframe src="http://rcm.amazon.com/e/cm?lt1=_blank&#038;bc1=000000&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=000000&#038;lc1=0000FF&#038;t=prorobjhyn-20&#038;o=1&#038;p=8&#038;l=as4&#038;m=amazon&#038;f=ifr&#038;ref=ss_til&#038;asins=0963488414" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe><iframe src="http://rcm.amazon.com/e/cm?lt1=_blank&#038;bc1=000000&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=000000&#038;lc1=0000FF&#038;t=prorobjhyn-20&#038;o=1&#038;p=8&#038;l=as4&#038;m=amazon&#038;f=ifr&#038;ref=ss_til&#038;asins=0963488406" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></p>

<p><a href="http://feedads.g.doubleclick.net/~a/siSa_DtvbW8TX4g-ouhZlCt2Fqo/0/da"><img src="http://feedads.g.doubleclick.net/~a/siSa_DtvbW8TX4g-ouhZlCt2Fqo/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/siSa_DtvbW8TX4g-ouhZlCt2Fqo/1/da"><img src="http://feedads.g.doubleclick.net/~a/siSa_DtvbW8TX4g-ouhZlCt2Fqo/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/RobJHyndman-ResearchTips/~4/CUEI9UYRimw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://robjhyndman.com/researchtips/data-visualization/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://robjhyndman.com/researchtips/data-visualization/</feedburner:origLink></item>
	</channel>
</rss>

