找回密码
 注册
查看: 1651|回复: 0

R语言:smooth.construct.fs.smooth.spec()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-16 18:16:29 | 显示全部楼层 |阅读模式
smooth.construct.fs.smooth.spec(mgcv)
smooth.construct.fs.smooth.spec()所属R语言包:mgcv

                                        Factor smooth interactions in GAMs
                                         GAMS平滑因子相互作用

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Simple factor smooth interactions, which are efficient when used with gamm. This smooth class allows a separate smooth for each level of a factor, with the same smoothing parameter for all  smooths. It is an alternative to using factor by variables.
简单的因素顺利的相互作用,这是有效时,与gamm使用。这光滑的类允许单独为每一个因素的水平平稳,与所有平滑平滑参数。这是一个因素by变量的替代。

See the discussion of by variables in gam.models for more general alternatives  for factor smooth interactions (including interactions of tensor product smooths with factors).
看到bygam.models顺利相互作用因素更普遍的替代品(包括张量积的相互作用的因素平滑)变量的讨论。


用法----------Usage----------


## S3 method for class 'fs.smooth.spec'
smooth.construct(object, data, knots)
## S3 method for class 'fs.interaction'
Predict.matrix(object, data)



参数----------Arguments----------

参数:object
For the smooth.construct method a smooth specification object,  usually generated by a term s(x,...,bs="fs",). For the predict.Matrix method  an object of class "fs.interaction" produced by the smooth.construct method.
顺利的规范对象为smooth.construct方法,通常由一个术语s(x,...,bs="fs",)。类对象为predict.Matrix方法"fs.interaction"生产smooth.construct方法。


参数:data
a list containing just the data (including any by variable) required by this term,  with names corresponding to object$term.  
只是这个词所需要的数据(包括任何by变量)对应object$term的名称,一个列表,其中包含。


参数:knots
a list containing any knots supplied for smooth basis setup.
一个列表,其中包含提供平稳的基础上设置任何节。


Details

详情----------Details----------

This class produces a smooth for each level of a single factor variable. Within a gam  formula this is done with something like s(x,fac,bs="fs"), which is almost equivalent to s(x,by=fac,id=1)  (with the gam argument select=TRUE). The terms are fully penalized, with separate penalties on each null  space component: for this reason they are not centred (no sum-to-zero constraint).
这个类产生的每一个单因素变量的水平平稳。这是做一些像gam内s(x,fac,bs="fs")公式,这几乎相当于s(x,by=fac,id=1)(gam说法select=TRUE)。充分处罚条款,每个空的空间部分单独处罚:因为这个原因,他们不集中(无金额的零约束)。

The class is particularly useful for use with gamm, where estimation efficiently exploits  the nesting of the smooth within the factor. Note however that: i) gamm only allows one conditioning  factor for smooths, so s(x)+s(z,fac,bs="fs")+s(v,fac,bs="fs") is OK, but s(x)+s(z,fac1,bs="fs")+s(v,fac2,bs="fs") is not; ii) all aditional random effects and correlation structures will be treated as nested within the factor of the smooth factor interaction.
类是使用gamm特别有用,估计有效利用内部因素的顺利筑巢。但是请注意:I)gamm只允许有一个调节因子平滑,所以s(x)+s(z,fac,bs="fs")+s(v,fac,bs="fs")是确定的,但s(x)+s(z,fac1,bs="fs")+s(v,fac2,bs="fs")是不是;二)所有aditional随机效应和相关的结构将被视为嵌套的平滑因子相互作用的因素。

Note that gamm4 from the gamm4 package suffers from none of the restrictions that apply to gamm, and "fs" terms can be used without side-effects.
注意gamm4gamm4包的限制申请gamm和"fs"的无遭受条款可以用于无副作用。

