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

R语言 VGAM包 loglaplace()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-10-1 15:42:18 | 显示全部楼层 |阅读模式
loglaplace(VGAM)
loglaplace()所属R语言包:VGAM

                                         Log-Laplace and Logit-Laplace Distribution Family Functions
                                         登录拉普拉斯和Logit模型拉普拉斯分布家庭功能

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

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

Maximum likelihood estimation of the 1-parameter log-Laplace and the 1-parameter logit-Laplace distributions. These may be used for quantile regression for counts and proportions respectively.
1参数log - 拉普拉斯1参数的罗吉特-Laplace分布的最大似然估计。这些可用于位数回归的数量和比例分别。


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


loglaplace1(tau = NULL, llocation = "loge", elocation = list(),
    ilocation = NULL, kappa = sqrt(tau/(1 - tau)), Scale.arg = 1,
    shrinkage.init = 0.95, parallelLocation = FALSE, digt = 4,
    dfmu.init = 3, rep0 = 0.5, minquantile = 0, maxquantile = Inf,
    imethod = 1, zero = NULL)
logitlaplace1(tau = NULL, llocation = "logit", elocation = list(),
    ilocation = NULL, kappa = sqrt(tau/(1 - tau)),
    Scale.arg = 1, shrinkage.init = 0.95, parallelLocation = FALSE,
    digt = 4, dfmu.init = 3, rep01 = 0.5, imethod = 1, zero = NULL)



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

参数:tau, kappa
See alaplace1.  
见alaplace1。


参数:llocation
Character. Parameter link functions for location parameter xi. See Links for more choices. However, this argument should be left unchanged with count data because it restricts the quantiles to be positive. With proportions data  llocation can be assigned a link such as logit,  probit,  cloglog,  etc.  
字符。参数链接功能,位置参数xi。见Links更多的选择。然而,这种说法应保持不变,计数资料用,因为它限制位数是积极的。随着比例数据llocation可以指派一个链路,如logit,probit,cloglog,等等。


参数:elocation
List. Extra argument for each of the links. See earg in Links for general information.  
列表。每个环节的额外参数。见earg中Links的一般信息。


参数:ilocation
Optional initial values. If given, it must be numeric and values are recycled to the appropriate length. The default is to choose the value internally.  
可选的初始值。如果给出,则它必须是数字和值被再循环到适当的长度。默认情况下是选择内部的价值。


参数:parallelLocation
Logical. Should the quantiles be parallel on the transformed scale (argument llocation)? Assigning this argument to TRUE circumvents the seriously embarrassing quantile crossing problem.  
逻辑。位数是并行的转换规模(参数llocation)?分配这种说法TRUE避开严重的尴尬位数的交叉问题。


参数:imethod
Initialization method. Either the value 1, 2, or ....  
初始化方法。无论是价值1,2,或....


参数:dfmu.init, shrinkage.init, Scale.arg, digt, zero
See alaplace1.  
见alaplace1。


参数:rep0, rep01
Numeric, positive. Replacement values for 0s and 1s respectively. For count data, values of the response whose value is 0 are replaced by rep0; it avoids computing log(0). For proportions data values of the response whose value is 0 or 1 are replaced by min(rangey01[1]/2, rep01/w[y< = 0]) and max((1 + rangey01[2])/2, 1-rep01/w[y >= 1]) respectively; e.g., it avoids computing logit(0) or logit(1). Here, rangey01 is the 2-vector range(y[(y > 0) &amp; (y < 1)]) of the response.  
数字的,积极的。替换值分别为0和1。用于计数数据的值的响应,其值是0被替换rep0,它避免了计算log(0)。对于比例的数据值的响应,它的值是0或1所取代min(rangey01[1]/2, rep01/w[y< = 0])和max((1 + rangey01[2])/2, 1-rep01/w[y >= 1]);例如,它避免了计算logit(0)或logit(1)。在这里,rangey01是2向量range(y[(y > 0) &amp; (y < 1)])的响应。


