sm.decr: Specify a smooth and decreasing shape-restriction in a...

Description Usage Arguments Details Value Author(s) References Examples

Description

A symbolic routine to define that the systematic component η is smooth and decreasing with respect to a predictor in a bcgam formula.

Usage

1
sm.decr(x, numknots = 0, knots = 0, space = "Q")

Arguments

x

a numeric predictor of length n.

numknots

number of knots used to constrain x. It is ignored when the knots argument is specified by the user. If neither numknots nor knots are specified by the user, then numknots is floor{4+n^(1/7)}. The default is 0.

knots

knots used to constrain x. If they are not specified by the user, then they will be automatically created based on numknots and space. The default is 0.

space

a character specifying the method to create knots. It is ignored when the knots argument is specified by the user. If space="E", then equally spaced knots will be created; if space="Q", then a vector of equal quantiles will be created based on x with duplicate elements removed. The default is "Q".

Details

sm.decr returns the vector x and assigns five attributes to it: name, shape (2 for "smooth and decreasing"), numknots, knots and space.

This routine does not create the splines basis vectors by itself.

Value

x

The numeric predictor x.

Author(s)

Cristian Oliva-Aviles and Mary C. Meyer

References

Meyer, M. C. (2008) Inference using shape-restricted regression splines. Annals of Applied Statistics 2(3), 1013-1033.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(duncan)

prestige <- duncan$prestige

# specify knots
sm.decr(prestige, knots=c(3,9,30,57,86,97))

# specify number of knots
prestige.smdecr <- sm.decr(prestige, numknots=7)

# check attributes
attributes(prestige.smdecr)

bcgam documentation built on May 2, 2019, 8:42 a.m.

Related to sm.decr in bcgam...