mix2poisson(VGAM)
mix2poisson()所属R语言包:VGAM
Mixture of Two Poisson Distributions
混合两个泊松分布
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Estimates the three parameters of a mixture of two Poisson distributions by maximum likelihood estimation.
两个泊松分布的混合物三个参数的估计最大似然估计。
用法----------Usage----------
mix2poisson(lphi = "logit", llambda = "loge",
ephi = list(), el1 = list(), el2 = list(),
iphi = 0.5, il1 = NULL, il2 = NULL,
qmu = c(0.2, 0.8), nsimEIM = 100, zero = 1)
参数----------Arguments----------
参数:lphi, llambda
Link functions for the parameter phi and lambda. See Links for more choices.
链接功能参数phi和lambda。见Links更多的选择。
参数:ephi, el1, el2
List. Extra argument for each of the links. See earg in Links for general information.
列表。每个环节的额外参数。见earg中Links的一般信息。
参数:iphi
Initial value for phi, whose value must lie between 0 and 1.
的phi,其值必须介于0和1的初始值。
参数:il1, il2
Optional initial value for lambda1 and lambda2. These values must be positive. The default is to compute initial values internally using the argument qmu.
可选初始值lambda1和lambda2。这些值必须是积极的。默认值是计算的初始值内部使用参数qmu的。
参数:qmu
Vector with two values giving the probabilities relating to the sample quantiles for obtaining initial values for lambda1 and lambda2. The two values are fed in as the probs argument into quantile.
向量的两个值,给出了有关的样本位数的概率获得的初始值lambda1和lambda2。这两个值被送入作为probs到quantile参数。
参数:nsimEIM, zero
See CommonVGAMffArguments.
见CommonVGAMffArguments。
Details
详细信息----------Details----------
The probability function can be loosely written as
的概率函数可以松散地写为
where phi is the probability an observation belongs to the first group, and y=0,1,2,.... The parameter phi satisfies 0 < phi < 1. The mean of Y is phi*lambda1 + (1-phi)*lambda2 and this is returned as the fitted values. By default, the three linear/additive predictors are (logit(phi), log(lambda1), log(lambda2))^T.
其中phi是观察属于第一组的概率,和y=0,1,2,...。参数phi满足0 < phi < 1。平均Y是phi*lambda1 + (1-phi)*lambda2,这是返回的拟合值。默认情况下,三个线性/添加剂的预测是(logit(phi), log(lambda1), log(lambda2))^T。
值----------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。
警告----------Warning ----------
This VGAM family function requires care for a successful application. In particular, good initial values are required because of the presence of local solutions. Therefore running this function with several different combinations of arguments such as iphi, il1, il2, qmu is highly recommended. Graphical methods such as hist can be used as an aid.
这VGAM家庭功能需要照顾了成功的应用。特别是,良好的初始值是必需的,这是因为存在本地的解决方案。因此,运行此功能与几种不同的组合参数,如iphi,il1,il2,qmu,强烈推荐。 hist图形的方法,如可以用来作为一种辅助手段。
With grouped data (i.e., using the weights argument) one has to use a large value of nsimEIM; see the example below.
使用分组数据(即weights使用参数)nsimEIM,见下面的例子使用一个较大的值。
注意----------Note----------
The response must be integer-valued since dpois is invoked.
必须是整数的值,因为dpois调用的响应。
Fitting this model successfully to data can be difficult due to local solutions and ill-conditioned data. It pays to fit the model several times with different initial values, and check that the best fit looks reasonable. Plotting the results is recommended. This function works better as lambda1 and lambda2 become more different. The default control argument trace = TRUE is to encourage monitoring convergence.
这个模型成功的拟合数据可以是困难的,因为当地的解决方案和病态的数据。它支付的模式,以适应不同的初始值,几次检查最合适看起来合理。建议绘制的结果。此功能更好地为lambda1和lambda2变得更加不同。默认的控制参数trace = TRUE是鼓励开展监督收敛。
(作者)----------Author(s)----------
T. W. Yee
参见----------See Also----------
rpois, poissonff, mix2normal1.
rpois,poissonff,mix2normal1。
实例----------Examples----------
# Example 1: simulated data[实施例1:模拟数据]
nn = 1000
mu1 = exp(2.5) # also known as lambda1[也被称为lambda1]
mu2 = exp(3)
(phi = logit(-0.5, inverse = TRUE))
mdata = data.frame(y = ifelse(runif(nn) < phi, rpois(nn, mu1), rpois(nn, mu2)))
fit = vglm(y ~ 1, mix2poisson, mdata)
coef(fit, matrix = TRUE)
# Compare the results with the truth[比较的结果与事实真相]
round(rbind('Estimated' = Coef(fit), 'Truth' = c(phi, mu1, mu2)), dig = 2)
## Not run: # Plot the results[#不运行:#图的结果]
ty = with(mdata, table(y))
plot(names(ty), ty, type = "h", main = "Orange=estimate, blue=truth",
ylab = "Frequency", xlab = "y")
abline(v = Coef(fit)[-1], lty = 2, col = "orange", lwd = 2)
abline(v = c(mu1, mu2), lty = 2, col = "blue", lwd = 2)
## End(Not run)[#(不执行)]
# Example 2: London Times data (Lange, 1997, p.31)[例2:伦敦“泰晤士报”的数据(兰格,1997年,第31页)]
ltdata1 = data.frame(deaths = 0:9,
freq = c(162, 267, 271, 185, 111, 61, 27, 8, 3, 1))
ltdata2 = data.frame(y = with(ltdata1, rep(deaths, freq)))
# Usually this does not work well unless nsimEIM is large[这通常不能很好地工作,除非nsimEIM是大]
fit = vglm(deaths ~ 1, weight = freq, data = ltdata1,
mix2poisson(iphi = 0.3, il1 = 1, il2 = 2.5, nsimEIM = 5000))
# This works better in general[这工作一般]
fit = vglm(y ~ 1, mix2poisson(iphi = 0.3, il1 = 1, il2 = 2.5), ltdata2)
coef(fit, matrix = TRUE)
Coef(fit)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|