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

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

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

                                         Asymmetric Laplace Distribution Family Functions
                                         不对称拉普拉斯分布族功能

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

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

Maximum likelihood estimation of the 1, 2 and 3-parameter asymmetric Laplace distributions (ALDs). The 1-parameter ALD may be used for quantile regression.
最大似然估计的1,2和3参数的非对称Laplace分布(ALDS)。 1参数ALD可用于分位数回归。


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


alaplace1(tau = NULL, llocation = "identity", elocation = list(),
          ilocation = NULL, kappa = sqrt(tau/(1 - tau)), Scale.arg = 1,
          shrinkage.init = 0.95, parallelLocation = FALSE, digt = 4,
          dfmu.init = 3, intparloc = FALSE, imethod = 1)

alaplace2(tau = NULL,  llocation = "identity", lscale = "loge",
          elocation = list(), escale = list(),
          ilocation = NULL, iscale = NULL, kappa = sqrt(tau/(1 - tau)),
          shrinkage.init = 0.95,
          parallelLocation = FALSE, digt = 4, sameScale = TRUE,
          dfmu.init = 3, intparloc = FALSE,
          imethod = 1, zero = -2)

alaplace3(llocation = "identity", lscale = "loge", lkappa = "loge",
          elocation = list(), escale = list(), ekappa = list(),
          ilocation = NULL, iscale = NULL, ikappa = 1,
          imethod = 1, zero = 2:3)



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

参数:tau, kappa
Numeric vectors with 0 < tau < 1 and kappa >0. Most users will only specify tau since the estimated location parameter corresponds to the tauth regression quantile, which is easier to understand. See below for details.  
数字向量0 < tau < 1和kappa >0。大多数用户将只能指定tau以来的估计位置参数对应的tau日回归位数,这是比较容易理解。有关详细信息,请参见下文。


参数:llocation, lscale, lkappa
Character. Parameter link functions for location parameter xi, scale parameter sigma, asymmetry parameter kappa. See Links for more choices. For example, the argument llocation can help handle count data by restricting the quantiles to be positive (use llocation = "loge"). However, llocation is best left alone since the theory only works properly with the identity link.  
字符。参数的链接功能,位置参数xi,尺度参数sigma,不对称参数kappa。见Links更多的选择。例如,参数llocation可以帮助处理计数资料的限制位数是积极的(使用llocation = "loge")。然而,llocation最好是单独留在家中,因为该理论只适用正确的身份链接。


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


参数:ilocation, iscale, ikappa
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, intparloc
Logical. Should the quantiles be parallel on the transformed scale (argument llocation)? Assigning this argument to TRUE circumvents the seriously embarrassing quantile crossing problem. The argument intparloc applies to intercept term; the argument parallelLocation applies to other terms.  
逻辑。位数是并行的转换规模(参数llocation)?分配这种说法TRUE避开严重的尴尬位数的交叉问题。的参数intparloc适用于截距项参数parallelLocation适用于其他条款。


参数:sameScale
Logical. Should the scale parameters be equal? It is advised to keep sameScale = TRUE unchanged because it does not make sense to have different values for each tau value.  
逻辑。秤的参数应该是平等的吗?建议保持sameScale = TRUE不变,因为它没有任何意义有不同的值,每一个tau这个值。


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


参数:dfmu.init
Degrees of freedom for the cubic smoothing spline fit applied to get an initial estimate of the location parameter. See vsmooth.spline. Used only when imethod = 3.  
自由的三次样条拟合度的位置参数,得到一个初步的估计。见vsmooth.spline。只有当imethod = 3。


参数:shrinkage.init
How much shrinkage is used when initializing xi. The value must be between 0 and 1 inclusive, and a value of 0 means the individual response values are used, and a value of 1 means the median or mean is used. This argument is used only when imethod = 4. See CommonVGAMffArguments for more information.  
多少收缩是使用初始化xi时。值必须介于0和1之间,0值是指个人的响应值,和值1中位数或平均数的。只有当该参数用于imethod = 4。见CommonVGAMffArguments更多信息。


