View source: R/uni.smooth.const-with-po.r
smooth.construct.mifo.smooth.spec | R Documentation |
This is a special method function
for creating smooths subject to a monotone increasing constraint plus the smooths should pass through zero at the right-end point of the covariate range. This is similar to the pc
argument to s
in mgcv(gam)
when pc=max(x)
, where x
is a covariate.
The smooth is built by the mgcv
constructor function for smooth terms, smooth.construct
. 'Zero intercept' identifiability constraints used for univariate SCOP-splines are substituted with a 'finish at zero' constraint here. This smooth is specified via model terms such as
s(x,k,bs="mifo",m=2)
,
where k
denotes the basis dimension and m+1
is the order of the B-spline basis.
## S3 method for class 'mifo.smooth.spec'
smooth.construct(object, data, knots)
object |
A smooth specification object, generated by an |
data |
A data frame or list containing the data required by this term,
with names given by |
knots |
An optional list containing the knots supplied for basis setup.
If it is |
The constructor is not called directly, but as with gam(mgcv)
is used internally.
A 'finish at zero' constraint is achieved by setting the last (m+1) spline coefficients to zero. According to the B-spline basis functions properties, the value of the spline, f(x)
, is determined by m+2
non-zero basis functions, and only m+1
B-splines are non-zero at knots. Only m+2
B-splines are non-zero on any [k_i, k_{i+1})
, and the sum of these m+2
basis functions is 1.
If the knots of the spline are not supplied, then they are placed evenly throughout the covariate values with an exception of the m
inner knots preceeding the last inner knot that are joined with that last knot. This is done in order to avoid an otherwise plateau fit at the right-end region. If the knots are supplied, then the number of supplied knots should be k+m+2
, and the range of the middle k-m
knots must include all the covariate values.
Note: when a plateau region is expected at the righ-end covariate region, the smooth might result in some decrease when approaching to zero.
An object of class "mifo.smooth"
.
Natalya Pya <nat.pya@gmail.com>
Pya, N. and Wood, S.N. (2015) Shape constrained additive models. Statistics and Computing, 25(3), 543-559
Pya, N. (2010) Additive models with shape constraints. PhD thesis. University of Bath. Department of Mathematical Sciences
smooth.construct.mpi.smooth.spec
,
smooth.construct.miso.smooth.spec
,
smooth.construct.mpd.smooth.spec
,
smooth.construct.mdcv.smooth.spec
,
smooth.construct.mdcx.smooth.spec
, smooth.construct.micv.smooth.spec
,
smooth.construct.micx.smooth.spec
## Monotone increasing SCOP-spline examples with a finish at zero constraint...
set.seed(53)
n <- 100;x <- runif(n);z <- runif(n)
pc <- max(x)
y <- exp(3*x)/10-exp(3*pc)/10 + z*(1-z)*5 + rnorm(100)*.4
m1 <- scam(y~s(x,bs='mifo')+s(z)) #,knots=knots)
plot(m1,pages=1,scale=0)
summary(m1)
newd<- data.frame(x=pc,z=0)
predict(m1,newd, type='terms')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.