找回密码
 注册
查看: 5235|回复: 1

R语言:family()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-16 21:14:39 | 显示全部楼层 |阅读模式
family(stats)
family()所属R语言包:stats

                                        Family Objects for Models
                                         家庭对象模型

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

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

Family objects provide a convenient way to specify the details of the models used by functions such as glm.  See the documentation for glm for the details on how such model fitting takes place.
家庭对象提供了一个方便的方式来指定功能,如glm使用的模型的细节。看到文档glm这样的模型拟合如何发生的细节。


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


family(object, ...)

binomial(link = "logit")
gaussian(link = "identity")
Gamma(link = "inverse")
inverse.gaussian(link = "1/mu^2")
poisson(link = "log")
quasi(link = "identity", variance = "constant")
quasibinomial(link = "logit")
quasipoisson(link = "log")



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

参数:link
a specification for the model link function.  This can be a name/expression, a literal character string, a length-one character vector or an object of class "link-glm" (such as generated by make.link) provided it is not specified via one of the standard names given next.  The gaussian family accepts the links (as names) identity, log and inverse; the binomial family the links logit, probit, cauchit, (corresponding to logistic, normal and Cauchy CDFs respectively) log and cloglog (complementary log-log); the Gamma family the links inverse, identity and log; the poisson family the links log, identity, and sqrt and the inverse.gaussian family the links 1/mu^2, inverse, identity and log.  The quasi family accepts the links logit, probit, cloglog,  identity, inverse, log, 1/mu^2 and sqrt, and the function power can be used to create a power link function.  
模型链接功能的规范。这可以是一个名称/表达,文字字符串,长度的一个特征向量或一个类的对象"link-glm"(如产生make.link)提供,它是无法通过的标准之一指定名称给未来。 gaussian家庭接受的链接(如姓名)identity,log和inversebinomial家庭的链接logit,<X >,probit,(分别对应的物流,正常和柯西CDFS)cauchit和log(互补日志记录);cloglog家庭的联系<X >,Gamma和inverse;identity家庭的联系log,poisson,log和identity家庭链接sqrt,inverse.gaussian,1/mu^2和inverse。 identity家庭接受的链接log,quasi,logit,probit,cloglog,identity,inverse 和log,功能1/mu^2可以用来创建一个电源连接功能。


参数:variance
for all families other than quasi, the variance function is determined by the family.  The quasi family will accept the literal character string (or unquoted as a name/expression) specifications "constant", "mu(1-mu)", "mu", "mu^2" and "mu^3", a length-one character vector taking one of those values, or a list containing components varfun, validmu, dev.resids, initialize and name.  
方差函数比quasi其他所有的家庭,由家庭决定。 quasi家庭将接受文本字符串(或名称/表达式加引号)规格"constant","mu(1-mu)","mu","mu^2"和<X >,长度的一个特征向量,这些值之一,或列表中包含的组件"mu^3",varfun,validmu,dev.resids和initialize。


参数:object
the function family accesses the family objects which are stored within objects created by modelling functions (e.g., glm).
功能family访问family内建模功能创建的对象中存储的对象(例如,glm)的。


参数:...
further arguments passed to methods.
进一步的参数传递方法。


Details

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

family is a generic function with methods for classes "glm" and "lm" (the latter returning gaussian()).
family类的通用功能与方法"glm"和"lm"(后者返回gaussian())。

The quasibinomial and quasipoisson families differ from the binomial and poisson families only in that the dispersion parameter is not fixed at one, so they can model over-dispersion.  For the binomial case see McCullagh and Nelder (1989, pp. 124&ndash;8).  Although they show that there is (under some restrictions) a model with variance proportional to mean as in the quasi-binomial model, note that glm does not compute maximum-likelihood estimates in that model.  The behaviour of S is closer to the quasi- variants.
quasibinomial和quasipoissonbinomial和poisson仅在该分散参数的家庭没有一个固定的,所以他们可以模拟过度分散的家庭不同。为二项式的情况下,看到McCullagh和Nelder(1989年,第124-8页)。虽然他们有(下一些限制)准二项式模型,注意意味着glm不计算在该模型的最大似然估计与方差比例模型。 S的行为是准的变种。


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

An object of class "family" (which has a concise print method). This is a list with elements
一个类的对象"family"(其中有一个简洁的打印方法)。这是一个元素的列表


参数:family
character: the family name.
人物:姓。


参数:link
character: the link name.
性格:链接的名称。


参数:linkfun
function: the link.
功能:链接。


参数:linkinv
function: the inverse of the link function.
功能:逆链接功能。


参数:variance
function: the variance as a function of the mean.
功能:函数均值的方差。


参数:dev.resids
function giving the deviance residuals as a function of (y, mu, wt).
功能给作为(y, mu, wt)函数的偏差残差。


参数:aic
function giving the AIC value if appropriate (but NA for the quasi- families).  See logLik for the assumptions made about the dispersion parameter.
功能,给予AIC值是否合适(但NA准家庭)。看到logLik有关的色散参数所作的假设。


参数:mu.eta
function: derivative function(eta) d&mu;/d&eta;.
功能:衍生function(eta)d&mu;/d&eta;。