参数:minquantile, maxquantile
Numeric. The minimum and maximum values possible in the quantiles. These argument are effectively ignored by default since loge keeps all quantiles positive. However, if  llocation = "logoff", elocation = list(offset = 1) then it is possible that the fitted quantiles have value 0 because minquantile = 0.  
数字。的最小和最大的值可能在分位数。这些参数将被忽略默认情况下,自loge保持所有位数积极的。但是,如果llocation = "logoff", elocation = list(offset = 1)然后它可能是装位数值为0,因为minquantile = 0。


Details

详细信息----------Details----------

These VGAM family functions implement translations of the asymmetric Laplace distribution (ALD). The resulting variants may be suitable for quantile regression for count data or sample proportions. For example, a log link applied to count data is assumed to follow an ALD. Another example is a logit link applied to proportions data so as to follow an ALD. A positive random variable Y is said to have a log-Laplace distribution if Y = exp(W) where W has an ALD. There are many variants of ALDs and the one used here is described in alaplace1.
这些VGAM家庭功能的实现非对称的Laplace分布(ALD)的翻译。由此产生的变异可能是适合位数回归,用于计数数据或样本比例。例如,log适用于计数数据的链接被假定为遵循ALD。另一个例子是logit的关联应用的比例数据,以遵循ALD。一个正的随机变量Y说,如果有log拉普拉斯分布Y = exp(W)W ALD。有许多变种限期任用和这里所用的1中描述的alaplace1。


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

An object of class "vglmff" (see vglmff-class). The object is used by modelling functions such as vglm and vgam.
类的一个对象"vglmff"(见vglmff-class)。该对象被用于建模功能如vglm和vgam。

In the extra slot of the fitted object are some list components which are useful. For example, the sample proportion of values which are less than the fitted quantile curves, which is sum(wprior[y <= location]) / sum(wprior) internally. Here, wprior are the prior weights (called ssize below), y is the response and location is a fitted quantile curve. This definition comes about naturally from the transformed ALD data.
在extra插槽的拟合对象是一些有用的列表组件。例如,样本比例小于拟合位数的曲线,这是sum(wprior[y <= location]) / sum(wprior)内部的值,这些值。在这里,wprior前的权重(称为ssize以下),y是响应和location是一个装有位数的曲线。这个定义自然转化ALD数据。


警告----------Warning----------

The VGAM family function logitlaplace1 will not handle a vector of just 0s and 1s as the response; it will only work satisfactorily if the number of trials is large.
VGAM家庭函数logitlaplace1不会处理矢量只有“0”和“1作为响应,它会满意的工作,如果试验的次数是大。

See alaplace1 for other warnings. Care is needed with tau values which are too small, e.g., for count data the sample proportion of zeros must be less than all values in tau. Similarly, this also holds with logitlaplace1, which also requires all tau values to be less than the sample proportion of ones.
见alaplace1其他的警告。需要注意tau值太小,例如,用于计数数据的零的样本比例必须小于中的所有值tau。同样,这也与logitlaplace1,这也需要所有tau值是小于的样本比例的。


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

The form of input for logitlaplace1 as response is a vector of proportions (values in [0,1]) and the number of trials is entered into the weights argument of vglm/vgam. See Example 2 below. See alaplace1 for other notes in general.
的形式输入logitlaplace1作为响应变量是向量的比例(值在[0,1])输入到weights的vglm参数的试验和/vgam。请参阅下面的示例2。见alaplace1一般的其他注意事项。


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


Thomas W. Yee



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

The Laplace distribution and generalizations: a revisit with applications to communications, economics, engineering, and finance, Boston: Birkhauser.
Log-Laplace distributions. International Mathematical Journal, 3, 467&ndash;495.
Quantile regression for counts and proportions. In preparation.

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

alaplace1, dloglap.
alaplace1,dloglap。


实例----------Examples----------


