[R] explaining a model with rcs() terms

David Winsemius dwinsemius at comcast.net
Mon Dec 1 04:57:35 CET 2008


On Nov 30, 2008, at 10:23 PM, Dylan Beaudette wrote:

> Hi, I am using the rcs() function in the Design library to model
> non-linearity that is not well characterized by an otherwise
> mechanistic function. I am able to make the model 'available' to
> others through the excellent nomogram() function and the set of tables
> that it can create. However, I would like to present the model in an
> 'expanded' format-- probably what rcspline.restate() or latex.Design()
> produce on a model fit object.
>
> Here is how the model was fit:
>
> fit.ols <- ols( log(k) ~ (rcs(activity) * (log(conc) + sar)) +
> (rcs(sand) * (log(conc) + sar)), data=sm.clean, x=TRUE, y=TRUE)
>
> Here is how I am accessing the 'expanded' format of the model  
> structure:
>
> options(digits=3)
> latex(fit.ols, file='fit_rcs.tex')
>
> The output contains several notation elements that I am not familiar  
> with:
>
> 1. x_{+}  --> it seems that this represent a term that should be set
> to 0, when x is 0?

It is set to zero when the term inside the cubic is less than zero.  
See pages 20-21 of Harrell's book where the basis functions are  
described and illustrated.
>
> i.e.  the entire expression   −453(activity −  
> 0.842)_{+}^{3}  = 0 when
> 'activity' = 0 ??

.... whenever (activity − 0.842) < 0



>
> 2. the '!x' found in :
>
> +log(conc) [ −0.0118sand + 9.58
> ! ×
> !10−6 (sand − 11.6)

My guess is that this is 9.58 x 10^-6
>
> − 0.000128(sand − 37.5)
> +0.00045(sand − 47.2)
> − 0.000350(sand − 51)
> + 1.86
> ! ×
> !10−5 (sand − 69.8) ]

I don't see anything like that in Harrell's text and I am wondering if  
a different character is getting rendering incorrectly. The only time  
you see it is when the exponent is below -4.


>
>
>
> .... what exactly does that mean?
>
>
> An image version of the equation in question is attached.
>
> Any input would be greatly appreciated!
>
> Cheers,
>
> Dylan
> <complex_equation.png>______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list