Logistic regression (with R).pdf

Logistic regression (with R).pdf

ID:33925637

大小:125.10 KB

页数:15页

时间:2019-02-28

Logistic regression (with R).pdf_第1页
Logistic regression (with R).pdf_第2页
Logistic regression (with R).pdf_第3页
Logistic regression (with R).pdf_第4页
Logistic regression (with R).pdf_第5页
资源描述:

《Logistic regression (with R).pdf》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库

1、Logisticregression(withR)ChristopherManning4November20071TheoryWecantransformtheoutputofalinearregressiontobesuitableforprobabilitiesbyusingalogitlinkfunctiononthelhsasfollows:plogitp=logo=log=β0+β1x1+β2x2+···+βkxk(1)1−pTheoddscanvaryonascaleof(0,∞),s

2、othelogoddscanvaryonthescaleof(−∞,∞)–preciselywhatwegetfromtherhsofthelinearmodel.Forareal-valuedexplanatoryvariablexi,theintuitionhereisthataunitadditivechangeinthevalueofthevariableshouldchangetheoddsbyaconstantmultiplicativeamount.Exponentiating,th

3、isisequivalentto:1elogitp=eβ0+β1x1+β2x2+···+βkxk(2)o=p=eβ0eβ1x1eβ2x2···eβkxk(3)1−pTheinverseofthelogitfunctionisthelogisticfunction.Iflogit(π)=z,thenezπ=1+ezThelogisticfunctionwillmapanyvalueoftherighthandside(z)toaproportionvaluebetween0and1,asshowni

4、nfigure1.Noteacommoncasewithcategoricaldata:Ifourexplanatoryvariablesxiareallbinary,thenfortheonesthatarefalse(0),wegete0=1andthetermdisappears.Similarly,ifx=1,eβixi=eβi.Soweareileftwithtermsforonlythexithataretrue(1).Forinstance,ifx3,x4,x7=1only,wehav

5、e:logitp=β0+β3+β4+β7(4)o=eβ0eβ3eβ4eβ7(5)TheintuitionhereisthatifIknowthatacertainfactistrueofadatapoint,thenthatwillproduceaconstantchangeintheoddsoftheoutcome(“Ifhe’sEuropean,thatdoublestheoddsthathesmokes”).LetL=L(D;B)bethelikelihoodofthedataDgivent

6、hemodel,whereB={β0,...,βk}aretheparametersofthemodel.Theparametersareestimatedbytheprincipleofmaximumlikelihood.Technicalpoint:thereisnoerrorterminalogisticregression,unlikeinlinearregressions.1Notethatwecanconvertfreelybetweenaprobabilitypandoddsofor

7、aneventversusitscomplement:poo=p=1−po+11Logisticfunction0.00.20.40.60.81.0-6-4-20246Figure1:Thelogisticfunction2BasicRlogisticregressionmodelsWewillillustratewiththeCedegrendatasetonthewebsite.cedegren<-read.table("cedegren.txt",header=T)Youneedtocrea

8、teatwo-columnmatrixofsuccess/failurecountsforyourresponsevariable.Youcannotjustusepercentages.(Youcangivepercentagesbutthenweightthembyacountofsuccess+failures.)attach(cedegren)ced.del<-cbind(sDel,sNoDel)Makethelogisticregressionmodel.Theshort

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。