<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: RegEM PTTLS Ported to R</title>
	<atom:link href="http://climateaudit.org/2009/02/17/regem-pttls-ported-to-r/feed/" rel="self" type="application/rss+xml" />
	<link>http://climateaudit.org/2009/02/17/regem-pttls-ported-to-r/</link>
	<description>by Steve McIntyre</description>
	<lastBuildDate>Tue, 21 May 2013 15:32:22 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Ryan O</title>
		<link>http://climateaudit.org/2009/02/17/regem-pttls-ported-to-r/#comment-177253</link>
		<dc:creator><![CDATA[Ryan O]]></dc:creator>
		<pubDate>Mon, 13 Apr 2009 22:57:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.climateaudit.org/?p=5258#comment-177253</guid>
		<description><![CDATA[Steve,
.
In your regem.functions.txt, you have 2 versions.  One is the regem_pttls function (which calls pttls) and the other is the regem_pca function, which seems to be self-contained.  I was wondering what the difference was between the two.
.
I ran both using the cloudmasked data from Comiso and the 42 surface stations (reader.steig.anom):
&lt;blockquote&gt;
get.PCs=function(dat, surf=reader.steig.anom, PC.max=3) {

	dat=t(dat)
	dat.svd=svd(dat)

	###  Multiply the right singular vectors through and store as a time series
	PCs=ts(t((dat.svd$d)*t(dat.svd$v)), start=1982, freq=12)

	###  Return the desired number of PCs next to the surface stations,
	PCs=list(ts.union(surf, PCs[, 1:PC.max]), dat.svd$u[, 1:PC.max], dat.svd$u, dat.svd$v, dat.svd$d)
	PCs
}

steig.PCs=get.PCs(avhrr.anom)
&lt;/blockquote&gt;
.
The above is how I get the PCs to place next to the surface stations for running RegEM.  The script is based off Jeff Id&#039;s script, with some simplifications.
.
Next, I use the first member of the steig.PCs list - &quot;ts.union(surf, PCs[, 1:PC.max])&quot; - which is the 42 surface stations plus the 3 PCs - as an input to both regem_pttls and regem_pca:
.
&lt;blockquote&gt;
steig.regem.pttls=regem_pttls(steig.PCs[[1]], maxiter=100)
length(steig.regem.pttls) #28
steig.regem.pca=regem_pca(steig.PCs[[1]], maxiter=100)
length(steig.regem.pca) #46
&lt;/blockquote&gt;
.
The pttls version took about 5 times as long, but only took 28 iterations to converge.  The pca version took 46 iterations to converge, but was much faster.
.
I then extracted the last iteration in each list, took the means of the rows, and plotted the difference:
.

.
Pretty close, but there is more divergence the further you go in time from the 3 satellite PCs.  If you do not know why this occurs, that&#039;s okay.  It was more a question of curiosity.  I benchmarked a reconstruction using the both function versions vs. Jeff Id&#039;s Matlab RegEM reconstruction.  He got a continent-wide trend of 0.118; using regem_pca and regem_pttls I got a continent-wide trend of 0.115 for both.]]></description>
		<content:encoded><![CDATA[<p>Steve,<br />
.<br />
In your regem.functions.txt, you have 2 versions.  One is the regem_pttls function (which calls pttls) and the other is the regem_pca function, which seems to be self-contained.  I was wondering what the difference was between the two.<br />
.<br />
I ran both using the cloudmasked data from Comiso and the 42 surface stations (reader.steig.anom):</p>
<blockquote><p>
get.PCs=function(dat, surf=reader.steig.anom, PC.max=3) {</p>
<p>	dat=t(dat)<br />
	dat.svd=svd(dat)</p>
<p>	###  Multiply the right singular vectors through and store as a time series<br />
	PCs=ts(t((dat.svd$d)*t(dat.svd$v)), start=1982, freq=12)</p>
<p>	###  Return the desired number of PCs next to the surface stations,<br />
	PCs=list(ts.union(surf, PCs[, 1:PC.max]), dat.svd$u[, 1:PC.max], dat.svd$u, dat.svd$v, dat.svd$d)<br />
	PCs<br />
}</p>
<p>steig.PCs=get.PCs(avhrr.anom)
</p></blockquote>
<p>.<br />
The above is how I get the PCs to place next to the surface stations for running RegEM.  The script is based off Jeff Id&#8217;s script, with some simplifications.<br />
.<br />
Next, I use the first member of the steig.PCs list &#8211; &#8220;ts.union(surf, PCs[, 1:PC.max])&#8221; &#8211; which is the 42 surface stations plus the 3 PCs &#8211; as an input to both regem_pttls and regem_pca:<br />
.</p>
<blockquote><p>
steig.regem.pttls=regem_pttls(steig.PCs[[1]], maxiter=100)<br />
length(steig.regem.pttls) #28<br />
steig.regem.pca=regem_pca(steig.PCs[[1]], maxiter=100)<br />
length(steig.regem.pca) #46
</p></blockquote>
<p>.<br />
The pttls version took about 5 times as long, but only took 28 iterations to converge.  The pca version took 46 iterations to converge, but was much faster.<br />
.<br />
I then extracted the last iteration in each list, took the means of the rows, and plotted the difference:<br />
.</p>
<p>.<br />
Pretty close, but there is more divergence the further you go in time from the 3 satellite PCs.  If you do not know why this occurs, that&#8217;s okay.  It was more a question of curiosity.  I benchmarked a reconstruction using the both function versions vs. Jeff Id&#8217;s Matlab RegEM reconstruction.  He got a continent-wide trend of 0.118; using regem_pca and regem_pttls I got a continent-wide trend of 0.115 for both.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve McIntyre</title>
		<link>http://climateaudit.org/2009/02/17/regem-pttls-ported-to-r/#comment-177252</link>
		<dc:creator><![CDATA[Steve McIntyre]]></dc:creator>
		<pubDate>Thu, 19 Feb 2009 17:56:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.climateaudit.org/?p=5258#comment-177252</guid>
		<description><![CDATA[3) I&#039;ve only reconciled to Jeff Id. I&#039;ll compare to AWS next.]]></description>
		<content:encoded><![CDATA[<p>3) I&#8217;ve only reconciled to Jeff Id. I&#8217;ll compare to AWS next.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve McIntyre</title>
		<link>http://climateaudit.org/2009/02/17/regem-pttls-ported-to-r/#comment-177251</link>
		<dc:creator><![CDATA[Steve McIntyre]]></dc:creator>
		<pubDate>Thu, 19 Feb 2009 17:55:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.climateaudit.org/?p=5258#comment-177251</guid>
		<description><![CDATA[#7. it looks like this diagnostic is thrown up if you try regem_pttls with no missing values.]]></description>
		<content:encoded><![CDATA[<p>#7. it looks like this diagnostic is thrown up if you try regem_pttls with no missing values.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve McIntyre</title>
		<link>http://climateaudit.org/2009/02/17/regem-pttls-ported-to-r/#comment-177250</link>
		<dc:creator><![CDATA[Steve McIntyre]]></dc:creator>
		<pubDate>Thu, 19 Feb 2009 17:45:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.climateaudit.org/?p=5258#comment-177250</guid>
		<description><![CDATA[Re: &lt;a href=&quot;#comment-328589&quot; rel=&quot;nofollow&quot;&gt;Nic L (#7)&lt;/a&gt;,

&lt;blockquote&gt;  X[indmis]=Xmis[indmis] #update data
       X=scale(X,scale=FALSE) # #recenter
 &lt;/blockquote&gt;


yes, it&#039;s recentered after the splice. That would probably account for the drift.]]></description>
		<content:encoded><![CDATA[<p>Re: <a href="#comment-328589" rel="nofollow">Nic L (#7)</a>,</p>
<blockquote><p>  X[indmis]=Xmis[indmis] #update data<br />
       X=scale(X,scale=FALSE) # #recenter
 </p></blockquote>
<p>yes, it&#8217;s recentered after the splice. That would probably account for the drift.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve McIntyre</title>
		<link>http://climateaudit.org/2009/02/17/regem-pttls-ported-to-r/#comment-177249</link>
		<dc:creator><![CDATA[Steve McIntyre]]></dc:creator>
		<pubDate>Thu, 19 Feb 2009 17:40:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.climateaudit.org/?p=5258#comment-177249</guid>
		<description><![CDATA[#7. Nic, I&#039;m not presently in a position to provide support or explanation on this. I&#039;ve just established my own foothold.  I&#039;ve only tried to reconcile to Jeff Id&#039;s Matlab run so far - reconciling to Steig is another project as we don&#039;t know what &quot;adaptations&quot;, if any, Steig might have done.]]></description>
		<content:encoded><![CDATA[<p>#7. Nic, I&#8217;m not presently in a position to provide support or explanation on this. I&#8217;ve just established my own foothold.  I&#8217;ve only tried to reconcile to Jeff Id&#8217;s Matlab run so far &#8211; reconciling to Steig is another project as we don&#8217;t know what &#8220;adaptations&#8221;, if any, Steig might have done.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nic L</title>
		<link>http://climateaudit.org/2009/02/17/regem-pttls-ported-to-r/#comment-177248</link>
		<dc:creator><![CDATA[Nic L]]></dc:creator>
		<pubDate>Thu, 19 Feb 2009 16:42:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.climateaudit.org/?p=5258#comment-177248</guid>
		<description><![CDATA[I have been running the AWS reconstruction using Steve&#039;s R RegEM code, and there are a few things that I would welcome help with and/or an explanation of:

1) The initial values of non-missing observations don&#039;t seem to be preserved, which I thought RegEM was meant to do.  For instance, the temperature anomaly for Cape King (ID 7351) December 2004 (anomalies[576,5]) is 1.58125.  Looking at the values of the data matrix X output by the regem_pttls function (by applying unlist(sapply(test,function (A) A$X) ) to its output), after iteration 1 the value is 1.675311, after iteration 2 1.724464, after iteration 3 1.755643, after iteration 25 1.805082 and after iteration 51 1.796506.
I see that the column means of the regem output are zero, and I was wondering if re-centering of them on each iteration could explain the drift of the values  of non-illed in data?
NB the initial column mean for Cape King is zero, but it is non zero for a number of the other AWS due to the inclusion of various data points (in December 2002, etc) that Steig did not use and to the issue of what period he averaged AWS data over, as per previous posts of mine.

2) When, in order to carry out further iterations, I try to run regem_pttls on its own output (after applying unlist(sapply(test,function (A) A$X), I get the message:

&quot;Error in while (iter  tol) { :
  missing value where TRUE/FALSE needed&quot;.

The script I used was:
test=regem_pttls(X=anomalies,maxiter=2,regpar=3)
aa=test[[3]]
dimnames(aa$X)=dimnames(anomalies)
bb=aa$X
test2=regem_pttls(X=bb,maxiter=2,regpar=3)

3) I don&#039;t seem to be getting the AWS regem reconstruction to converge anywhere near accurately on Steig&#039;s reconstruction (using uncorrected data for both).  With maxiter=50 (which so far as I can see actually involves 51 applications of the algorithm), the excess of the regem output and Steig&#039;s reconstruction is at lowest -3.05 and at highest 3.59, albeit the average standard deviation is not that high at 0.23.  May I ask if Steve or anyone else has obtained better results - perhaps I am doing something wrong?]]></description>
		<content:encoded><![CDATA[<p>I have been running the AWS reconstruction using Steve&#8217;s R RegEM code, and there are a few things that I would welcome help with and/or an explanation of:</p>
<p>1) The initial values of non-missing observations don&#8217;t seem to be preserved, which I thought RegEM was meant to do.  For instance, the temperature anomaly for Cape King (ID 7351) December 2004 (anomalies[576,5]) is 1.58125.  Looking at the values of the data matrix X output by the regem_pttls function (by applying unlist(sapply(test,function (A) A$X) ) to its output), after iteration 1 the value is 1.675311, after iteration 2 1.724464, after iteration 3 1.755643, after iteration 25 1.805082 and after iteration 51 1.796506.<br />
I see that the column means of the regem output are zero, and I was wondering if re-centering of them on each iteration could explain the drift of the values  of non-illed in data?<br />
NB the initial column mean for Cape King is zero, but it is non zero for a number of the other AWS due to the inclusion of various data points (in December 2002, etc) that Steig did not use and to the issue of what period he averaged AWS data over, as per previous posts of mine.</p>
<p>2) When, in order to carry out further iterations, I try to run regem_pttls on its own output (after applying unlist(sapply(test,function (A) A$X), I get the message:</p>
<p>&#8220;Error in while (iter  tol) { :<br />
  missing value where TRUE/FALSE needed&#8221;.</p>
<p>The script I used was:<br />
test=regem_pttls(X=anomalies,maxiter=2,regpar=3)<br />
aa=test[[3]]<br />
dimnames(aa$X)=dimnames(anomalies)<br />
bb=aa$X<br />
test2=regem_pttls(X=bb,maxiter=2,regpar=3)</p>
<p>3) I don&#8217;t seem to be getting the AWS regem reconstruction to converge anywhere near accurately on Steig&#8217;s reconstruction (using uncorrected data for both).  With maxiter=50 (which so far as I can see actually involves 51 applications of the algorithm), the excess of the regem output and Steig&#8217;s reconstruction is at lowest -3.05 and at highest 3.59, albeit the average standard deviation is not that high at 0.23.  May I ask if Steve or anyone else has obtained better results &#8211; perhaps I am doing something wrong?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tolkein</title>
		<link>http://climateaudit.org/2009/02/17/regem-pttls-ported-to-r/#comment-177247</link>
		<dc:creator><![CDATA[tolkein]]></dc:creator>
		<pubDate>Wed, 18 Feb 2009 13:52:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.climateaudit.org/?p=5258#comment-177247</guid>
		<description><![CDATA[Go stattos!

Think how much better it would be if all climate research pieces that use statistics were subject to peer review (and testing) by  statisticians. Whatever the outcome we could feel reassured by the robustness of those papers that passed this process.

snip -editorialing]]></description>
		<content:encoded><![CDATA[<p>Go stattos!</p>
<p>Think how much better it would be if all climate research pieces that use statistics were subject to peer review (and testing) by  statisticians. Whatever the outcome we could feel reassured by the robustness of those papers that passed this process.</p>
<p>snip -editorialing</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AnonyMoose</title>
		<link>http://climateaudit.org/2009/02/17/regem-pttls-ported-to-r/#comment-177246</link>
		<dc:creator><![CDATA[AnonyMoose]]></dc:creator>
		<pubDate>Wed, 18 Feb 2009 05:16:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.climateaudit.org/?p=5258#comment-177246</guid>
		<description><![CDATA[Re: &lt;a href=&quot;#comment-328265&quot; rel=&quot;nofollow&quot;&gt;joshv (#4)&lt;/a&gt;, &quot;running the Wordpress guantlet.&quot;

&lt;em&gt;Visualizing a printing press which involves steel gauntlets...&lt;/em&gt; no wonder things get munged.]]></description>
		<content:encoded><![CDATA[<p>Re: <a href="#comment-328265" rel="nofollow">joshv (#4)</a>, &#8220;running the WordPress guantlet.&#8221;</p>
<p><em>Visualizing a printing press which involves steel gauntlets&#8230;</em> no wonder things get munged.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: joshv</title>
		<link>http://climateaudit.org/2009/02/17/regem-pttls-ported-to-r/#comment-177245</link>
		<dc:creator><![CDATA[joshv]]></dc:creator>
		<pubDate>Wed, 18 Feb 2009 00:47:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.climateaudit.org/?p=5258#comment-177245</guid>
		<description><![CDATA[Steve, can&#039;t you just link to a file containing the scripts rather than attempting to embed them in blog post text?  It seems that such scripts are often munged after running the Wordpress guantlet.]]></description>
		<content:encoded><![CDATA[<p>Steve, can&#8217;t you just link to a file containing the scripts rather than attempting to embed them in blog post text?  It seems that such scripts are often munged after running the WordPress guantlet.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve McIntyre</title>
		<link>http://climateaudit.org/2009/02/17/regem-pttls-ported-to-r/#comment-177244</link>
		<dc:creator><![CDATA[Steve McIntyre]]></dc:creator>
		<pubDate>Tue, 17 Feb 2009 23:57:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.climateaudit.org/?p=5258#comment-177244</guid>
		<description><![CDATA[#1. That&#039;s a Wordpress artifact. I changed to = to avoid the problem.]]></description>
		<content:encoded><![CDATA[<p>#1. That&#8217;s a WordPress artifact. I changed to = to avoid the problem.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
