[R] explaining a model with rcs() terms
Dylan Beaudette
dylan.beaudette at gmail.com
Mon Dec 1 16:57:49 CET 2008
On Sun, Nov 30, 2008 at 7:57 PM, David Winsemius <dwinsemius at comcast.net> wrote:
>
> 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.
Thanks for the clarification David. Unfortunately Frank's book is a
hot item in the UCD library-- as I can never seem to keep a copy
checked out for more than a week. Maybe it is time to get a copy of my
own...
>>
>> i.e. the entire expression −453(activity − 0.842)_{+}^{3} = 0 when
>> 'activity' = 0 ??
>
> .... whenever (activity − 0.842) < 0
>
OK. That makes sense.
>
>>
>> 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
OK-- this would make a lot more sense, given the nature of this model.
>> − 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.
>
Yes. Looks like something funny in how the scientific notation is
being translated into LATEX markup.
Excellent. Now I am confident on explaining this model to a wider audience.
Cheers,
Dylan
>>
>>
>>
>> .... 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