贝叶斯统计大部分课后习题答案.docx
《贝叶斯统计大部分课后习题答案.docx》由会员分享,可在线阅读,更多相关《贝叶斯统计大部分课后习题答案.docx(16页珍藏版)》请在冰豆网上搜索。
![贝叶斯统计大部分课后习题答案.docx](https://file1.bdocx.com/fileroot1/2023-4/17/d4d1bc93-c03e-4b59-addc-604d1e827c0c/d4d1bc93-c03e-4b59-addc-604d1e827c0c1.gif)
贝叶斯统计大部分课后习题答案
贝叶斯统计大部分课后习题答案
习题讲解
一、1,3,5,6,10,11,12,15
1.1记样本为x.
226pxC(0.1)*0.1*0.90.1488,,,,8
226pxC(0.2)*0.2*0.80.2936,,,,8
后验分布:
0.1488*0.7,,,0.10.5418x,,,,0.1488*0.70.2936*0.3,
0.2936*0.3,,,0.20.4582x,,,,0.1488*0.70.2936*0.3,
111233536mxpxdCdd,,,,,,,(|)
(1)*2
(1)112
(1),,,,,,,,,,,,,,,8,,,00015px(|),,,,,36,,,,,x840
(1),01,,,,,,,mx,,
1.6
1.11由题意设x表示等候汽车的时间,则其服从均匀分布U(0,),
1,,,0,,x,,px(),,
0,其它,
Xxxx,(,,)因为抽取3个样本,即,所以样本联合分布为123
1,,,0,,,,xxx,1233,,pX(),
其它0,,
4,192/,4,,,又因为(),,,,0,4,,,
所以,利用样本信息得
1192192,,,,,,,,,,,,,hXpXxxx(,)()()(8,0,,)123347,,,
,,,,192,,,,,mXhXdd()(,)于是7,,88,
的后验分布为
76hX(,)192/68,,,()X,,,,,7,,192mX(),d,,78,
6,68,,8,,,7()X,,,,,
0,8,,,
1.12样本联合分布为:
1pxx,,,,,(),0n,
,,1,,,,,,/,,00(),,,,0,,,,,0
,,,,,,nn11,,,,,,,,,,,,()()()/1/,max,,,xpxxx,,,,,,,0101n
,,n1,因此的后验分布的核为,仍表现为Pareto分布密度函数的核1/,
,,,,nn1,()/,,,,,,,,n11即()x,,,,0,,,,,1
即得证。
1.15
n,,xi,nnnx,,,1i1()样本的似然函数:
pxee,,,,,,,
,,,1,,,(),e,,,,,,,
nnx,,,,1(),,,参数的后验分布()()()xpxe,,,,,,,,,
服从伽马分布Gannx,,,.,,,,
,,0.0002,,,
(2)4,20000.,,,,,,,2,,0.00012,,,
二、1,2,3,5,6,7,8,10,11,12
,t2.2解:
由题意,变量t服从指数分布:
pte(),,,
,tni,pTe(),,样本联合分布,
,,,1,,,~(,),0Gae,,且,E()0.2,,Var()1,,,,,,,,(),
由伽玛分布性质知:
,,0.2,,,0.04,0.2,,,,,,,,,12,,,
t,3.8又已知n=20,
nn
t,,,203.876nt,,,,,,20.04,76.2,所以,,ii,1,1ii
由于伽玛分布是指数分布参数的共轭先验分布,而且后验分布
,,,,,tt(),,,,,nn,,,11,,ii()()()tpTeee,,,,,,,,,,,
即后验分布为GantGa(,)(20.04,76.2),,,,,,i
,n20.04,|TE()0.263,,,,,t76.2,,i
1服从倒伽玛分布,,,IGantIGa(,)(20.04,76.2),,,,,,i
,t,i,,||1TT,()()4.002EE,,,,,1,,n,
11,,2.3可以算出的后验分布为,的后验期望估计的后验方差为.Ga(11,4)16
n,362.5.
,,1,,,,,,/,,00,2.7的先验分布为:
(),,,,0,,,,,0
令,,,max,,,xx,,101n
,,,,nn1,()/,,,,,,,,n11可得后验分布为:
()x,,,,0,,,,,1
(),n,,1,Ex(),则的后验期望估计为:
,,n,,1,
2(),,,n1Varx(),后验方差为:
.,2
(1)
(2)nn,,,,,,
n1,,,xGaIGa~(,),~(,)2.8由可以得出22,
n12()1n,x,1,22,2pxxex,,(),0,n,()2
,,,
(1),,,,(),0,,e,,,,,(),
(1)的后验分布为:
x,2,n,,,,
(1),22,,,,,,,()()()xpxe,,
nxIGa(,),,,,即为倒伽玛分布的核。
22
nxIGa(,),,,,,所以的后验分布为22
x,,x2,,2
(2)后验均值为Ex(),,,nn22,,,1,,,2
x2(),,2后验方差为Varx(),,nn2
(1)
(2),,,,,,22
(3)样本分布函数为:
nnn,1,,n,xnn2i,,1
(2),,2,,,12ipxpxxe()(),,,,ii,,,,n(/2),,,11ii,,,,
所以的后验分布为:
nx,2,i,2ni,1,,,,
(1),22,,,,,,,()()()xpxe,,
n
x,2in,1i即为的核。
(,),,,,IGa22
n1n21(),n,,xni,,,1,2,,,
(1)n,,2,1i2,(xpxxee,,)()()[]*,,,,,,i,n,(),,1i,()2
(dx,,)令,0d,
即:
nnnn1xx,,22,,ii,,222x,2,()nnn,2i,,,11iin,,,,,,,,,121,,n,ni,1222222,,xee,,,,,[][
(1)*]0,,,i2,n,()22,,i,1,()2
n
xn,i,1i,2,x,,,i,,12i可得,,,MD22n,,22n,,,1,2
n
xn,i,1i,2,x,,,i,,12i而由公式得,,,E22n,,22n,,,1,2
因此,倒伽玛分布的这两个估计是不一样的,原因是它不对称。
2.10解:
已知xNN~(,1),~(3,1),,
2N(,),,,设的后验分布为11
可得:
22,,x,,,,0,,122,,,,,0
111,,222,,,10
2,243,,,12x,,3由已知得:
,,,,03n3
333111,,,2,,?
,,,3,1131134,,
所以的95,的可信区间为:
[30.51.96,30.51.96],,,,即为.[2.02,3.98]
222.11已知xNIGa~0,,~,,,,,,,,,
nn1,,22,,可得的后验分布为IGax,,,,,i,,22i,1,,
n12,,x,i2i,1ˆ后验均值为:
,En,,1,2
2n,,12,x,,i,,2,i12,,后验方差为:
Varx,,,,2nn,,,,,,,,12,,,,,,22,,,,变换:
n11n,,2,,~,Gax,,,i,,222,,1,,i
n1,,n,,,,22,,,2~2,,x,i,,,,2,,2,,,,1,,i,,
n,,1,,22令:
Pxn,,,220.9,,,,,,,0.1i,,,,2,,1,,i,,
n22,,x,i2,i1可得的0.9可信上限为.,2n,2,,,,0.1
,,1,,,,,,/,,00,2.12的先验分布为:
(),,,,0,,,,,0
令,,,max,,,xx,,101n
,,,,nn1,()/,,,,,,,,n11可得后验分布为:
()x,,,,0,,,,,1,1,,设的可信上限为,U
U则,,,,xd,,1,,,,1
带入有:
U,,,nn1,,()/1,,,,,,,,nd1,,1
,n,,1,,,,n,,U
1,n1,,,,,,,U1,,,,,
三、10,11,12,13
3.10解:
依题意
1x,,pxxexp,0,,,,,,,,,,,,
0.01,,,20.01exp,0,,,,,,,,,,,,,,
,,0.01x,,,,3则mxpxdd0.01exp,,,,,,,,,,,,,,,,,,,0,,,,
0.01,0x,,2x0.01,,,
该元件在时间之前失效的概率200:
2002000.01pmxdxdx0.99995,,,,,2,,00x0.01,,,
3.11:
解依题意
xi,,,iipxe,,,,iix!
i
,,,1,,i,,,e,0,,,,,,iii,,,,
xi,,,,,,1iii,,,,,,mxpxdeed,,,,,,,,iiiiiii,,,,,,,,0x,!
,,i,,
,,,,x,,ix,i,,,,x1!
,,,,i,,nnn,,,,x,,,i,mxmx,,,,,,,,,,,ix,i,,ii,,11,,,,x1!
,,,,,i,,
3.12解:
超参数和的似然函数为,,
333,,,3,,,,,,,xf35,,,,,,,,,,,,,,,,,,iL,,,,,,其中,,,,338383x,,,,,,i1i,720,,,1!
13!
5!
1x,,,,,,,,,,,,,,,,,,,i,,,,,,
222f,,,,,1234.,,,,,,,,,,,,,,,,
由
L,,,,,,,0,,,,,,L,,,,,,,0,,,,
38,,,,,,,,,1,,ff,3ln,,,,,,,,,,,,,,从而有:
,38,,,ff,3ln,,,,,,,,3,,,,
3,利用软件计算,可得,,,1.033599=0.3875996,,83.13证明:
泊松分布的期望和方差分别为
2,.,,,,,,,,,,,,
,1,,,,,,=,0,e,,,,,,,,,,,,
,,,,,,,,,,,ed,,m,,,,,,0,,,,,
x,22,,,,,,,,,,,EE,,,,,,,,,,,,,221,2,,,,2,,,,,,,,,,,,,,,,,,,,,,,,,EE,,,,,,m,,,,22,,,,,,,,,,,,,,,,,,
2,,,,,,,m2,,,,,利用样本矩代替边际分布的矩,列出如下方程:
,,x,,,,,,2,,,S2,,,,
2,,x,,2,,Sx,,,,x,,2,,Sx,,
四、1,4,8,9,10,11,12,15,16
4.4
15,6,7,8,9,10,5,6,7,8,9,10状态集行动集,,,,,,,,,,2收益函数,,
5,10aa,,,,Qa,,,,,,6,5,,,aa,,,
收益矩阵
aaaaaa123456
252423222120,,1,,,2530292827262,,,
,2530353433323,Q,,,2530354039384,,,,,2530354045445,,,,,253035404550,,6,
3根据定义可知,最优a5行动是,即采摘朵鲜花,,1
4按折中准则:
,,
HQaQa,,,,,,,,max,1min,,,,,,,,,,,,,,,H,25,,,,1,H,,246,,,,,2
H,,2312,,3,,,,H,,2218,,4,,,,H,,2124,,5,,,
H,,2030,,6,,,
1当时,选择,每天摘朵鲜花05,,a1,6
1当时,选择,每天摘朵鲜花,,110a.6,6
4.8
La,1500,,13
购买8件.4.9
a对于行动,其收益函数为1
100,00.1,,,,
Q,,,30,0.10.2,,,,,
,,,50,0.21,,
a对于行动,其收益函数为2
Q,,,,,40,01,,
从而可得在a和a处的损失函数:
12
0,00.1,,,,
La,10,0.10.2,,,,,,,,1
90,0.21,,,,
60,00.1,,,,La,,,,,,20,0.11,,,,
服从Be2,14,,
0.21Lapdpd,,,109018.86,,,,元吨,,,,,,,,1,,0.10.2
0.1Lapd,,6027.06,,元吨,,,,,,2,0
故采用第一种收费方法对工厂有利.
##附R软件计算定积分程序:
int<-function(x){210*x*(1-x)^13};
integrate(int,0.1,0.2)$value*10+integrate(int,0.2,1)$value*90;
[1]18.86049
integrate(int,0,0.1)$value*60;
[1]27.057424.10
182012256,,,,,,,,,0
,6,,QaQaaa当时,,则在和处的损失函数为,,,,,,,1212
La,0,,,,1
La,305,,,,2,,
,6,,QaQaaa当时,,则在和处的损失函数为,,,,1212,,,
La,530,,,,1,,
La,0,,,2,
0,10服从上的均匀分布,,,
101Lad,,,5304,,,,1,610,,
61Lad,,,3059,,,,2,010,,
a.最优行动是1
五、2,3,7,11,18,21,22
5.2
(2)
2x,,,,,12(4)由可得xNpxe,,,~,1,,,,2,
n2x,,,,i,ni1,,1,,2,样本的似然函数为:
pXe,,,,,2,,,
2nx,,,,,n2后验分布xe,,,,,2,2,,ncnx,,,,,,,,,,,,n2,,,,lned,,,,,,clnEex,,,cn1,,则dx,,,,,lnBcncc222,c,,x2n
附:
用R软件作图程序:
y<-function(x){exp(0.1*x)-0.1*x-1};
plot(y,xlim=c(-20,20),type="l",lty=1);
lines(x,exp(0.5*x)-0.5*x-1,xlim=c(-20,20),type="l",lty=2);lines(x,exp(1.2*x)-1.2*x-1,xlim=c(-20,20),type="l",lty=3);leg.names<-c("c=0.1","c=0.5","c=1.2");
legend(locator
(1),leg.names,lty=c(1,2,3));
2x35.3可以求得的贝叶斯估计为,,,,,.xce,,B23ln,c5.7
2,,,,,,12后验分布:
,xe,,,2,
2根据定理在加权平方损失函数下5.2:
L,,,,,,,,,,,,,,,
Ex,,,,,,,,,的贝叶斯估计为:
,,B,,,Ex,,,,,,,,
通过计算可得:
,,,Exxdxd,,,,,12,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,,,,211,,,,,,,,2,,,,e,,2,
5.11
的后验分布为Bexnx,,,,,,,,,
1,,,,,1,,,,,
1,,,n,,,,,,nx2,,,,x1,Exd,,,,1,,,,,,,,,,,,,0,,,,,xnx,,,,,,
1,,,n,,,,,nx2,,x2,,,,Exd,,,,1,,,,,,,,,,,,0,,,,,xnx,,,,,,
Ex,,,,,,x1,,,,,11;,,,,,xnax时,的贝叶斯估计为,,,B,,,,n2Ex,,,,,,,,,,
1xax,,0时,若>1,,,,B,,,n2,,,若0<,1,考虑后验风险
21,,,,,,,na,,,,1,,,n,1,Raxd,,,01,,,,,,,,0,,,,n1,,,,,,,,,,
111,,,n,,,,,,,,nnn222,,122,,,,,,,,,,,,,,,,dadad1211,,,,,,,,,,,,,,,,,,,,000,,,,,n,,,,,,
0<上式中括号内前两项积分都是有限的,而第三个积分是趋于无穷大的,从而,1,,
当时,达到最小值,即aRaxax,,,000;,,,,B
,,n1类似地,时若>xn,,1,ax,,,B,,,,n2,,若0<1,,,ax1.,,,B
5.18
(1)
支付矩阵
aa12
10075,,1W,,,100150,,,2
损失矩阵
aa12
250,,1L,,,050,,,2
,aaaELaELa,,,17.5,,15,,,,,,与下的先验期望损失为,故是最优行动,,,,,12212,,,,先验.EVPI,15元,,
(2)从到上的任一个映射都是该问题的决策函数0,1,2,aax,.,,,,,,12
(3)、(4)
2
xbmxpx~2,,,,,,,边缘概率可得:
,,,,,,,,,ii,i1
mmm00.87475,10.1205,20.00475,,,,后验分布为:
,,,,,,
X012
0.72220.55190.3684,=0.051
0.27780.44810.6316,=0.12
x计算ELa,,,可得表格:
,,,,,,
X012
x18.05513.79759.21ELa,,,,,,1,,
x13.8922.40531.58ELa,,,,,,2,,
从而最优决策函数为:
ax,0,,2,,x,,,,ax,1,2,1,
xx,,,EVPIEELx,13.89*0.8747513.7975*0.12059.21*0.0047513.8566后验,,,,,,,,,,,,,
xx,,,,EVSIEVPIEELx,,,,,先验元,1513.85661.1434,,,,,,,,,,
ENGSEVSIC,,,,,21.14340.20.9434元,,,,
5.21
bb,21
(1),6,,0mm,21
2,,~10,4,10,,NEmma,,最优行动为,,,,122
tmm,,,,,,5,4,10,6,,,120
,,0DLDL,,,,1,10.08332,,,,00NN,
EVPILDt,,,**0.08332*5*41.6664,,0N,
(2)
类似可得
,,,,0,,,3**=0.04270*5*3=0.6405EVPILt,,,,N,,,
,,,,0,,2**=0.008491*5*2=0.08491,EVPILt,,,,N,,,
,,0,,,,1**=0.000007145*5*1=0.000035725,EVPILt,,N,,,,,
EVPI(3)由上先验中有相当一部分是由于先验分布估计得不够精确引起的,随着标准差的,
减小,用来描述状态的先验分布愈精确,增加了先验信息,从而减少了先验完全信息及其
期望值。