pfMLLik(smfsb)
pfMLLik()所属R语言包:smfsb
Create a function for computing the log of an unbiased estimate of marginal likelihood of a time course data set
创建一个函数,用于计算一个时间过程的数据集的边缘似然无偏估计的log
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Create a function for computing the log of an unbiased estimate of marginal likelihood of a time course data set using a simple bootstrap particle filter.
创建一个函数,用于计算的无偏估计的边缘似然设置一个时间过程数据,使用一个简单的引导粒子过滤器的log。
用法----------Usage----------
pfMLLik(n,simx0,t0,stepFun,dataLik,data)
参数----------Arguments----------
参数:n
An integer representing the number of particles to use in the particle filter.
一个整数,表示在颗粒过滤器中使用的粒子的数量。
参数:simx0
A function with interface simx0(n,t0,...), where n is the number of rows of a matrix and t0 is a time at which to simulate from an initial distribution for the state of the particle filter. The return value should be a matrix whose rows are random samples from this distribution. The function therefore represents a prior distribution on the initial state of the Markov process.
函数与接口simx0(n,t0,...),其中n是一个矩阵的行和数量t0是一个时间,来模拟从初始的状态的粒子滤波的分布。返回的值是一个矩阵的行是从这个分布的随机样本。因此,该函数表示对初始状态的马尔可夫过程的先验分布。
参数:t0
The time corresponding to the starting point of the Markov process. Can be no bigger than the smallest observation time.
Markov过程的起点相对应的时间。不能大于最小的观测时间。
参数:stepFun
A function for advancing the state of the Markov process, such as returned by StepGillespie.
推进马尔可夫过程的状态的功能,如返回StepGillespie。
参数:dataLik
A function with interface dataLik(x,t,y,log=TRUE,...), where x and t represent the true state and time of the process, and y is the observed data. The return value should be the (log of the) likelihood of the observation. The function therefore represents the observation model.
功能与接口dataLik(x,t,y,log=TRUE,...),其中x和t代表的真实状态和时间的过程中,y是观测到的数据。返回的值是(log)的观察的可能性。因此,该函数表示的观测模型。
参数:data
A timed data matrix representing the observations, such as produced by simTimes or as.timedData.
一个定时的数据矩阵代表的意见,例如由simTimes或as.timedData。
值----------Value----------
An R function with interface (...) which evaluates to the log of the particle filter's unbiased estimate of the marginal likelihood of the data.
R的功能(...)评估的log颗粒过滤器的无偏估计,边缘的数据的可能性。
参见----------See Also----------
StepGillespie, as.timedData,
StepGillespie,as.timedData,
实例----------Examples----------
noiseSD=5
# first simulate some data[第一个模拟的一些数据]
truth=simTs(c(x1=50,x2=100),0,20,2,stepLVc)
data=truth+rnorm(prod(dim(truth)),0,noiseSD)
data=as.timedData(data)
# measurement error model[测量误差模型]
dataLik <- function(x,t,y,log=TRUE,...)
{
ll=sum(dnorm(y,x,noiseSD,log=TRUE))
if (log)
return(ll)
else
return(exp(ll))
}
# now define a sampler for the prior on the initial state[现在定义一个采样之前的初始状态]
simx0 <- function(N,t0,...)
{
mat=cbind(rpois(N,50),rpois(N,100))
colnames(mat)=c("x1","x2")
mat
}
mLLik=pfMLLik(1000,simx0,0,stepLVc,dataLik,data)
print(mLLik())
print(mLLik(th=c(th1 = 1, th2 = 0.005, th3 = 0.6)))
print(mLLik(th=c(th1 = 1, th2 = 0.005, th3 = 0.5)))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|