Any singly penalized basis can be used to smooth at each factor level. The default is "tp", but alternatives can  be supplied in the xt argument of s (e.g. s(x,fac,bs="fs",xt="cr") or  s(x,fac,bs="fs",xt=list(bs="cr")). The k argument to s(...,bs="fs") refers to the basis dimension to  use for each level of the factor variable.
可用于任何单处罚的基础上,在每个因子水平平稳。默认是"tp",但替代品可以在xt参数提供s(如s(x,fac,bs="fs",xt="cr")或s(x,fac,bs="fs",xt=list(bs="cr"))。 k参数s(...,bs="fs")是指用于每个因素变量的水平的基础层面。

Note one computational bottleneck: currently gamm (or gamm4) will produce the full posterior covariance matrix for the  smooths, including the smooths at each level of the factor. This matrix can get large and computationally costly if there  are more than a few hundred levels of the factor. Even at one or two hundred levels, care should be taken to keep  down k.
注意:一个计算瓶颈:目前的gamm(或gamm4)会产生后的协方差矩阵的平滑完整,包括在每个因子的水平平滑。这个矩阵可以得到很大的计算昂贵,如果有超过几百水平的因素。即使在一两百元的水平,应采取以压低k。

The plot method for this class has two schemes. scheme==0 is in colour, while scheme==1 is black and white.
这个类的绘图方法有两种方案。 scheme==0是彩色的,而scheme==1是黑色和白色。


值----------Value----------

An object of class "fs.interaction" or a matrix mapping the coefficients of the factor smooth interaction to the smooths themselves.
一个对象类"fs.interaction"或映射流畅的互动因素的系数矩阵平滑。


作者(S)----------Author(s)----------


Simon N. Wood <a href="mailto:simon.wood@r-project.org">simon.wood@r-project.org</a>



参见----------See Also----------

gam.models, gamm
gam.models,gamm


举例----------Examples----------


library(mgcv)
set.seed(0)
## simulate data...[#模拟数据...]
f0 <- function(x) 2 * sin(pi * x)
f1 <- function(x,a=2,b=-1) exp(a * x)+b
f2 <- function(x) 0.2 * x^11 * (10 * (1 - x))^6 + 10 *
            (10 * x)^3 * (1 - x)^10
n <- 500;nf <- 25
fac <- sample(1:nf,n,replace=TRUE)
x0 <- runif(n);x1 <- runif(n);x2 <- runif(n)
a <- rnorm(nf)*.2 + 2;b <- rnorm(nf)*.5
f <- f0(x0) + f1(x1,a[fac],b[fac]) + f2(x2)
fac <- factor(fac)
y <- f + rnorm(n)*2
## so response depends on global smooths of x0 and [#所以反应取决于对全球平滑和X0]
## x2, and a smooth of x1 for each level of fac.[#X2和X1为每个因子的水平顺利。]

## fit model...[#适合模型...]
bm <- gamm(y~s(x0)+ s(x1,fac,bs="fs",k=5)+s(x2,k=20))
plot(bm$gam,pages=1)

## Could also use...[#也可以使用...]
## b &lt;- gam(y~s(x0)+ s(x1,fac,bs="fs",k=5)+s(x2,k=20),method="ML")[#B < - 自由亚齐运动(Y&#12316;(X0)+ S(X1,FAC,BS =“FS”,K = 5)+(X2,K = 20),方法=“毫升”)]
## ... but its slower (increasingly so with increasing nf)[#...但其速度较慢(随着NF越来越如此)]
## b &lt;- gam(y~s(x0)+ t2(x1,fac,bs=c("tp","re"),k=5,full=TRUE)+[#B < -  GAM(Y&#12316;(X0)+ T2(X1,FAC,BS = C(“TP”,“重”),K = 5,全真)+]
##        s(x2,k=20),method="ML"))[#(X2,K = 20),方法=“毫升”))]
## ... is exactly equivalent. [#...是完全等效的。]

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-1-23 12:11 , Processed in 0.025096 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表