Hi, I have fit a series of ols() models, by group, in this manner: l <- ols(y ~ rcs(x, 4)) ... where the series of 'x' values in each group is the same, however knots are not always identical between groups. The result is a table of 'coefs' derived from the ols objects, by group: group Intercept top top' top'' 1 6.864 0.01 2.241 -2.65 2 6.836 0.047 -0.556 0.606 3 5.877 -0.019 0.084 -0.175 4 6.021 -0.003 0.121 -0.128 5 7.164 0.014 0.031 -0.096 I would like to describe groups of relationships, based on the coefficients, however I am not sure if they are directly comparable. In addition, I would like to regress these coefs on another set of variables, with the aim of predicting a series of RCS coefficients along external gradients. In essence, I am hoping to use RCS coefficients to summarize y ~ rcs(x), in a way that can then me modeled like this: [y ~ rcs(x)] ~ z. Is this interpretation of RCS coefficients even possible? If not, would forcing knot locations make it a possibility? Or, would modeling both knots and RCS coefs with external variables lead to sensible predictions? Cheers, Dylan -- Dylan Beaudette Soil Resource Laboratory http://casoilresource.lawr.ucdavis.edu/ University of California at Davis 530.754.7341
Dylan Beaudette wrote:> Hi, > > I have fit a series of ols() models, by group, in this manner: > > l <- ols(y ~ rcs(x, 4)) > > ... where the series of 'x' values in each group is the same, however knots > are not always identical between groups. The result is a table of 'coefs' > derived from the ols objects, by group: > > group Intercept top top' top'' > 1 6.864 0.01 2.241 -2.65 > 2 6.836 0.047 -0.556 0.606 > 3 5.877 -0.019 0.084 -0.175 > 4 6.021 -0.003 0.121 -0.128 > 5 7.164 0.014 0.031 -0.096 > > I would like to describe groups of relationships, based on the coefficients, > however I am not sure if they are directly comparable. In addition, I would > like to regress these coefs on another set of variables, with the aim of > predicting a series of RCS coefficients along external gradients. In essence, > I am hoping to use RCS coefficients to summarize y ~ rcs(x), in a way that > can then me modeled like this: [y ~ rcs(x)] ~ z. > > Is this interpretation of RCS coefficients even possible? If not, would > forcing knot locations make it a possibility? Or, would modeling both knots > and RCS coefs with external variables lead to sensible predictions? > > Cheers, > Dylan >Dylan, It is possible to interpret rcs coefficients. But it is not possible to equate coefficients across fits using different know locations. My suggestion is either to specify the same knots (e.g., rcs(x, c(2, 4, 6, 8)) across fits or to compare the fitted relationships (predictions) rather than the coefficients. Frank -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University
Perhaps functional data analysis would be of interest. See, for example, package fda. Kingsford On Fri, Oct 23, 2009 at 4:46 PM, Dylan Beaudette <debeaudette at ucdavis.edu> wrote:> Hi, > > I have fit a series of ols() models, by group, in this manner: > > l <- ols(y ~ rcs(x, 4)) > > ... where the series of 'x' values in each group is the same, however knots > are not always identical between groups. The result is a table of 'coefs' > derived from the ols objects, by group: > > group ? Intercept ? ? ? top ? ? top' ? ?top'' > 1 ? ? ? ?6.864 ? 0.01 ? ?2.241 ? -2.65 > 2 ? ? ? ?6.836 ? 0.047 ? -0.556 ?0.606 > 3 ? ? ? ?5.877 ? -0.019 ?0.084 ? -0.175 > 4 ? ? ? ? ? ? ? 6.021 ? -0.003 ?0.121 ? -0.128 > 5 ? ? ? ? ? ? ? 7.164 ? 0.014 ? 0.031 ? -0.096 > > I would like to describe groups of relationships, based on the coefficients, > however I am not sure if they are directly comparable. In addition, I would > like to regress these coefs on another set of variables, with the aim of > predicting a series of RCS coefficients along external gradients. In essence, > I am hoping to use RCS coefficients to summarize y ~ rcs(x), in a way that > can then me modeled like this: [y ~ rcs(x)] ~ z. > > Is this interpretation of RCS coefficients even possible? If not, would > forcing knot locations make it a possibility? Or, would modeling both knots > and RCS coefs with external variables lead to sensible predictions? > > Cheers, > Dylan > > -- > Dylan Beaudette > Soil Resource Laboratory > http://casoilresource.lawr.ucdavis.edu/ > University of California at Davis > 530.754.7341 > > ______________________________________________ > 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. >