/
EXERCISE14WEIYULI1.SupposefXi,YigarebivariaterandomsampleswithYi=m(Xi) EXERCISE14WEIYULI1.SupposefXi,YigarebivariaterandomsampleswithYi=m(Xi)

EXERCISE14WEIYULI1.SupposefXi,YigarebivariaterandomsampleswithYi=m(Xi) - PDF document

adah
adah . @adah
Follow
343 views
Uploaded On 2021-01-11

EXERCISE14WEIYULI1.SupposefXi,YigarebivariaterandomsampleswithYi=m(Xi) - PPT Presentation

åni1Xi0Xk2Kix136mllxYk0Xk0x136m1llxwhereYkåni1YiKixåni1KixXkåni1XiKixåni1KixandKixKhx0XiSolveWearegoingtosolvethosetwoproblemstogethe ID: 828766

beta 136 2ki iki 136 beta iki 2ki exp function mll

Share:

Link:

Embed:

Download Presentation from below link

Download Pdf The PPT/PDF document "EXERCISE14WEIYULI1.SupposefXi,Yigarebiva..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

1 EXERCISE14WEIYULI1.SupposefXi,Yigarebiva
EXERCISE14WEIYULI1.SupposefXi,YigarebivariaterandomsampleswithYi=m(Xi)+ui,wherem()isanunknownsmoothfunction,anduisatisesE[uijXi]=0,Var(uijXi)=s2(Xi),a.s.(1)Solvethelocallinearestimationofm(x),anditsasymptoticbiasandvariance(mainterms).(2)Solvethelocallinearestimationˆm(1)ll(x)oftherstderivativeofm(x),andprovethatˆm(1)ll(x)=åni=1(Yi�¯Yk)(Xi�¯Xk)Ki,x åni=1(Xi�¯Xk)2Ki,x,ˆmll(x)=¯Yk�(¯Xk�x)ˆm(1)ll(x),where¯Yk=åni=1YiKi,x/åni=1Ki,x,¯Xk=åni=1XiKi,x/åni=1Ki,xandKi,x=Kh(x�Xi).Solve.Wearegoingtosolvethosetwoproblemstogether,sincethenotationˆmll(x)in(2)isexactlywhatwefocusonin(1).WithkernelKandbandwidthh,considertheminimizationproblemminm,bnåi=1(Yi�m�(Xi�x)b)2Ki,x,whereKi,x=Kh(x�Xi)=1 hK(x�Xi h).LetM(x)=m(x)b(x),X=0B@1X1�x......1Xn�x1CA,W=diag(K1,x,,Kn,x)andY=0B@Y1...Yn1CA,thentheminimizationproblemcanberegardedasaleastsquareproblemwithsolutionˆM(x)=(X0WX)�1X0WY:=ˆmll(x)ˆm(1)l

