µÚ9½² ¶þÔª½á¹ûÄ£ÐÍ ÏÂÔØ±¾ÎÄ

ÄÚÈÝ·¢²¼¸üÐÂʱ¼ä : 2026/2/7 4:17:10ÐÇÆÚÒ» ÏÂÃæÊÇÎÄÕµÄÈ«²¿ÄÚÈÝÇëÈÏÕæÔĶÁ¡£

education(ÊܽÌÓýÄêÏÞ)¡£¿¼ÂÇÒÔÏÂÄ£ÐÍ£º

worki=¦Â0+¦Â1agei+¦Â2marriedi+¦Â3childreni+¦Â4educationi+¦Åi ×÷Ϊ¶ÔÕÕ£¬Ê×ÏÈʹÓÃOLS½øÐÐÏßÐÔ¸ÅÂÊÄ£ÐÍ£¨LPM£©¹À¼Æ£º use womenwk1,clear (Ô­Êý¾ÝÊÇwomenwk.dta) reg work age married children education probit work age married children education,nolog

mfx (¼ÆËãprobitÄ£ÐÍÔÚÑù±¾¾ùÖµ´¦µÄ±ß¼ÊЧӦ£¬ÓëOLS¹À¼ÆµÄ»Ø¹éϵÊý½øÐбȽÏ)

estat classification (¼ÆËãÔ¤²â׼ȷµÄ°Ù·Ö±È) logit work age married children education,nolog mfx

estat classification

hetprob work age married children education,het(age married children education)nolog (pֵΪ0.78£¬ËùÒÔ½ÓÊÜ¡°Í¬·½²î¡±µÄÔ­¼ÙÉè¡£)

generate age2=age*age generateagemari=age*married generateagechr=age*children

quietlylogit work age married children education age2 agemariagechr test age2 agemariagechr (½ÓÊÜÁã¼ÙÉè)

quietlylogit work age married children education estimates store blogit

quietlyprobit work age married children education estimates store bprobit

quietlyregress work age married children education estimates store bols

quietlylogit work age married children education,vce(robust) estimates store blogitr

quietlyprobit work age married children education,vce(robust)

5

estimates store bprobitr

quietlyregress work age married children education,vce(robust) estimates store bolsr

estimatestable blogitblogitrbprobitbprobitrbolsbolsr, t b(%7.3f) stfmt(%8.2f)

Àý×Ó£ºº½Ìì·É»úÊý¾Ý

use shuttle,clear(ÃÀ¹úº½Ìì·É»ú25´Î·ÉÐÐÊý¾Ý£¬°üÀ¨1986ÄêÌôÕ½ÕߺÅ×îºóÒ»´ÎÉý¿Õʧ°ÜµÄ·ÉÐÐ) describe

(distress:ÖúÍÆ½áµãÒ»´¦»ò¶à´¦ÊÜËð£»temp:ÖúÍÆ½áµãµÄζȣ»date:´Ó1960.1.1ÆðµÄÏûÊÅÌìÊý)

generate date=mdy(month,day,year) tabulate distress tabulatedistress,nolabel generate any=distress

replace any=1 if distress==2 (½¨Á¢ÐéÄâ±äÁ¿any£¬0´ú±íÎÞË𻵣¬1´ú±íÓÐ1´¦»ò¸ü¶àËð»µ)

logistic any date (logisticÌṩÓÅÊÆ±È£¬e^b¡£ËüµÄÒâÒåÊÇ£¬×Ô±äÁ¿Ã¿Ôö¼ÓÒ»¸öµ¥Î»Ê±£¬Ê¼þ£¨y=1£©µÄ·¢Éú±ÈµÄ±ä»¯±¶Êý£¨ÈçÓÐÆäËû×Ô±äÁ¿£¬ÔòÒÔÆäËû×Ô±äÁ¿±£³Ö²»±äΪÌõ¼þ£©)

predict phat (È¡µÃÔ¤²â¸ÅÂÊ)

label variable phat ¡°Predicted P(distress>=1)¡± graphtwoway connected phat date

estat classification£¨Ä¬ÈÏÓ¦ÓÃ0.5µÄ¸ÅÂÊ×÷Ϊ·Ö¸îµã£©¡£¼¸ÖÖ·ûºÅµÄº¬Ò壺 D£ºÒ»¸ö¹Û²âÖÐËù¹Ø×¢µÄʼþȷʵ·¢Éú£¨y=1£©¡£ÔÚ±¾ÀýÖУ¬D±íʾ½áµãËð

6

»µ·¢ÉúÁË

~D£ºÒ»¸ö¹Û²âÖÐËù¹Ø×¢µÄʼþûÓз¢Éú£¨y=0£©¡£ÔÚ±¾ÀýÖУ¬~D±íʾ½áµãËð»µÃ»·¢Éú

+£ºÄ£ÐÍÔ¤²â¸ÅÂÊÖµ´óÓÚµÈÓÚ·Ö¸îµã¡£±¾ÀýÖУ¬+±íʾģÐÍÔ¤²âµÄʹʷ¢Éú¸ÅÂÊΪ0.5»ò¸ü¸ß

-£ºÄ£ÐÍÔ¤²â¸ÅÂÊֵСÓÚ·Ö¸îµã¡£ Pr(D|+)=12/16=75% (׼ȷԤ²â) Pr( -D|+)=4/16=25%

Pr(~D| -)=5/7=71.43%(׼ȷԤ²â) Pr( D| -) =2/7= 28.57%