参数:Scale.arg
The value of the scale parameter sigma. This argument may be used to compute quantiles at different tau values from an existing fitted alaplace2() model (practical only if it has a single value). If the model has parallelLocation = TRUE then only the intercept need be estimated; use an offset. See below for an example.   
的价值尺度参数sigma。此参数可用于在不同的tau值计算位数现有的装alaplace2()模型(实际仅当它有一个单一的值)。如果模型有parallelLocation = TRUE然后截取需要的估计,使用偏移量。请参阅下面的例子。


参数:digt
Passed into Round as the digits argument for the tau values; used cosmetically for labelling.  
传递到Rounddigits参数tau的值;用于美容标签。


参数:zero
See CommonVGAMffArguments for more information. Where possible, the default is to model all the sigma and kappa as an intercept-only term.  
见CommonVGAMffArguments更多信息。在可能的情况下,默认的是:将所有的sigma和kappa任期仅截距。


Details

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

These VGAM family functions implement one variant of asymmetric Laplace distributions (ALDs) suitable for quantile regression. Kotz et al. (2001) call it the ALD. Its density function is
这些VGAM家庭功能实现非对称Laplace分布(ALDS)适合位数回归的一种变体。科兹等。 (2001年)的ALD。它的密度函数是

for y <=  xi, and
y <=  xi,

for y > xi. Here, the ranges are for all real y and xi, positive sigma and positive kappa. The special case kappa = 1 corresponds to the (symmetric) Laplace distribution of Kotz et al. (2001). The mean is xi +      sigma * (1/kappa - kappa) / sqrt(2) and the variance is sigma^2 * (1 +      kappa^4) / (2 * kappa^2). The enumeration of the linear/additive predictors used for alaplace2() is the first location parameter followed by the first scale parameter, then the second location parameter followed by the second scale parameter, etc. For alaplace3(), only a vector response is handled and the last (third) linear/additive predictor is for the asymmetry parameter.
y > xi。在这里,范围是所有真正的y和xi,积极sigma和积极的kappa。的特殊情况下kappa = 1对应于(对称)的拉普拉斯分布科兹等。 (2001)。平均xi +      sigma * (1/kappa - kappa) / sqrt(2)和方差sigma^2 * (1 +      kappa^4) / (2 * kappa^2)。枚举的线性/添加剂预测因子用于alaplace2()是随后的第一尺度参数,那么第二个位置参数,然后由所述第二标度参数,等对于alaplace3(),只有第一位置参数向量响应的处理和最后一次(第三)线性/添加剂的预测是不对称参数。

It is known that the maximum likelihood estimate of the location parameter xi corresponds to the regression quantile estimate of the classical quantile regression approach of Koenker and Bassett (1978). An important property of the ALD is that P(Y <=   xi) = tau where  tau = kappa^2 / (1 + kappa^2) so that kappa = sqrt(tau / (1-tau)). Thus alaplace1() might be used as an alternative to rq in the quantreg package.
据了解,最大似然估计的位置参数xi对应的回归分位数估计Koenker和巴塞特(1978)的经典位数回归方法。 ALD的一个重要属性是P(Y <=   xi) = tau其中tau = kappa^2 / (1 + kappa^2),使kappa = sqrt(tau / (1-tau))。因此alaplace1()可能被用来作为一种替代rq quantreg包。

Both alaplace1() and alaplace2() can handle multiple responses, and the number of linear/additive predictors is dictated by the length of tau or kappa.  The function alaplace2() can also handle a matrix response with a single-valued tau or kappa.
两个alaplace1()和alaplace2()可以处理多个响应,取决于和线性/添加剂的预测数的长度tau或kappa。函数alaplace2()也可以处理一个单值tau或kappa矩阵响应。