2 l(x),whichconsistsofthelocallineare
l(x),whichconsistsofthelocallinearestimationsofm(x)anditsrstderivative.WecanexplicitlywriteX0WX=åiKi,xåi(Xi�x)Ki,xåi(Xi�x)Ki,xåi(Xi�x)2Ki,x=åiKi,x1¯Xk�x¯Xk�xåi(Xi�x)2Ki,x/åiKi,x. Date:2019/11/25.liweiyu@mail.ustc.edu.cn.1 2WEIYULIFurthernoticingthatåi(Xi�x)2Ki,x=åi(Xi�¯Xk)+(¯Xk�x)2Ki,x=åi(Xi�¯Xk)2Ki,x+2(¯Xk�x)åi(Xi�¯Xk)Ki,x+(¯Xk�x)2nåi=1Ki,x=åi(Xi�¯Xk)2Ki,x+(¯Xk�x)2nåi=1Ki,xsimpliesthematrixasX0WX=åiKi,x 1¯Xk�x¯Xk�xåi(Xi�¯Xk)2Ki,x åiKi,x+(¯Xk�x)2!.Similarly,wehaveX0WY=åiYiKi,xåi(Xi�x)YiKi,x=åiKi,x¯Ykåi(Xi�x)YiKi,x/åiKi,x=åiKi,x ¯Ykåi(Yi�¯Yk)(Xi�¯Xk)Ki,x åiKi,x+¯Yk(¯Xk�x)!.Atrickweuseistoeliminatepartofthesecondrowsthatis(¯Xk�x)-proportionaltotherstrows.Inspecic,multiplyingthenonsingularA=(åiKi,x)�110�(¯Xk�x)1,wehaveAX0WX= 1¯Xk�x0åi(Xi�¯Xk)2Ki,x åiKi,x!,AX0WY= ¯Ykåi(Yi�¯Yk)(Xi&

3 #0;¯Xk)Ki,x åiKi,x!.Consequently,
#0;¯Xk)Ki,x åiKi,x!.Consequently,ˆmll(x)ˆm(1)ll(x)=�AX0WX�1AX0WY= 1¯Xk�x0åi(Xi�¯Xk)2Ki,x åiKi,x!�1 ¯Ykåi(Yi�¯Yk)(Xi�¯Xk)Ki,x åiKi,x!=0@1�(¯Xk�x)åiKi,x åi(Xi�¯Xk)2Ki,x0åiKi,x åi(Xi�¯Xk)2Ki,x1A ¯Ykåi(Yi�¯Yk)(Xi�¯Xk)Ki,x åiKi,x! EXERCISE143=0@¯Yk�(¯Xk�x)åi(Yi�¯Yk)(Xi�¯Xk)Ki,x åi(Xi�¯Xk)2Ki,xåi(Yi�¯Yk)(Xi�¯Xk)Ki,x åi(Xi�¯Xk)2Ki,x1A,whichcompletestheproofin(2).FromthetheoreminPage27ofLec14.pdf,asymptoticbiasandvarianceofˆmll(x)arebias(ˆmll(x))=k21 2h2m00(x),Var(ˆmll(x))=k02s2(x) nhf(x),wheref()isthedensityofX1.2.ConsidertheexponentialgeneralizedlinearmodelYjX=xExp(l(x)),l(x)=eb0+b1x.Usinglocallikelihoodestimation,writeanestimatefunctiondependingonthesam-pleX,Y,estimatepointx,bandwidthhandkernelK.Generateasimulateddataset,useyourfunctiontoestimate,andchoosetheoptimalbandwidthbycross-validation.Solve.Notethatinlocalregression,themodelhastheexpressionYi=m(Xi)+

4 ei,wherem(x)=E(YjX=x)=1 l(x)=e�b0�
ei,wherem(x)=E(YjX=x)=1 l(x)=e�b0�b1x.Ontheotherhand,thelinkfunctionisg(m)=�log(m)inGLMtting.Thelog-likelihoodofbisl(b)=nåi=1log�f(y)=nåi=1log�l(Xi)�l(Xi)Yi.Thelocallog-likelihoodofbaroundxisthenlx,h(b)=nåi=1[log(l(Xi�x))�l(Xi�x)Yi]Kh(x�Xi)=nåi=1hb0+b1(Xi�x)�eb0+b1(Xi�x)YiiKh(x�Xi).Maximizinglx,h(b)yieldsˆb=(ˆb0,ˆb1)0,thuswehaveˆml(x;h,p)=g�1(ˆb0)=e�ˆb0.Foroptimalbandwidth,usecross-validation,thatis,maximizeLCV(h)=nåi=1l(Yi,ˆl�i(Xi)).Fromtheabovetheoreticalanalysis,weprovidethecodesfollowingthematerialLec14.r:##Initializationn200truebetac(2,2)#truebeta_0andbeta_1lambdafunction(x)exp(truebeta[1]+truebeta[2]*x)likfunction(y,beta)beta-exp(beta)*y#likelihoodfunctionwith$\lambda=e^\hat{\beta}$set.seed(0) 4WEIYULI##GenerateadatasetXrunif(n=n,-3,3)Yrexp(n=n,rate=lambda(X))##Setbandwidthandevaluationgridh0.1xseq(-3,3,l=501)##Optimizetheweightedlog-likelihoodexplicitlysuppressWarnings(fitNlmsapply(x,functio

5 n(x){Kdnorm(x=x,mean=X,sd=h)nlm(f=functi
n(x){Kdnorm(x=x,mean=X,sd=h)nlm(f=function(beta){sum(K*(Y*exp(beta[1]+beta[2]*(X-x))-(beta[1]+beta[2]*(X-x))))},p=c(0,0))$estimate[1]}))##ExactLCVhseq(0.1,1,by=.1)suppressWarnings(LCVsapply(h,function(h){sum(sapply(1:n,function(i){Kdnorm(x=X[i],mean=X[-i],sd=h)lik(Y[i],nlm(f=function(beta){sum(K*(Y[-i]*exp(beta[1]+beta[2]*(X[-i]-X[i]))-(beta[1]+beta[2]*(X[-i]-X[i]))))},p=c(0,0))$estimate[1])}))}))plot(h,LCV,type="o")abline(v=h[which.max(LCV)],col=2)##Comparetheoptimalbandwidthwiththenon-optimalonehh[which.max(LCV)]suppressWarnings(fitNlm.optsapply(x,function(x){Kdnorm(x=x,mean=X,sd=h)nlm(f=function(beta){sum(K*(Y*exp(beta[1]+beta[2]*(X-x))-(beta[1]+beta[2]*(X-x))))},p=c(0,0))$estimate[1]})) EXERCISE145 plot(x,1/lambda(x),type="l",lwd=2,log="y")lines(x,exp(-fitNlm),col=2,lwd=2,lty=2)#inverseoflinkfunctionglines(x,exp(-fitNlm.opt),col=3,lwd=2,lty=2)legend("topright",legend=c("true","non-optimalbw","optimalbw"),col=1:3,lwd=c(2,2,2),lty=c(1,2,2)) Wecanobservethatoptimalbandwidthgivesbettertting.

Related Contents


Next Show more