logistic any date temp(¼ÓÈëÖúÍÆ½áµãζÈtemp)

¸ù¾ÝÄâºÏÄ£ÐÍ£¬½áµãζÈÿ1¶ÈÔöÁ¿½«Ê¹ÖúÍÆ½áµãË𻵷¢Éú±È³ËÒÔ0.84£¬Ò²¾ÍÊÇ˵ζÈÿÌá¸ß1¶È¼õÉÙË𻵷¢Éú±È16%¡£¿¨·½¼ìÑé¸üÓÐÈ·¶¨ÐÔ¡£ estat classification£¨·ÖÀàÕýÈ·ÂÊÌá¸ßµ½78.26%£©

Èý¡¢Ìõ¼þЧӦ±ê»æÍ¼£¨Ìõ¼þЧӦ±ê»æÍ¼ÓÐÖúÓÚÀí½âlogisticÄ£ÐÍÔÚ¸ÅÂÊ·½ÃæÒâζ×Åʲô£©

quietly logit any date temp

generate L1=_b[_cons]+_b[date]*8569+_b[temp]*temp generate phat1=1/(1+exp(-L1))

(dateµÄµÚ25°Ù·ÖλÊýΪ8569£»L1ÊÇÔ¤²âµÄlogitÖµ£»phat1ΪÏàÓ¦µÄdistress>=1µÄÔ¤²â¸ÅÂÊ)

label variable phat1 ¡°P(distress>=1) | date=8569¡±

generate L2=_b[_cons]+_b[date]*9341+_b[temp]*temp generate phat2=1/(1+exp(-L2)) (dateµÄµÚ75°Ù·ÖλÊýΪ9341)

label variable phat2 ¡°P(distress>=1) | date=9341¡±

7

graph twowaymspline phat1 temp,bands(50) || mspline phat2 temp,bands(50) ||,ytitle(¡°Probability of thermal distress¡±) legend(label(1 ¡°June 1983¡±) label(2 ¡°July 1985¡±))

(ÌôÕ½Õ᧏排ð·ÉζÈΪ31,Õ⽫ʹËüλÓÚͼµÄ×ó²à¶¥²¿¡£Õâ¸ö·ÖÎöÔ¤²â³öÖúÍÆ½áµã¼¸ºõÊǿ϶¨ÒªË𻵵Ä)

ËÄ¡¢Õï¶Ïͳ¼ÆÓë±ê»æÍ¼(²»½²) quietly logistic any date temp predict phat3

label variable phat3 ¡°Predicted probability¡± predict dx2,dx2

label variable dx2 ¡°Change in Pearson chi-squared¡± predictdb,dbeta

label variable db ¡°Influence¡± predictdd,ddeviance

label variable dd ¡°Change in deviance¡±

graphtwoway scatter dx2 phat3,mlabel(flight)

(Ƥ¶ûÉ­¿¨·½±ä»¯¶ÔË𻵸ÅÂÊͼÐΣ¬Í¼ÖÐ͹ÏÔÁ½¸öÄâºÏºÜ²îµÄÔ¤²â¸ÅÂÊ) graphtwoway scatter dx2 phat3 [aweight=db],msymbol(oh)

(±ê»æ¼ÇºÅµÄ´óСÓëÆäÓ°Ïì³É±ÈÀý¡£È¨ÖØÍ¼½Òʾ³ö£ºÁ½¸öÄâºÏ×î²îµÄ¹Û²âͬʱ¾ÍÊÇ×îÓÐÓ°ÏìµÄ)

list flight any date temp dx2 phat3 if dx2>5

×ܽ᣺ÄâºÏ²î¶øÓÖÓÐÓ°ÏìµÄ¹Û²â×îÖµµÃÌØ±ð¹Ø×¢£¬ÒòΪËüÃǼÈÓëÊý¾ÝµÄÖ÷Ҫģʽì¶Ü¡¢ÓÖ½«Ä£Ð͹À¼ÆÀ­ÏòÓëÆäÏà·´µÄ·½Ïò¡£¸üÉîÇеķ´Ó¦ÊÇÑо¿ÕâÐ©ÌØÒìֵΪʲô²»Í¬Ñ°³££¿Ñ°ÇóÕâÖÖ´ð°¸Ò²Ðí»áµ¼ÖÂÑо¿ÈËÔ±·¢ÏÖÒÔǰºöÊӵıäÁ¿»ò°´ÆäËû·½Ê½À´¶¨ÒåÄ£ÐÍ¡£

8

Îå¡¢¶ÔÐò´Î¶à·ÖÀàYµÄlogistic»Ø¹é(²»½²)

logitºÍlogisticÖ»ÄÜÄâºÏº¬ÓÐÁ½¸öÀà±ð{0,1}µÄY±äÁ¿Ä£ÐÍ¡£ologit:Ðò´Îlogistic»Ø¹é£¬ÆäÖÐyÊÇÐò´Î±äÁ¿¡£½Ï´óµÄÊýÖµ´ú±í¡°½Ï¸ß¡±µÄÀà±ð¡£±ÈÈ磬{1=¡°²î¡±£¬2£½¡°ÖС±£¬3£½¡°ºÃ¡±}

use shuttle,clear(ÃÀ¹úº½Ìì·É»ú25´Î·ÉÐÐÊý¾Ý) ologit distress date temp predict none onetwothreeplus

list flight none onetwothreeplus if flight==25

9