您好,欢迎访问三七文档
统计计算作业二课下作业问题14.2EpidemiologistsareinterestedinstudyingthesexualbehaviorofindividualsatriskforHIVinfection.Suppose1500gaymenweresurveyedandeachwasaskedhowmanyriskysexualencountershehadintheprevious30days.Letindenotethenumberofrespondentsreportingiencounters,fori=1,...,16.Table4.2summarizestheresponses.ThesedataarepoorlyfittedbyaPoissonmodel.Itismorerealistictoassumethattherespondentscomprisethreegroups.First,thereisagroupofpeoplewho,forwhateverreason,reportzeroriskyencountersevenifthisisnottrue.Supposearespondenthasprobabilityofbelongingtothisgroup.Withprobability,arespondentbelongstoasecondgrouprepresentingtypicalbehavior.Suchpeoplerespondtruthfully,andtheirnumbersofriskyencountersareassumedtofollowaPoisson()distribution.Finally,withprobability1,arespondentbelongstoahigh-riskgroup.Suchpeoplerespondtruthfully,andtheirnumbersofriskyencountersareassumedtofollowaPoisson()distribution.Theparametersinthemodelare,,and.AtthetthiterationofEM,weuse),,,()()()()()(ttttttodenotethecurrentparametervalues.Thelikelihoodoftheobserveddataisgivenby160160!)(),,|(iniiinnL,whereexp)1(exp1)(0iiiifori=1,...,16.Theobserveddataare160,,nn.Thecompletedatamaybeconstruedtobe16,0,0,,,,ttznnn,and16,0,,,ppnn,whereikn,,denotesthenumberofrespondentsingroupkreportingiriskyencountersandtzk,andpcorrespondtothezero,typical,andpromiscuousgroups,respectively.Thus,0,0,0,0ptznnnnandipitinnn,,fori=1,...,16.Let.1500160iinNDefine,)()(00z,)(exp)(iiit)(exp)1()(iiip.fori=0,...,16.Thesecorrespondtoprobabilitiesthatrespondentswithiriskyencountersbelongtothevariousgroups.a.ShowthattheEMalgorithmprovidesthefollowingupdates:,)()(00)1(Nzntt,)(160)()1(itiitNtn,)()(160)(160)()1(itiiitiittntin.)()(160)(160)()1(itiiitiitpnpinb.Estimatetheparametersofthemodel,usingtheobserveddata.c.Estimatethestandarderrorsandpairwisecorrelationsofyourparameterestimates,usinganyavailablemethod.解答:(1)),|(),|()()2|()2(0)1|()1(1)()()|()|(),|()()()()()()(ililillikikikkinkinknkinkinknkinkinknktinkznkxfxfxpzxpzpzxpzpxpzpzxpzxzpzxzEzw;)()()(001zzwn;)()()(2iiinetzw;)()1()()(3iiinepzw其中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函数达到最大,同时参数必须满足131kk,运用拉格朗日乘法可得NnnkkzwN1)(1从而有Nzntt)()(00)1(;160)()1()(itiitNtn;(ii)由于要使Q函数达到最大,即对),,,|,(lnzxp求偏导。0)()(),(160160)()()(iitiitiittntinQ从而有160160)()(itiiitiitntin;0)()(),(160160)()()(iitiitiitpnpinQ从而有160160)()(itiiitiipnpin;即得证。算法:(1)初始化混合正态模型参数),,,()0()0()0()0()0(;(2)E步:通过混合正态分布进行随机模拟得到100个样本)...,,,(x21nxxx,计算完全数据对数似然)|,(logzxp关于数据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)判断抽取)(telseRttt)(*)(*)1(),(,1min;(6)重复迭代以上过程,参数近似收敛估计值;问题37.5Aclinicaltrialwasconductedtodeterminewhetherahormonetreatmentbenefitswomenwhoweretreatedpreviouslyforbreastcancer.Eachsubjectenteredtheclinicaltrialwhenshehadarecurrence.Shewasthentreatedbyirradiationandassignedtoeitherahormonetherapygrouporacontrolgroup.Theobservationofinterestisthetimeuntilasecondrecurrence,whichmaybeassumedtofollowanexponentialdistributionwithparameterτθ(hormonetherapygroup)orθ(controlgroup).Manyofthewomendidnothaveasecondrecurrencebeforetheclinicaltrialwasconcluded,sothattheirrecurrencetimesarecensored.InTable7.2,acensoringtimeMmeansthatawomanwasobservedforMmonthsanddidnothavearecurrenceduringthattimeper
本文标题:考试作业
链接地址:https://www.777doc.com/doc-5498682 .html