值----------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, e.g., the sample proportion of values which are less than the fitted quantile curves.
在extra插槽拟合的对象,这是有用的,例如,样本比例小于拟合位数曲线的值,这些值的一些列表组件。


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

The MLE regularity conditions do not hold for this distribution so that misleading inferences may result, e.g., in the summary and vcov of the object.
的MLE的规律性条件不持有误导性的推论,使这种分布可能会导致,例如,在summary和vcov的对象。

Care is needed with tau values which are too small, e.g., for count data with llocation = "loge" and if the sample proportion of zeros is greater than tau.
需要注意tau值过小,例如,用于计数数据的llocation = "loge"和零的样本比例大于tau。


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

These VGAM family functions use Fisher scoring. Convergence may be slow and half-stepping is usual (although one can use trace = TRUE to see which is the best model and then use maxit to choose that model) due to the regularity conditions not holding.
这些VGAM家庭功能使用Fisher评分。收敛速度可能很慢半步通常(但可以使用trace = TRUE看,这是最好的模型,然后使用maxit选择模型)因未持有的规律性条件。

For large data sets it is a very good idea to keep the length of tau/kappa low to avoid large memory requirements. Then for parallelLoc = FALSE one can repeatedly fit a model with alaplace1() with one tau at a time; and for parallelLoc = TRUE one can refit a model with alaplace1() with one tau at a time but using offsets and an intercept-only model.
对于大型数据集,它是一个非常好的主意,保持长度tau/kappa低,以避免大内存需求。那么对于parallelLoc = FALSE可以反复拟合模型alaplace1()1tau一次和parallelLoc = TRUE一个可以改装的模型alaplace1() tau的时间,但使用的偏移量和仅截距模型。

A second method for solving the noncrossing quantile problem is illustrated below in Example 3. This is called the accumulative quantile method (AQM) and details are in Yee (2012). It does not make the strong parallelism assumption.
解决noncrossing位数的问题的第二种方法是在实施例3中示出如下。这就是所谓的累计分位数法(AQM)和细节中怡康(2012年)。它没有强大的并行性假设。

The functions alaplace2() and laplace differ slightly in terms of the parameterizations.
的功能alaplace2()和laplace略有不同的参数化。


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


Thomas W. Yee



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

Regression quantiles. Econometrica, 46, 33&ndash;50.
The Laplace distribution and generalizations: a revisit with applications to communications, economics, engineering, and finance, Boston: Birkhauser.
Quantile regression for counts and proportions. In preparation.

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

ralap, laplace, lms.bcn, amlnormal, koenker.
ralap,laplace,lms.bcn,amlnormal,koenker。


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


# Example 1: quantile regression with smoothing splines[例1:平滑样条曲线的分位数回归]
adata = data.frame(x = sort(runif(n <- 500)))
mymu = function(x) exp(-2 + 6*sin(2*x-0.2) / (x+0.5)^2)
adata = transform(adata, y = rpois(n, lambda = mymu(x)))
mytau = c(0.25, 0.75); mydof = 4

fit = vgam(y ~ s(x, df = mydof),
           alaplace1(tau = mytau, llocation = "loge",
                     parallelLoc = FALSE),
           adata, trace = TRUE)
fitp = vgam(y ~ s(x, df = mydof),
            alaplace1(tau = mytau, llocation = "loge", parallelLoc = TRUE),
            adata, trace = TRUE)

## Not run:  par(las = 1); mylwd = 1.5[#不运行:PAR(LAS = 1); mylwd = 1.5]
with(adata, plot(x, jitter(y, factor = 0.5), col = "red",
                 main = "Example 1; green: parallelLoc = TRUE",
                 ylab = "y", pch = "o", cex = 0.75))
with(adata, matlines(x, fitted(fit ), col = "blue",
                     lty = "solid", lwd = mylwd))
with(adata, matlines(x, fitted(fitp), col = "green",
                     lty = "solid", lwd = mylwd))
