考试作业

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

统计计算作业二课下作业问题14.2EpidemiologistsareinterestedinstudyingthesexualbehaviorofindividualsatriskforHIVinfection.Suppose1500gaymenweresurveyedandeachwasaskedhowmanyriskysexualencountershehadintheprevious30days.Letindenotethenumberofrespondentsreportingiencounters,fori=1,...,16.Table4.2summarizestheresponses.ThesedataarepoorlyfittedbyaPoissonmodel.Itismorerealistictoassumethattherespondentscomprisethreegroups.First,thereisagroupofpeoplewho,forwhateverreason,reportzeroriskyencountersevenifthisisnottrue.Supposearespondenthasprobabilityofbelongingtothisgroup.Withprobability,arespondentbelongstoasecondgrouprepresentingtypicalbehavior.Suchpeoplerespondtruthfully,andtheirnumbersofriskyencountersareassumedtofollowaPoisson()distribution.Finally,withprobability1,arespondentbelongstoahigh-riskgroup.Suchpeoplerespondtruthfully,andtheirnumbersofriskyencountersareassumedtofollowaPoisson()distribution.Theparametersinthemodelare,,and.AtthetthiterationofEM,weuse),,,()()()()()(ttttttodenotethecurrentparametervalues.Thelikelihoodoftheobserveddataisgivenby160160!)(),,|(iniiinnL,whereexp)1(exp1)(0iiiifori=1,...,16.Theobserveddataare160,,nn.Thecompletedatamaybeconstruedtobe16,0,0,,,,ttznnn,and16,0,,,ppnn,whereikn,,denotesthenumberofrespondentsingroupkreportingiriskyencountersandtzk,andpcorrespondtothezero,typical,andpromiscuousgroups,respectively.Thus,0,0,0,0ptznnnnandipitinnn,,fori=1,...,16.Let.1500160iinNDefine,)()(00z,)(exp)(iiit)(exp)1()(iiip.fori=0,...,16.Thesecorrespondtoprobabilitiesthatrespondentswithiriskyencountersbelongtothevariousgroups.a.ShowthattheEMalgorithmprovidesthefollowingupdates:,)()(00)1(Nzntt,)(160)()1(itiitNtn,)()(160)(160)()1(itiiitiittntin.)()(160)(160)()1(itiiitiitpnpinb.Estimatetheparametersofthemodel,usingtheobserveddata.c.Estimatethestandarderrorsandpairwisecorrelationsofyourparameterestimates,usinganyavailablemethod.解答:(1)),|(),|()()2|()2(0)1|()1(1)()()|()|(),|()()()()()()(ililillikikikkinkinknkinkinknkinkinknktinkznkxfxfxpzxpzpzxpzpxpzpzxpzxzpzxzEzw;)()()(001zzwn;)()()(2iiinetzw;)()1()()(3iiinepzw其中nkz表示不同组,X表示危险性行为。即得证;(2)下证EM算法更新推导过程:计算E步的Q函数:160)(160)(160)(160)()(00131131)()(131)()()!(ln)()!(ln)()1ln()(ln)(ln)()}|(ln()){ln(()}|(ln()){ln(,|(],|)}|(ln(){ln([],|)|,([ln),(initiinitiitiiitiitikNikknkikNikktnkztikNikknkztztiiiepietpntnznxpzwxpxzExxpzExzxpEQ(3)计算M步的Q函数求极值过程:(i)由于要使Q函数达到最大,同时参数必须满足131kk,运用拉格朗日乘法可得NnnkkzwN1)(1从而有Nzntt)()(00)1(;160)()1()(itiitNtn;(ii)由于要使Q函数达到最大,即对),,,|,(lnzxp求偏导。0)()(),(160160)()()(iitiitiittntinQ从而有160160)()(itiiitiitntin;0)()(),(160160)()()(iitiitiitpnpinQ从而有160160)()(itiiitiipnpin;即得证。算法:(1)初始化混合正态模型参数),,,()0()0()0()0()0(;(2)E步:通过混合正态分布进行随机模拟得到100个样本)...,,,(x21nxxx,计算完全数据对数似然)|,(logzxp关于数据z的期望值,对数似然函数的期望160)(160)(160)(160)()(00)()()!(ln)()!(ln)()1ln()(ln)(ln)(],|)|,([ln),(initiinitiitiiitiittztiiiepietpntnznxzxpEQ(3)M步:最优化期望值),()(tQ,即通过迭代找到),()(tQ的最大值)1(t;问题27.2SimulatingfromthemixturedistributioninEquation(7.6)isstraightforward[seepart(a)ofProblem7.1].However,usingtheMetropolis–Hastingsalgorithmtosimulaterealizationsfromthisdistributionisusefulforexploringtheroleoftheproposaldistribution.a.ImplementaMetropolis–HastingsalgorithmtosimulatefromEquation(7.6)with7.0,using)2^01.0),((txNastheproposaldistribution.Foreachofthreestartingvalues,x(0)=0,7,and15,runthechainfor10,000iterations.Plotthesamplepathoftheoutputfromeachchain.Ifonlyoneofthesamplepathswasavailable,whatwouldyouconcludeaboutthechain?Foreachofthesimulations,createahistogramoftherealizationswiththetruedensitysuperimposedonthehistogram.Basedonyouroutputfromallthreechains,whatcanyousayaboutthebehaviorofthechain?b.Nowchangetheproposaldistributiontoimprovetheconvergencepropertiesofthechain.Usingthenewproposaldistribution,repeatpart(a).算法:(1)从两个正态总体里分别以0.7和0.3的概率产生100个随机模拟样本)...,,,(y21nyyy;(2)选取一个建议分布)1,0()|(.)(Ugt;(3)从建议分布)1,0()|(.)(Ugt中产生一个候选值*;(4)计算M-H比率2221)(2121)(2221*2121*)(**)()(exp)1()(exp)(exp)1()(exp)|()|(),(ititiittyyyyyLyLR;(5)判断抽取)(telseRttt)(*)(*)1(),(,1min;(6)重复迭代以上过程,参数近似收敛估计值;问题37.5Aclinicaltrialwasconductedtodeterminewhetherahormonetreatmentbenefitswomenwhoweretreatedpreviouslyforbreastcancer.Eachsubjectenteredtheclinicaltrialwhenshehadarecurrence.Shewasthentreatedbyirradiationandassignedtoeitherahormonetherapygrouporacontrolgroup.Theobservationofinterestisthetimeuntilasecondrecurrence,whichmaybeassumedtofollowanexponentialdistributionwithparameterτθ(hormonetherapygroup)orθ(controlgroup).Manyofthewomendidnothaveasecondrecurrencebeforetheclinicaltrialwasconcluded,sothattheirrecurrencetimesarecensored.InTable7.2,acensoringtimeMmeansthatawomanwasobservedforMmonthsanddidnothavearecurrenceduringthattimeper

1 / 7
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功