<?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: Additive COX-regression</title>
	<atom:link href="http://rforge.org/2009/06/03/additive-cox-regression/feed/" rel="self" type="application/rss+xml" />
	<link>http://rforge.org/2009/06/03/additive-cox-regression/</link>
	<description>open source tools and statistical computing ++</description>
	<lastBuildDate>Thu, 12 Jan 2012 11:03:07 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: jsntxtjsntxt</title>
		<link>http://rforge.org/2009/06/03/additive-cox-regression/#comment-263</link>
		<dc:creator><![CDATA[jsntxtjsntxt]]></dc:creator>
		<pubDate>Sat, 20 Aug 2011 14:31:27 +0000</pubDate>
		<guid isPermaLink="false">http://rforge.wordpress.com/?p=3#comment-263</guid>
		<description><![CDATA[You mean that the value of Y axis of plot(model) indeed represents ln(odds ratio), is it?]]></description>
		<content:encoded><![CDATA[<p>You mean that the value of Y axis of plot(model) indeed represents ln(odds ratio), is it?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rforge</title>
		<link>http://rforge.org/2009/06/03/additive-cox-regression/#comment-261</link>
		<dc:creator><![CDATA[rforge]]></dc:creator>
		<pubDate>Sat, 20 Aug 2011 08:21:13 +0000</pubDate>
		<guid isPermaLink="false">http://rforge.wordpress.com/?p=3#comment-261</guid>
		<description><![CDATA[The plots should be the same.

Doing it manually gives you more customization.

There is a typo in the syntax for the lines of the confidence limits. The model predictions
&lt;code&gt;test.pred &lt;- predict(test,newdata=data,se.fit=TRUE,type=&#039;response&#039;, na.action=na.omit)&lt;/code&gt;
are stored in &lt;em&gt;test.pred&lt;/em&gt;.

Therefore the lines should be
&lt;code&gt;lines( age[I1] , test.pred$fit[I1] + 1.96 * test.pred$se[I1] , lty = 2 )&lt;/code&gt;
Note that it is 1.96 times standard error for the 95% CI ( not 2 times). Ok, thats not so serious. But it has to be 1.96 * test.pred$se.

For the logistic regression model you would use
&lt;code&gt;type = &quot;link&quot;&lt;/code&gt;
instead of 
&lt;code&gt;type = &quot;response&quot;&lt;/code&gt;
as far as I recall for the logit aka ln(OR).

Have a look at 
&lt;code&gt;?predict.gam&lt;/code&gt;

and remember
&lt;code&gt;library(mgcv)&lt;/code&gt;
before you start.

Then both plots should be exactly the same.

Regards,
Reinhard]]></description>
		<content:encoded><![CDATA[<p>The plots should be the same.</p>
<p>Doing it manually gives you more customization.</p>
<p>There is a typo in the syntax for the lines of the confidence limits. The model predictions<br />
<code>test.pred &lt;- predict(test,newdata=data,se.fit=TRUE,type=&#039;response&#039;, na.action=na.omit)</code><br />
are stored in <em>test.pred</em>.</p>
<p>Therefore the lines should be<br />
<code>lines( age[I1] , test.pred$fit[I1] + 1.96 * test.pred$se[I1] , lty = 2 )</code><br />
Note that it is 1.96 times standard error for the 95% CI ( not 2 times). Ok, thats not so serious. But it has to be 1.96 * test.pred$se.</p>
<p>For the logistic regression model you would use<br />
<code>type = "link"</code><br />
instead of<br />
<code>type = "response"</code><br />
as far as I recall for the logit aka ln(OR).</p>
<p>Have a look at<br />
<code>?predict.gam</code></p>
<p>and remember<br />
<code>library(mgcv)</code><br />
before you start.</p>
<p>Then both plots should be exactly the same.</p>
<p>Regards,<br />
Reinhard</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jsntxtjsntxt</title>
		<link>http://rforge.org/2009/06/03/additive-cox-regression/#comment-260</link>
		<dc:creator><![CDATA[jsntxtjsntxt]]></dc:creator>
		<pubDate>Fri, 19 Aug 2011 03:10:49 +0000</pubDate>
		<guid isPermaLink="false">http://rforge.wordpress.com/?p=3#comment-260</guid>
		<description><![CDATA[First of all, millions of thanks for your help, I have been able to get the plot.
While I would like to know does the Y axis of plot(model) represents Ln(OR)
I get some program on internet as follows
      test &lt;- gam(participant ~ s(age,fx=FALSE,bs=&#039;cr&#039;), family=binomial(logit)) 
      summary(test) 
      plot(test, shade=TRUE) 
      test.pred &lt;- predict(test,newdata=data,se.fit=TRUE,type=&#039;response&#039;, 
      na.action=na.omit) 
      I1&lt;-order(age) 
      plot(age[I1], test.pred$fit[I1],lty=1, type=&quot;l&quot;) 
      lines(age[I1],test.pred$fit[I1]+2*M1pred$se[I1],lty=2) 
      lines(age[I1],test.pred$fit[I1]-2*M1pred$se[I1],lty=2) 
     plot(age[I1], test.pred$fit[I1] , type=&quot;l&quot;)
could you tell me the difference between plot(test, shade=TRUE) and plot(age[I1], test.pred$fit[I1],lty=1, type=&quot;l&quot;) , especially the meaning of test.pred$fit.
If I focus on the relation between age and Ln(OR), which plot is I need.
Millions of thanks]]></description>
		<content:encoded><![CDATA[<p>First of all, millions of thanks for your help, I have been able to get the plot.<br />
While I would like to know does the Y axis of plot(model) represents Ln(OR)<br />
I get some program on internet as follows<br />
      test &lt;- gam(participant ~ s(age,fx=FALSE,bs=&#039;cr&#039;), family=binomial(logit))<br />
      summary(test)<br />
      plot(test, shade=TRUE)<br />
      test.pred &lt;- predict(test,newdata=data,se.fit=TRUE,type=&#039;response&#039;,<br />
      na.action=na.omit)<br />
      I1&lt;-order(age)<br />
      plot(age[I1], test.pred$fit[I1],lty=1, type=&quot;l&quot;)<br />
      lines(age[I1],test.pred$fit[I1]+2*M1pred$se[I1],lty=2)<br />
      lines(age[I1],test.pred$fit[I1]-2*M1pred$se[I1],lty=2)<br />
     plot(age[I1], test.pred$fit[I1] , type=&quot;l&quot;)<br />
could you tell me the difference between plot(test, shade=TRUE) and plot(age[I1], test.pred$fit[I1],lty=1, type=&quot;l&quot;) , especially the meaning of test.pred$fit.<br />
If I focus on the relation between age and Ln(OR), which plot is I need.<br />
Millions of thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rforge</title>
		<link>http://rforge.org/2009/06/03/additive-cox-regression/#comment-258</link>
		<dc:creator><![CDATA[rforge]]></dc:creator>
		<pubDate>Thu, 18 Aug 2011 09:14:14 +0000</pubDate>
		<guid isPermaLink="false">http://rforge.wordpress.com/?p=3#comment-258</guid>
		<description><![CDATA[Update: I have rewritten the function, so that observation with missing covariates are omitted in the plot-function (as they are in the cox-model anyway). Look at the static &quot;PLOTHR&quot; page following the link in the page banner.

Reinhard]]></description>
		<content:encoded><![CDATA[<p>Update: I have rewritten the function, so that observation with missing covariates are omitted in the plot-function (as they are in the cox-model anyway). Look at the static &#8220;PLOTHR&#8221; page following the link in the page banner.</p>
<p>Reinhard</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rforge</title>
		<link>http://rforge.org/2009/06/03/additive-cox-regression/#comment-257</link>
		<dc:creator><![CDATA[rforge]]></dc:creator>
		<pubDate>Thu, 18 Aug 2011 09:11:42 +0000</pubDate>
		<guid isPermaLink="false">http://rforge.wordpress.com/?p=3#comment-257</guid>
		<description><![CDATA[Glad, you could use it :)

Of course it is possible. You might want to look at &lt;strong&gt;library(mgcv)&lt;/strong&gt; of Simon Wood.

I wrote a post long ago about it, which I consider now outdated - one of my first approaches, but you might get some idea.
http://rforge.org/2009/08/11/gam-plot-with-95-confidence-shade/

a additive logistic regression model in mgcv would look like:
&lt;code&gt;library(mgcv)
model &lt;- gam( Event ~ s( Covariate1) + s(Covariate2) + factor(Cofactor1) , data = MyData , family = &quot;binomial&quot;)
summary(model)
plot(model)&lt;/code&gt;
Note that &lt;em&gt;family = &quot;binomial&quot;&lt;/em&gt; specifies the logit-link-function aka the logistic regression model.

Hope no typos, quite drafty written.

Regards, Reinhard]]></description>
		<content:encoded><![CDATA[<p>Glad, you could use it <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Of course it is possible. You might want to look at <strong>library(mgcv)</strong> of Simon Wood.</p>
<p>I wrote a post long ago about it, which I consider now outdated &#8211; one of my first approaches, but you might get some idea.<br />
<a href="http://rforge.org/2009/08/11/gam-plot-with-95-confidence-shade/" rel="nofollow">http://rforge.org/2009/08/11/gam-plot-with-95-confidence-shade/</a></p>
<p>a additive logistic regression model in mgcv would look like:<br />
<code>library(mgcv)<br />
model &lt;- gam( Event ~ s( Covariate1) + s(Covariate2) + factor(Cofactor1) , data = MyData , family = &quot;binomial&quot;)<br />
summary(model)<br />
plot(model)</code><br />
Note that <em>family = &#8220;binomial&#8221;</em> specifies the logit-link-function aka the logistic regression model.</p>
<p>Hope no typos, quite drafty written.</p>
<p>Regards, Reinhard</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jsntxt</title>
		<link>http://rforge.org/2009/06/03/additive-cox-regression/#comment-256</link>
		<dc:creator><![CDATA[jsntxt]]></dc:creator>
		<pubDate>Thu, 18 Aug 2011 03:57:22 +0000</pubDate>
		<guid isPermaLink="false">http://rforge.wordpress.com/?p=3#comment-256</guid>
		<description><![CDATA[Very glad to understand how to  make a smoothing spline plot for a cox model.

But I am very eager to know is there any similar programme to make a smoothing spline plot for a logistic model.]]></description>
		<content:encoded><![CDATA[<p>Very glad to understand how to  make a smoothing spline plot for a cox model.</p>
<p>But I am very eager to know is there any similar programme to make a smoothing spline plot for a logistic model.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rforge</title>
		<link>http://rforge.org/2009/06/03/additive-cox-regression/#comment-73</link>
		<dc:creator><![CDATA[rforge]]></dc:creator>
		<pubDate>Wed, 05 May 2010 19:28:02 +0000</pubDate>
		<guid isPermaLink="false">http://rforge.wordpress.com/?p=3#comment-73</guid>
		<description><![CDATA[It is based on
Therneau TM, Grambsch PM: Modeling Survival Data: Extending the Cox Model. Springer 2000.

The relevant part is on page 108ff, chapter 4, Modeling the functional form of covariates.

http://www.amazon.com/Modeling-Survival-Data-Extending-Statistics/dp/0387987843

Therneau is the maintainer of the &quot;survival&quot; package in R. I wonder that this plot method is not implemented more explicitly in &quot;library(survival)&quot;. As I mentioned in one of the additive survival posts, you can get some crude additive plots with the termplot() function...]]></description>
		<content:encoded><![CDATA[<p>It is based on<br />
Therneau TM, Grambsch PM: Modeling Survival Data: Extending the Cox Model. Springer 2000.</p>
<p>The relevant part is on page 108ff, chapter 4, Modeling the functional form of covariates.</p>
<div style="width: 110px; text-align: center; background: #fff; border: 1px solid #aaa; margin: 3px; padding: 2px;">
<p style="margin: 10px 31.5px;"><a href="http://www.amazon.com/Modeling-Survival-Data-Extending-Statistics/dp/0387987843" target="_blank"><img src="http://ecx.images-amazon.com/images/I/41f7h51sbjL._SL75_.jpg" height="75" width="47" alt="Modeling Survival Data: Extending the Cox Model (Statistics for Biology and Health)" style="padding:0;margin:0;border:none;" /></a></p>
<p style="font-size: 10px;"><a href="http://www.amazon.com/Modeling-Survival-Data-Extending-Statistics/dp/0387987843" target="_blank">Modeling Survival Data: Extending the Cox Model (Statistics for Biology and Health)</a></p>
<p style="font-size: 10px;">
<p style="margin: 10px 10px;"><a href="http://www.amazon.com/Modeling-Survival-Data-Extending-Statistics/dp/0387987843" target="_blank"><img alt="Buy from Amazon" src="http://ecx.images-amazon.com/images/G/01/buttons/buy-from-tan.gif"" style="padding:0;margin:0;border:none;" /></a></p>
</p></div>
<p>Therneau is the maintainer of the &#8220;survival&#8221; package in R. I wonder that this plot method is not implemented more explicitly in &#8220;library(survival)&#8221;. As I mentioned in one of the additive survival posts, you can get some crude additive plots with the termplot() function&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sin-Ho Jung</title>
		<link>http://rforge.org/2009/06/03/additive-cox-regression/#comment-72</link>
		<dc:creator><![CDATA[Sin-Ho Jung]]></dc:creator>
		<pubDate>Wed, 05 May 2010 15:01:58 +0000</pubDate>
		<guid isPermaLink="false">http://rforge.wordpress.com/?p=3#comment-72</guid>
		<description><![CDATA[Congratulations on the excellent R package. I would appreciate if you could give me a statistical reference (methodology paper) to this R package.]]></description>
		<content:encoded><![CDATA[<p>Congratulations on the excellent R package. I would appreciate if you could give me a statistical reference (methodology paper) to this R package.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leandro</title>
		<link>http://rforge.org/2009/06/03/additive-cox-regression/#comment-24</link>
		<dc:creator><![CDATA[Leandro]]></dc:creator>
		<pubDate>Sun, 16 Aug 2009 21:30:25 +0000</pubDate>
		<guid isPermaLink="false">http://rforge.wordpress.com/?p=3#comment-24</guid>
		<description><![CDATA[It works!!!!!!!!!!
thanks a lot.]]></description>
		<content:encoded><![CDATA[<p>It works!!!!!!!!!!<br />
thanks a lot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rforge</title>
		<link>http://rforge.org/2009/06/03/additive-cox-regression/#comment-20</link>
		<dc:creator><![CDATA[rforge]]></dc:creator>
		<pubDate>Thu, 13 Aug 2009 14:23:34 +0000</pubDate>
		<guid isPermaLink="false">http://rforge.wordpress.com/?p=3#comment-20</guid>
		<description><![CDATA[Yes, thats often the case. The coxph() function simply excludes missing data. The brute force solution is to exclude them in the MYDATA$x values:

Say you have a model 
&lt;code&gt;coxph( survival ~ pspline(cov1) + pspline (cov2) , data = MYDATA)&lt;/code&gt;

Then all observations with missing covariate for cov1 and cov2 are excluded. To mask those observations from the for plotting you might create an index variable which is TRUE when the covariates are not missing:
&lt;code&gt;i.complete &lt;- with( MYDATA , !is.na(cov1) &amp; !is.na(cov2))&lt;/code&gt;

and then plot
&lt;code&gt;lines( sm.spline( MYDATA$x[i.complete] , predict$fit ))&lt;/code&gt;

I know, that is very unelegant... using a smooth to plot the line is not a good programming practice, but I am quite new to R, too.

I have some improvements for the code. I will post them soon. It would be better to sort the MYDATA$x and predict$fit according to the x-values and then just plot a line. Something like:
&lt;code&gt;i.x &lt;- order( MYDATA$x )
lines(MYDATA$x[i.x] , predict$fit[i.x])&lt;/code&gt;

I posted it in a &lt;a href=&quot;http://rforge.wordpress.com/2009/08/11/gam-plot-with-95-confidence-shade/&quot; rel=&quot;nofollow&quot;&gt;recent post&lt;/a&gt; concerning usual regression GAMs.


This would save the sm.spline() and you would not even need to load the library(pspline).

Hope that works and no typos...]]></description>
		<content:encoded><![CDATA[<p>Yes, thats often the case. The coxph() function simply excludes missing data. The brute force solution is to exclude them in the MYDATA$x values:</p>
<p>Say you have a model<br />
<code>coxph( survival ~ pspline(cov1) + pspline (cov2) , data = MYDATA)</code></p>
<p>Then all observations with missing covariate for cov1 and cov2 are excluded. To mask those observations from the for plotting you might create an index variable which is TRUE when the covariates are not missing:<br />
<code>i.complete &lt;- with( MYDATA , !is.na(cov1) &amp; !is.na(cov2))</code></p>
<p>and then plot<br />
<code>lines( sm.spline( MYDATA$x[i.complete] , predict$fit ))</code></p>
<p>I know, that is very unelegant&#8230; using a smooth to plot the line is not a good programming practice, but I am quite new to R, too.</p>
<p>I have some improvements for the code. I will post them soon. It would be better to sort the MYDATA$x and predict$fit according to the x-values and then just plot a line. Something like:<br />
<code>i.x &lt;- order( MYDATA$x )<br />
lines(MYDATA$x[i.x] , predict$fit[i.x])</code></p>
<p>I posted it in a <a href="http://rforge.wordpress.com/2009/08/11/gam-plot-with-95-confidence-shade/" rel="nofollow">recent post</a> concerning usual regression GAMs.</p>
<p>This would save the sm.spline() and you would not even need to load the library(pspline).</p>
<p>Hope that works and no typos&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

