Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: question about use of restricted cubic splines in regression

 From "Airey, David C" To "statalist@hsphsun2.harvard.edu" Subject Re: st: question about use of restricted cubic splines in regression Date Fri, 21 Oct 2011 07:22:25 -0500

```.

Ah! I like the idea you have of having the same knots and interacting
those with the group variables. I'll ask the local expert (FH)
about the differences between these two approaches as well, and I'll
check he reference you mentioned. Thanks, Nick.

-Dave

Nick wrote:

I don't think there are many rules here. A downside of splines is
inevitably that you replace one predictor with a bunch, with the
side-effect that with interactions too all of a sudden there are many
more parameters. For conservative modellers like myself who like to fit
very parsimonious models whenever possible, this is scary; others find
that they now have the flexibility they want and need, and so long as
the number of observations is reasonable find the brave new world very
exciting.

I would tend strongly to use the same bunch for X and then interact them
with the groups. I'd also do lots of exploratory analysis for

smooth(mean(Y|X, each group))

to see what is going on.

I'd also study the examples closely in Harrell, F. 2001. Regression
modeling strategies. New York: Springer.

However, Frank Harrell has strategies that work very well when you are
as smart and knowledgeable as Frank Harrell....

On Fri, Oct 21, 2011 at 5:01 AM, Airey, David C
<david.airey@vanderbilt.edu> wrote:

I have one continuous response Y and one continuous predictor X measured
in 20 groups. One of the groups is a natural control, and I want to test
whether each of the 19 other groups is different from the control. I'd
like to fit the regression lines for each of the 20 groups using
restricted cubic splines with 4 knots, because I know the response will
not be linear but I don't want to assume a specific nonlinear function.
I want to fit all 20 groups using fixed effects as the full model. I'm
assuming equal variances across groups. I then want to fit a reduced
model where the control group and one of the 19 other groups have the
same coefficients, but the other 18 groups have different estimates. I
then want to perform a likelihood ratio test for the difference. I will
create reduced models for each of the other 18 groups and perform 18
more likelihood ratio tests to test whether the control group differs
from one or more of the 19 other groups.

I've not worked with restricted cubic splines before. Do I make a set of
knots for each group? If I want coefficients shared between two groups I
assume I recode the groups to have the same group identifier and make
knot variables for the combined group? Do I also need indicator
variables for group identification?

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```