turbo(turboEM)
turbo()所属R语言包:turboEM
Methods for objects of class "turbo"
方法对象类“涡轮增压”
译者:生物统计家园网 机器人LoveR
描述----------Description----------
The turbo class represents results from parameter estimation in fixed-point mapping problems. The turboem function outputs objects of class turbo.
turbo类表示的固定点映射问题的参数估计结果。 turboem函数输出对象的类turbo。
用法----------Usage----------
## S3 method for class 'turbo'
print(x, ...)
## S3 method for class 'turbo'
pars(x, ...)
## S3 method for class 'turbo'
error(x, ...)
## S3 method for class 'turbo'
plot(x, which.methods = seq_along(x$method), method.names = x$method[which.methods], xlim, ylim, ...)
## S3 method for class 'turbo'
grad(x, objfn=x$objfn, which.methods = seq_along(x$method), method.names = x$method[which.methods], ...)
## S3 method for class 'turbo'
hessian(x, objfn=x$objfn, which.methods = seq_along(x$method), method.names = x$method[which.methods], ...)
## S3 method for class 'turbo'
stderror(x, objfn=x$objfn, which.methods = seq_along(x$method), method.names = x$method[which.methods], ...)
参数----------Arguments----------
参数:x
An object of class turbo, typically the output of a call to turboem.
类的一个对象turbo,通常输出的呼叫turboem。
参数:which.methods
A vector identifying for which subset of algorithms results are desired.
需要一个矢量识别算法结果的子集。
参数:method.names
A vector of unique identifiers for the algorithms for which results are being provided.
一个向量的算法,结果被提供的唯一标识符。
参数:xlim
Optional range for the x-axis of the trace plot.
跟踪图的x-轴的可选范围。
参数:ylim
Optional range for the y-axis of the trace plot.
跟踪图的y轴的可选范围。
参数:objfn
Objective function. Usually this is taken to be the appropriate component of a turbo object.
目标函数。这通常被视为是适当的组成部分,一个turbo对象。
参数:...
Additional arguments.
其他参数。
值----------Value----------
参数:<code>print</code>
Shows a brief summary of the results from fitting the acceleration schemes.
装修的加速计划的结果显示一个简短的总结。
参数:<code>pars</code>
Prints the fixed-point values across acceleration schemes at termination of the algorithms.
打印定点值在加速计划终止的算法。
参数:<code>error</code>
Prints any error messages from running the acceleration schemes
打印运行加速计划的任何错误讯息
参数:<code>plot</code>
Shows a trace plot of the objective function value over iterations. This method is only available if the call to turboem had the argumentcontrol.run[["keep.objfval"]]=TRUE
显示迭代的目标函数值超过了一丝图。这种方法只适用如果调用turboem参数control.run[["keep.objfval"]]=TRUE
参数:<code>grad</code>
Calculates the gradient of the objective function evaluated at the fixed-point across acceleration schemes. Uses numerical methods from the package numDeriv.
计算的目标函数的梯度在固定点评价跨加速方案。采用数值方法从包numDeriv。
参数:<code>hessian</code>
Calculates the Hessian of the objective function evaluated at the fixed-point across acceleration schemes. Uses numerical methods from the package numDeriv.
计算定点整个评价加速方案的目标函数的Hessian。采用数值方法从包numDeriv。
参数:<code>stderror</code>
Provides estimates of the standard error of the fixed-point across acceleration schemes.
提供加速方案之间的固定点的标准误差的估计。
参见----------See Also----------
turboem
turboem
实例----------Examples----------
###########################################################################[################################################## ########################]
# Also see the vignette by typing:[也看到了小插曲,请键入:]
# vignette("turboEM")[小插曲(turboEM“)]
#[]
# EM algorithm for Poisson mixture estimation [EM算法的Poisson混合估计]
fixptfn <- function(p,y) {
# The fixed point mapping giving a single E and M step of the EM algorithm[固定点映射给一个单一的E和M步的EM算法]
# []
pnew <- rep(NA,3)
i <- 0length(y)-1)
zi <- p[1]*exp(-p[2])*p[2]^i / (p[1]*exp(-p[2])*p[2]^i + (1 - p[1])*exp(-p[3])*p[3]^i)
pnew[1] <- sum(y*zi)/sum(y)
pnew[2] <- sum(y*i*zi)/sum(y*zi)
pnew[3] <- sum(y*i*(1-zi))/sum(y*(1-zi))
p <- pnew
return(pnew)
}
objfn <- function(p,y) {
# Objective function whose local minimum is a fixed point [的目标函数局部极小值是一个固定点]
# negative log-likelihood of binary poisson mixture[负对数似然的二元Poisson混合]
i <- 0length(y)-1)
loglik <- y*log(p[1]*exp(-p[2])*p[2]^i/exp(lgamma(i+1)) +
(1 - p[1])*exp(-p[3])*p[3]^i/exp(lgamma(i+1)))
return ( -sum(loglik) )
}
# Real data from Hasselblad (JASA 1969)[实时数据哈苏(JASA 1969)]
poissmix.dat <- data.frame(death=0:9, freq=c(162,267,271,185,111,61,27,8,3,1))
y <- poissmix.dat$freq
# Use a preset seed so the example is reproducable. [使用预设的种子,这样的例子是重复性的。]
require("setRNG")
old.seed <- setRNG(list(kind="Mersenne-Twister", normal.kind="Inversion",
seed=1))
p0 <- c(runif(1),runif(2,0,4)) # random starting value[随机初始值]
# Basic EM algorithm, SQUAREM, and parabolic EM, with default settings[基本EM算法SQUAREM,和抛物线EM,使用默认设置]
res1 <- turboem(par=p0, y=y, fixptfn=fixptfn, objfn=objfn, method=c("EM", "squarem", "pem"))
# Apply methods for class "turbo"[应用方法类“涡轮”]
res1
pars(res1)
grad(res1)
hessian(res1)
stderror(res1)
error(res1)
# We get an error for Dynamic ECME (decme) if we do not specify the boundary function[我们得到一个错误为动态ECME(decme)的,如果我们不指定边界函数]
res2 <- turboem(par=p0, y=y, fixptfn=fixptfn, objfn=objfn, method=c("EM", "squarem", "pem", "decme"))
res2
error(res2)
# we can't plot the results, because we did not store the objective function value at each iteration[我们不能得出结果,因为我们没有存储在每一次迭代的目标函数值]
# Changing the options to store the objective function values, we can:[更改选项来存储的目标函数值,我们可以:]
res1keep <- turboem(par=p0, y=y, fixptfn=fixptfn, objfn=objfn, method=c("EM", "squarem", "pem"), control.run=list(keep.objfval=TRUE))
plot(res1keep, xlim=c(0.001, 0.02))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|