Estimate hypothesis test of lower- and higher-order non-linear relationships against an assumed target relationship.

NKnotsTest(
  form,
  var,
  data,
  targetdf = 1,
  degree = 3,
  min.knots = 1,
  max.knots = 10,
  adjust = "none"
)

Arguments

form

A formula detailing the model for which smoothing is to be evaluated.

var

A character string identifying the variable for which smoothing is to be evaluated.

data

Data frame providing values of all variables in form.

targetdf

The assumed degrees of freedom against which the tests will be conducted.

degree

Degree of polynomial in B-spline basis functions.

min.knots

Minimum number of internal B-spline knots to be evaluated.

max.knots

Maximum number of internal B-spline knots to be evaluated.

adjust

Method by which p-values will be adjusted (see p.adjust)

Value

A matrix with the following columns:

F

F statistics of test of candidate models against target model

DF1

Numerator DF from F-test

DF2

Denominator DF from F-test

p(F)

p-value from the F-test

Clarke

Test statistic from the Clarke test

Pr(Better)

The Clarke statistic divided by the number of observations

p(Clarke)

p-value from the Clarke test. (T) means that the significant p-value is in favor of the Target model and (C) means the significant p-value is in favor of the candidate (alternative) model.

Delta_AIC

AIC(candidate model) - AIC(target model)

Delta_AICc

AICc(candidate model) - AICc(target model)

Delta_BIC

BIC(candidate model) - BIC(target model)

Examples

data(Prestige, package="carData") NKnotsTest(prestige ~ education + type, var="income", data=na.omit(Prestige), targetdf=3)
#> F DF1 DF2 p(F) Clarke Pr(Better) p(Clarke) Delta_AIC #> DF=3 vs. DF=1 6.962* 2 91 0.002 47 0.480 0.762 9.953 #> DF=3 vs. DF=2 5.211* 1 91 0.025 44 0.449 0.363 3.457 #> Target #> DF=3 vs. DF=4 1.140 1 90 0.289 66* 0.673 0.001 (T) 0.767 #> DF=3 vs. DF=5 0.735 2 89 0.483 72* 0.735 0.000 (T) 2.396 #> DF=3 vs. DF=6 0.540 3 88 0.656 77* 0.786 0.000 (T) 4.211 #> DF=3 vs. DF=7 0.378 4 87 0.824 81* 0.827 0.000 (T) 6.313 #> DF=3 vs. DF=8 0.463 5 86 0.803 80* 0.816 0.000 (T) 7.399 #> DF=3 vs. DF=9 0.356 6 85 0.905 81* 0.827 0.000 (T) 9.570 #> DF=3 vs. DF=10 0.631 7 84 0.729 82* 0.837 0.000 (T) 8.981 #> DF=3 vs. DF=11 0.483 8 83 0.865 82* 0.837 0.000 (T) 11.538 #> DF=3 vs. DF=12 0.557 9 82 0.828 83* 0.847 0.000 (T) 12.185 #> DF=3 vs. DF=13 0.524 10 81 0.869 85* 0.867 0.000 (T) 13.859 #> Delta_AICc Delta_BIC #> DF=3 vs. DF=1 9.258 4.783 #> DF=3 vs. DF=2 3.083 0.872 #> Target #> DF=3 vs. DF=4 1.194 3.352 #> DF=3 vs. DF=5 3.306 7.565 #> DF=3 vs. DF=6 5.663 11.966 #> DF=3 vs. DF=7 8.365 16.653 #> DF=3 vs. DF=8 10.115 20.324 #> DF=3 vs. DF=9 13.012 25.080 #> DF=3 vs. DF=10 13.217 27.076 #> DF=3 vs. DF=11 16.636 32.218 #> DF=3 vs. DF=12 18.217 35.450 #> DF=3 vs. DF=13 20.899 39.709