参数:initialize
expression.  This needs to set up whatever data objects are needed for the family as well as n (needed for AIC in the binomial family) and mustart (see glm.
表达。这就需要建立任何数据对象,以及家庭需要n(AIC的在二项式家庭的需要)和mustart(见glm。


参数:valid.mu
logical function.  Returns TRUE if a mean vector mu is within the domain of variance.
逻辑功能。返回TRUE如果平均向量mu在域variance是。


参数:valid.eta
logical function.   Returns TRUE if a linear predictor eta is within the domain of linkinv.
逻辑功能。返回TRUE如果一个线性预测eta在域linkinv是。


参数:simulate
(optional) function simulate(object, nsim) to be called by the "lm" method of simulate.  It will normally return a matrix with nsim columns and one row for each fitted value, but it can also return a list of length nsim. Clearly this will be missing for "quasi-" families.
(可选)功能simulate(object, nsim)"lm"simulate方法的调用。 nsim列和一排每个拟合值,它通常会返回一个矩阵,但它也可以返回一个列表长度nsim。显然,这将丢失准家庭。


注意----------Note----------

The link and variance arguments have rather awkward semantics for back-compatibility.  The recommended way is to supply them is as quoted character strings, but they can also be supplied unquoted (as names or expressions).  In addition, they can also be supplied as a length-one character vector giving the name of one of the options, or as a list (for link, of class "link-glm").  The restrictions apply only to links given as names: when given as a character string all the links known to make.link are accepted.
link和variance参数具有向后兼容性颇为尴尬的语义。推荐的方法是提供他们援引字符串,但他们也可以提供非上市(如名称或词句)。此外,他们还可以提供长度的一个特征向量名称的选项之一,或作为一个列表(link类"link-glm")。限制只适用于作为名称给的链接:当所有已知的make.link接受一个字符串。

This is potentially ambiguous: supplying link=logit could mean the unquoted name of a link or the value of object logit.  It is interpreted if possible as the name of an allowed link, then as an object.  (You can force the interpretation to always be the value of an object via logit[1].)
这可能是模棱两可的:供应link=logit可能意味着的一个环节引号的名称或值的对象logit。如果可能的话,它被解释为允许链接的名称,然后作为一个对象。 (您可以强制的解释始终是通过logit[1]对象的值)。


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



The design was inspired by S functions of the same names described
in Hastie &amp; Pregibon (1992) (except <code>quasibinomial</code> and
<code>quasipoisson</code>).




参考文献----------References----------

Generalized Linear Models. London: Chapman and Hall.
An Introduction to Statistical Modelling. London: Chapman and Hall.
Applied Statistics; Principles and Examples. London: Chapman and Hall.
Generalized linear models. Chapter 6 of Statistical Models in S eds J. M. Chambers and T. J. Hastie, Wadsworth &amp; Brooks/Cole.

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

glm, power, make.link.
glm,power,make.link。

For binomial coefficients, choose; the binomial and negative binomial distributions, Binomial, and NegBinomial.
二项式系数,choose;二项分布和负二项分布,Binomial,NegBinomial。


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


require(utils) # for str[为STR]

nf &lt;- gaussian()# Normal family[正常的家庭]
nf
str(nf)# internal STRucture[内部结构]

gf <- Gamma()
gf
str(gf)
gf$linkinv
gf$variance(-3:4) #- == (.)^2[ - ()== ^ 2]


## quasipoisson. compare with example(glm)[#quasipoisson。例如比较(GLM)]
counts <- c(18,17,15,20,10,20,25,13,12)
outcome <- gl(3,1,9)
treatment <- gl(3,3)
d.AD <- data.frame(treatment, outcome, counts)
glm.qD93 <- glm(counts ~ outcome + treatment, family=quasipoisson())

glm.qD93
anova(glm.qD93, test="F")
summary(glm.qD93)
## for Poisson results use[#为泊松结果使用]
anova(glm.qD93, dispersion = 1, test="Chisq")
summary(glm.qD93, dispersion = 1)


## Example of user-specified link, a logit model for p^days[#为例,用户指定的链接,Logit模型的p ^天]
## See Shaffer, T.  2004. Auk 121(2): 526-540.[#谢弗,T. 2004。 ,帕奥121(2):526-540。]
logexp <- function(days = 1)
{
    linkfun <- function(mu) qlogis(mu^(1/days))
    linkinv <- function(eta) plogis(eta)^days
    mu.eta <- function(eta) days * plogis(eta)^(days-1) *
      .Call("logit_mu_eta", eta, PACKAGE = "stats")
    valideta <- function(eta) TRUE
    link <- paste("logexp(", days, ")", sep="")
    structure(list(linkfun = linkfun, linkinv = linkinv,
                   mu.eta = mu.eta, valideta = valideta, name = link),
              class = "link-glm")
}
binomial(logexp(3))
## in practice this would be used with a vector of 'days', in[#在实践中,将用一个天的向量,]
## which case use an offset of 0 in the corresponding formula[#这种情况下,使用相应的公式的偏移量为0]
## to get the null deviance right.[#空的越轨行为的权利。]

## Binomial with identity link: often not a good idea.[往往不是一个好主意:#二项式身份链接。]
## Not run: binomial(link=make.link("identity"))[#无法运行:二项式(链接= make.link(“身份”))]

## tests of quasi[#测试准]
x <- rnorm(100)
y <- rpois(100, exp(1+x))
glm(y ~x, family=quasi(variance="mu", link="log"))
# which is the same as[这是一样的]
glm(y ~x, family=poisson)
glm(y ~x, family=quasi(variance="mu^2", link="log"))
## Not run: glm(y ~x, family=quasi(variance="mu^3", link="log")) # fails[#无法运行:GLM(Y&#12316;X,家庭=准(方差=“万亩^ 3”链接=“日志”))#失败]
y <- rbinom(100, 1, plogis(x))
# needs to set a starting value for the next fit[需要设置为下一个合适的起始值]
glm(y ~x, family=quasi(variance="mu(1-mu)", link="logit"), start=c(0,1))

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


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

使用道具 举报

发表于 2014-7-18 10:10:17 | 显示全部楼层
{:soso_e179:}
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-1-22 23:04 , Processed in 0.021620 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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