smooth.construct.mpi.smooth.spec(scam)
smooth.construct.mpi.smooth.spec()所属R语言包:scam
Constructor for monotone increasing P-splines in SCAMs
P-样条曲线的构造函数单调增加诈骗
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This is a special method function for creating smooths subject to a monotone increasing constraint which is built by the mgcv constructor function for smooth terms, smooth.construct. It is constructed using monotonic P-splines. This smooth is specified via model terms suach as s(x,k,bs="mpi",m=2), where k denotes the basis dimension and m+1 is the order of the B-spline basis.
这是一个特殊的方法,用于创建功能,平滑一个单调递增的约束,是建立在mgcv的构造函数的光滑条款,smooth.construct。这是构建使用单调的P-样条。这种流畅指定的通过模型的条款suachs(x,k,bs="mpi",m=2),其中k表示基础尺寸和m+1是B样条基的顺序。
用法----------Usage----------
smooth.construct.mpi.smooth.spec(object, data, knots)
参数----------Arguments----------
参数:object
A smooth specification object, generated by an s term in a GAM formula.
光滑的规范对象,产生的s术语一个GAM公式中。
参数:data
A data frame or list containing the data required by this term, with names given by object$term. The by variable is the last element.
一个数据框或列表,其中包含这个词所需要的数据,的名字的object$term。 by变量的最后一个元素。
参数:knots
An optional list containing the knots supplied for basis setup. If it is NULL then the knot locations are generated automatically.
一个可选的列表,其中包含基础设置中提供的疙瘩。如果是NULL然后结位置自动生成。
值----------Value----------
An object of class "mpi.smooth".
对象的类"mpi.smooth"。
(作者)----------Author(s)----------
Natalya Pya <nat.pya@gmail.com>
参考文献----------References----------
参见----------See Also----------
smooth.construct.mpd.smooth.spec, smooth.construct.cv.smooth.spec, smooth.construct.cx.smooth.spec, smooth.construct.mdcv.smooth.spec, smooth.construct.mdcx.smooth.spec, smooth.construct.micv.smooth.spec, smooth.construct.micx.smooth.spec
smooth.construct.mpd.smooth.spec,smooth.construct.cv.smooth.spec,smooth.construct.cx.smooth.spec,smooth.construct.mdcv.smooth.spec,smooth.construct.mdcx.smooth.spec,smooth.construct.micv.smooth.spec,smooth.construct.micx.smooth.spec
实例----------Examples----------
## Monotone increasing P-splines example [#单调增加P-样条曲线的例子]
## simulating data...[#模拟数据...]
set.seed(12)
n <- 100
x <- runif(n)*4-1
f <- 4*exp(4*x)/(1+exp(4*x))
y <- rpois(n,exp(f))
dat <- data.frame(x=x,y=y)
## fit model ...[#拟合模型...]
b <- scam(y~s(x,k=15,bs="mpi",m=2),family=poisson(link="log"),
data=dat,sp=NULL)
# UNCONSTRAINED FIT *****************[无约束FIT *****************]
b1 <- scam(y~s(x,k=15,bs="ps",m=2),family=poisson(link="log"),
data=dat,sp=NULL)
## plot results ...[#图...]
plot(x,y,xlab="x",ylab="y")
x1 <- sort(x,index=TRUE)
lines(x1$x,exp(f)[x1$ix]) ## the true function[#真正的功能]
lines(x1$x,b$fitted.values[x1$ix],col=2) ## monotone fit [#单调适合]
lines(x1$x,b1$fitted.values[x1$ix],col=3) ## unconstrained fit [#不受约束的契合]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|