normgibbs(smfsb)
normgibbs()所属R语言包:smfsb
A simple Gibbs sampler for Bayesian inference for the mean and precision of a normal random sample
一个简单的Gibbs抽样的贝叶斯推断为一个正常的随机样本的均值和精度
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This function runs a simple Gibbs sampler for the Bayesian posterior distribution of the mean and precision given a normal random sample.
这个函数运行一个简单的Gibbs抽样的贝叶斯后验分布的一个正常的随机抽样的平均值和精度。
用法----------Usage----------
normgibbs(N, n, a, b, cc, d, xbar, ssquared)
参数----------Arguments----------
参数:N
The number of iterations of the Gibbs sampler.
Gibbs采样的数目的迭代。
参数:n
The sample size of the normal random sample.
正常随机抽样的样本规模。
参数:a
The shape parameter of the gamma prior on the sample precision.
的形状参数的γ之前在样品上的精度。
参数:b
The scale parameter of the gamma prior on the sample precision.
尺度参数的伽玛前的采样精度。
参数:cc
The mean of the normal prior on the sample mean.
正常之前,对样品的平均值是什么意思。
参数:d
The precision of the normal prior on the sample mean.
正常之前,对样品的精确度是什么意思。
参数:xbar
The sample mean of the data. eg. mean(x) for a vector x.
样本均值的数据。例如。 mean(x)的矢量x。
参数:ssquared
The sum of squares of the data. eg. sum(x*x) for a vector x.
的数据的平方的总和。例如。 sum(x*x)的矢量x。
值----------Value----------
An R matrix object containing the samples of the Gibbs sampler.
R矩阵对象,其中包含Gibbs抽样的样本。
参见----------See Also----------
rcfmc, metrop, mcmcSummary
rcfmc,metrop,mcmcSummary
实例----------Examples----------
postmat=normgibbs(N=1100,n=15,a=3,b=11,cc=10,d=1/100,xbar=25,ssquared=20)
postmat=postmat[101:1100,]
op=par(mfrow=c(3,3))
plot(postmat)
plot(postmat,type="l")
plot.new()
plot(ts(postmat[,1]))
plot(ts(postmat[,2]))
plot(ts(sqrt(1/postmat[,2])))
hist(postmat[,1],30)
hist(postmat[,2],30)
hist(sqrt(1/postmat[,2]),30)
par(op)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|