design.polymars.RdProduces a design matrux for a model of class polymars.
design.polymars(object, x)object of the class polymars, typically the result of polymars.
the predictor values at which the design matrix will be computed. The
predictor values can be in a number of formats. It can take the form of a
vector of length equal to the number of predictors in the original data set
or it can be shortened to the length of only those predictors that occur in
the model, in the same order as they appear in the original data set.
Similarly, x can take the form of a matrix with the number of columns equal to
the number of predictors in the original data set, or shortened to the
number of predictors in the model.
The design matrix corresponding to the fitted polymars model.
Charles Kooperberg, Smarajit Bose, and Charles J. Stone (1997). Polychotomous regression. Journal of the American Statistical Association, 92, 117–127.
Charles J. Stone, Mark Hansen, Charles Kooperberg, and Young K. Truong. The use of polynomial splines and their tensor products in extended linear modeling (with discussion) (1997). Annals of Statistics, 25, 1371–1470.
data(state)
state.pm <- polymars(state.region, state.x77, knots = 15, classify = TRUE, gcv = 1)
desmat <- design.polymars(state.pm, state.x77)
# compute traditional summary of the fit for the first class
summary(lm(((state.region=="Northeast")*1) ~ desmat -1))
#>
#> Call:
#> lm(formula = ((state.region == "Northeast") * 1) ~ desmat - 1)
#>
#> Residuals:
#> Min 1Q Median 3Q Max
#> -0.48038 -0.15150 -0.03209 0.15423 0.61920
#>
#> Coefficients:
#> Estimate Std. Error t value Pr(>|t|)
#> desmat1 -1.126e+01 4.366e+00 -2.579 0.014016 *
#> desmat2 2.856e-02 1.814e-02 1.574 0.124019
#> desmat3 1.688e-02 2.078e-02 0.812 0.421796
#> desmat4 9.753e-03 9.071e-03 1.075 0.289267
#> desmat5 1.313e-01 6.662e-02 1.972 0.056167 .
#> desmat6 -4.784e-01 1.599e-01 -2.992 0.004912 **
#> desmat7 5.156e-01 2.947e-01 1.749 0.088513 .
#> desmat8 -7.859e-06 1.386e-06 -5.671 1.75e-06 ***
#> desmat9 7.083e-06 1.718e-06 4.124 0.000202 ***
#> desmat10 -8.877e-05 1.563e-04 -0.568 0.573379
#> desmat11 -4.027e-05 3.176e-05 -1.268 0.212752
#> desmat12 5.097e-05 2.429e-05 2.099 0.042741 *
#> desmat13 -2.906e-01 4.068e-01 -0.714 0.479453
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#>
#> Residual standard error: 0.2528 on 37 degrees of freedom
#> Multiple R-squared: 0.7372, Adjusted R-squared: 0.6449
#> F-statistic: 7.984 on 13 and 37 DF, p-value: 2.951e-07
#>