# Example 1: quantile regression of counts with regression splines[例1:计数位数回归的回归样条]
set.seed(123); my.k = exp(0)
alldat = data.frame(x2 = sort(runif(n <- 500)))
mymu = function(x) exp( 1 + 3*sin(2*x) / (x+0.5)^2)
alldat = transform(alldat, y = rnbinom(n, mu = mymu(x2), size = my.k))
mytau = c(0.1, 0.25, 0.5, 0.75, 0.9); mydof = 3
fitp = vglm(y ~ bs(x2, df = mydof), data=alldat, trace = TRUE,
            loglaplace1(tau = mytau, parallelLoc = TRUE)) # halfstepping is usual[halfstepping通常是]

## Not run: [#不运行:]
par(las = 1)  # Plot on a log1p() scale[图在log1p()规模]
mylwd = 1.5
with(alldat, plot(x2, jitter(log1p(y), factor = 1.5), col = "red", pch = "o",
     main = "Example 1; darkgreen=truth, blue=estimated", cex = 0.75))
with(alldat, matlines(x2, log1p(fitted(fitp)), col = "blue", lty = 1, lwd = mylwd))
finexgrid = seq(0, 1, len=201)
for(ii in 1:length(mytau))
    lines(finexgrid, col = "darkgreen", lwd = mylwd,
          log1p(qnbinom(p = mytau[ii], mu = mymu(finexgrid), si = my.k)))

## End(Not run)[#(不执行)]
fitp@extra  # Contains useful information[包含有用的信息]


# Example 2: sample proportions[例2:样本比例]
set.seed(123); nnn = 1000; ssize = 100  # ssize = 1 will not work![ssize = 1时将无法正常工作!]
alldat = data.frame(x2 = sort(runif(nnn)))
mymu = function(x) logit( 1.0 + 4*x, inv = TRUE)
alldat = transform(alldat, ssize = ssize,
                   y2 = rbinom(nnn, size=ssize, prob = mymu(x2)) / ssize)

mytau = c(0.25, 0.50, 0.75)
fit1 = vglm(y2 ~ bs(x2, df = 3), data=alldat, weights=ssize, trace = TRUE,
            logitlaplace1(tau = mytau, lloc = "cloglog", paral = TRUE))

## Not run: [#不运行:]
# Check the solution.  Note: this may be like comparing apples with oranges.[检查解决方案。注意:这可能是就像比较苹果和橘子。]
plotvgam(fit1, se = TRUE, scol = "red", lcol = "blue", main = "Truth = 'darkgreen'")
# Centered approximately ![中心约!]
linkFunctionChar = as.character(fit1@misc$link)
alldat = transform(alldat, trueFunction=
                   theta2eta(theta = mymu(x2), link=linkFunctionChar))
with(alldat, lines(x2, trueFunction - mean(trueFunction), col = "darkgreen"))


# Plot the data + fitted quantiles (on the original scale)[绘制数据+装位数(上原有的规模)]
myylim = with(alldat, range(y2))
with(alldat, plot(x2, y2, col = "blue", ylim = myylim, las = 1, pch = ".", cex=2.5))
with(alldat, matplot(x2, fitted(fit1), add = TRUE, lwd = 3, type = "l"))
truecol = rep(1:3, len=fit1@misc$M) # Add the 'truth'[新增的“真相”]
smallxgrid = seq(0, 1, len=501)
for(ii in 1:length(mytau))
    lines(smallxgrid, col=truecol[ii], lwd=2,
          qbinom(p = mytau[ii], prob = mymu(smallxgrid), size=ssize) / ssize)


# Plot on the eta (== logit()/probit()/...) scale[图ETA(==罗吉特()/概率()/ ...)规模]
with(alldat, matplot(x2, predict(fit1), add = FALSE, lwd = 3, type = "l"))
# Add the 'truth'[新增的“真相”]
for(ii in 1:length(mytau)) {
    true.quant = qbinom(p = mytau[ii], pr = mymu(smallxgrid), si=ssize)/ssize
    lines(smallxgrid, theta2eta(theta=true.quant, link=linkFunctionChar),
          col=truecol[ii], lwd=2)
}

## End(Not run)[#(不执行)]

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-26 17:48 , Processed in 0.026349 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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