Learn R Programming

DAMisc (version 1.7.2)

NKnotsTest: Test of functional form assumption using B-splines

Description

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

Usage

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

Run this code
# NOT RUN {
data(Prestige, package="carData")
NKnotsTest(prestige ~ education + type, var="income", data=na.omit(Prestige), targetdf=3)

# }

Run the code above in your browser using DataLab