finexgrid = seq(0, 1, len = 1001)
for(ii in 1:length(mytau))
    lines(finexgrid, qpois(p = mytau[ii], lambda = mymu(finexgrid)),
          col = "blue", lwd = mylwd)
## End(Not run)[#(不执行)]
fit@extra  # Contains useful information[包含有用的信息]


# Example 2: regression quantile at a new tau value from an existing fit[实施例2:在一个新的tau蛋白值从现有的适合的回归分位数]
# Nb. regression splines are used here since it is easier.[铌。这里,因为它更容易使用回归样条。]
fitp2 = vglm(y ~ bs(x, df = mydof),
             family = alaplace1(tau = mytau, llocation = "loge",
                                parallelLoc = TRUE),
             adata, trace = TRUE)

newtau = 0.5  # Want to refit the model with this tau value[想改装的模型,这头值]
fitp3 = vglm(y ~ 1 + offset(predict(fitp2)[,1]),
            family = alaplace1(tau = newtau, llocation = "loge"),
             adata)
## Not run:  with(adata, plot(x, jitter(y, factor = 0.5), col = "red",[#不运行:用(威刚,图(X,Y,抖动(系数= 0.5),彩色=“红色”,]
                  pch = "o", cex = 0.75, ylab = "y",
                  main = "Example 2; parallelLoc = TRUE"))
with(adata, matlines(x, fitted(fitp2), col = "blue",
                     lty = 1, lwd = mylwd))
with(adata, matlines(x, fitted(fitp3), col = "black",
                     lty = 1, lwd = mylwd))
## End(Not run)[#(不执行)]



# Example 3: noncrossing regression quantiles using a trick: obtain[例3:用一招noncrossing回归位数:获得]
# successive solutions which are added to previous solutions; use a log[连续的解决方案,以前的解决方案;使用log]
# link to ensure an increasing quantiles at any value of x.[链接,以确保在任何x值的增加位数。]

mytau = seq(0.2, 0.9, by = 0.1)
answer = matrix(0, nrow(adata), length(mytau)) # Stores the quantiles[存储位数]
adata = transform(adata, offsety = y*0)
usetau = mytau
for(ii in 1:length(mytau)) {
#   cat("\n\nii  = ", ii, "\n")[猫(“\ n \ NII =”,二,“\ n”)]
    adata = transform(adata, usey = y-offsety)
    iloc = ifelse(ii == 1, with(adata, median(y)), 1.0) # Well-chosen![精心选择!]
    mydf = ifelse(ii == 1, 5, 3)  # Maybe less smoothing will help[,少平滑也许会帮助]
    lloc = ifelse(ii == 1, "identity", "loge")  # 2nd value must be "loge"[第二个值必须是“包厢”]
    fit3 = vglm(usey ~ ns(x, df = mydf), data = adata, trace = TRUE,
                alaplace1(tau = usetau[ii], lloc = lloc, iloc = iloc))
    answer[,ii] = (if(ii == 1) 0 else answer[,ii-1]) + fitted(fit3)
    adata = transform(adata, offsety = answer[,ii])
}

# Plot the results.[绘制的结果。]
## Not run:  with(adata, plot(x, y, col = "blue",[#不运行:与(威刚,图(X,Y,列=“蓝”,]
     main = paste("Noncrossing and nonparallel; tau  = ",
                paste(mytau, collapse = ", "))))
with(adata, matlines(x, answer, col = "orange", lty = 1))

# Zoom in near the origin.[在原点附近的放大。]
with(adata, plot(x, y, col = "blue", xlim = c(0, 0.2), ylim = 0:1,
     main = paste("Noncrossing and nonparallel; tau  = ",
                paste(mytau, collapse = ", "))))
with(adata, matlines(x, answer, col = "orange", lty = 1))
## End(Not run)[#(不执行)]

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-26 21:43 , Processed in 0.031632 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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