美文网首页大数据 爬虫Python AI Sql玩转大数据大数据部落
用SAS进行泊松模型,零膨胀泊松模型和有限混合Poisson模型

用SAS进行泊松模型,零膨胀泊松模型和有限混合Poisson模型

作者: 拓端tecdat | 来源:发表于2020-04-10 19:24 被阅读0次

原文链接:http://tecdat.cn/?p=6145

泊松模型

procfmmdata=tmp1tech=trureg;modelmajordrg=ageacadmosminordrglogspend/dist=truncpoisson;probmodelageacadmosminordrglogspend;/*FitStatistics-2LogLikelihood8201.0AIC(smallerisbetter)8221.0AICC(smallerisbetter)8221.0BIC(smallerisbetter)8293.5ParameterEstimatesfor'Truncated Poisson'ModelStandardComponentEffectEstimateErrorzValuePr>|z|1Intercept-2.07060.3081-6.72<.00011AGE0.017960.0054823.280.00111ACADMOS0.0008520.0007001.220.22401MINORDRG0.17390.034415.05<.00011LOGSPEND0.12290.042192.910.0036ParameterEstimatesforMixingProbabilitiesStandardEffectEstimateErrorzValuePr>|z|Intercept-4.23090.1808-23.40<.0001AGE0.016940.0033235.10<.0001ACADMOS0.0022400.0004924.55<.0001MINORDRG0.76530.0384219.92<.0001LOGSPEND0.23010.026838.58<.0001*/***HURDLEPOISSONMODELWITHNLMIXEDPROCEDURE***;procnlmixeddata=tmp1tech=truregmaxit=500;parmsB1_intercept=-4B1_age=0B1_acadmos=0B1_minordrg=0B1_logspend=0B2_intercept=-2B2_age=0B2_acadmos=0B2_minordrg=0B2_logspend=0;eta1=B1_intercept+B1_age*age+B1_acadmos*acadmos+B1_minordrg*minordrg+B1_logspend*logspend;exp_eta1=exp(eta1);p0=1/(1+exp_eta1);eta2=B2_intercept+B2_age*age+B2_acadmos*acadmos+B2_minordrg*minordrg+B2_logspend*logspend;exp_eta2=exp(eta2);ifmajordrg=0then_prob_=p0;else_prob_=(1-p0)*exp(-exp_eta2)*(exp_eta2**majordrg)/((1-exp(-exp_eta2))*fact(majordrg));ll=log(_prob_);modelmajordrg~general(ll);run;/*FitStatistics-2LogLikelihood8201.0AIC(smallerisbetter)8221.0AICC(smallerisbetter)8221.0BIC(smallerisbetter)8293.5ParameterEstimatesStandardParameterEstimateErrorDFtValuePr>|t|B1_intercept-4.23090.18081E4-23.40<.0001B1_age0.016940.0033231E45.10<.0001B1_acadmos0.0022400.0004921E44.55<.0001B1_minordrg0.76530.038421E419.92<.0001B1_logspend0.23010.026831E48.58<.0001============B2_intercept-2.07060.30811E4-6.72<.0001B2_age0.017960.0054821E43.280.0011B2_acadmos0.0008520.0007001E41.220.2240B2_minordrg0.17390.034411E45.05<.0001B2_logspend0.12290.042191E42.910.0036*/

need-to-insert-img

零膨胀泊松模型

***ZERO-INFLATEDPOISSONMODELWITHFMMPROCEDURE***;procfmmdata=tmp1tech=trureg;modelmajordrg=ageacadmosminordrglogspend/dist=poisson;probmodelageacadmosminordrglogspend;run;/*FitStatistics-2LogLikelihood8147.9AIC(smallerisbetter)8167.9AICC(smallerisbetter)8167.9BIC(smallerisbetter)8240.5ParameterEstimatesfor'Poisson'ModelStandardComponentEffectEstimateErrorzValuePr>|z|1Intercept-2.27800.3002-7.59<.00011AGE0.019560.0060193.250.00121ACADMOS0.0002490.0006680.370.70931MINORDRG0.11760.027114.34<.00011LOGSPEND0.16440.035314.66<.0001ParameterEstimatesforMixingProbabilitiesStandardEffectEstimateErrorzValuePr>|z|Intercept-1.91110.4170-4.58<.0001AGE-0.000820.008406-0.100.9218ACADMOS0.0029340.0010852.700.0068MINORDRG1.44240.136110.59<.0001LOGSPEND0.095620.050801.880.0598*/***ZERO-INFLATEDPOISSONMODELWITHNLMIXEDPROCEDURE***;procnlmixeddata=tmp1tech=truregmaxit=500;parmsB1_intercept=-2B1_age=0B1_acadmos=0B1_minordrg=0B1_logspend=0B2_intercept=-2B2_age=0B2_acadmos=0B2_minordrg=0B2_logspend=0;eta1=B1_intercept+B1_age*age+B1_acadmos*acadmos+B1_minordrg*minordrg+B1_logspend*logspend;exp_eta1=exp(eta1);p0=1/(1+exp_eta1);eta2=B2_intercept+B2_age*age+B2_acadmos*acadmos+B2_minordrg*minordrg+B2_logspend*logspend;exp_eta2=exp(eta2);ifmajordrg=0then_prob_=p0+(1-p0)*exp(-exp_eta2);else_prob_=(1-p0)*exp(-exp_eta2)*(exp_eta2**majordrg)/fact(majordrg);ll=log(_prob_);modelmajordrg~general(ll);run;/*FitStatistics-2LogLikelihood8147.9AIC(smallerisbetter)8167.9AICC(smallerisbetter)8167.9BIC(smallerisbetter)8240.5ParameterEstimatesStandardParameterEstimateErrorDFtValuePr>|t|B1_intercept-1.91110.41701E4-4.58<.0001B1_age-0.000820.0084061E4-0.100.9219B1_acadmos0.0029340.0010851E42.700.0068B1_minordrg1.44240.13611E410.59<.0001B1_logspend0.095620.050801E41.880.0598============B2_intercept-2.27800.30021E4-7.59<.0001B2_age0.019560.0060191E43.250.0012B2_acadmos0.0002490.0006681E40.370.7093B2_minordrg0.11760.027111E44.34<.0001B2_logspend0.16440.035311E44.66<.0001*/

need-to-insert-img

两类有限混合Poisson模型

***TWO-CLASSFINITEMIXTUREPOISSONMODELWITHFMMPROCEDURE***;procfmmdata=tmp1tech=trureg;modelmajordrg=ageacadmosminordrglogspend/dist=poissonk=2;run;/*FitStatistics-2LogLikelihood8136.8AIC(smallerisbetter)8166.8AICC(smallerisbetter)8166.9BIC(smallerisbetter)8275.7ParameterEstimatesfor'Poisson'ModelStandardComponentEffectEstimateErrorzValuePr>|z|1Intercept-2.44490.3497-6.99<.00011AGE0.022140.0066283.340.00081ACADMOS0.0005290.0007700.690.49201MINORDRG0.050540.040151.260.20811LOGSPEND0.21400.041275.18<.00012Intercept-8.09351.5915-5.09<.00012AGE0.011500.012940.890.37422ACADMOS0.0045670.0020552.220.02632MINORDRG0.26380.67700.390.69682LOGSPEND0.68260.22033.100.0019ParameterEstimatesforMixingProbabilitiesStandardEffectEstimateErrorzValuePr>|z|Intercept-1.42750.5278-2.700.0068AGE-0.002770.01011-0.270.7844ACADMOS0.0016140.0014401.120.2623MINORDRG1.58650.17918.86<.0001LOGSPEND-0.069490.07436-0.930.3501*/***TWO-CLASSFINITEMIXTUREPOISSONMODELWITHNLMIXEDPROCEDURE***;procnlmixeddata=tmp1tech=truregmaxit=500;B2_intercept=-8B2_age=0B2_acadmos=0B2_minordrg=0B2_logspend=0eta1=B1_intercept+B1_age*age+B1_acadmos*acadmos+B1_minordrg*minordrg+B1_logspend*logspend;exp_eta1=exp(eta1);prob1=exp(-exp_eta1)*exp_eta1**majordrg/fact(majordrg);eta2=B2_intercept+B2_age*age+B2_acadmos*acadmos+B2_minordrg*minordrg+B2_logspend*logspend;exp_eta2=exp(eta2);prob2=exp(-exp_eta2)*exp_eta2**majordrg/fact(majordrg);eta3=B3_intercept+B3_age*age+B3_acadmos*acadmos+B3_minordrg*minordrg+B3_logspend*logspend;exp_eta3=exp(eta3);p=exp_eta3/(1+exp_eta3);_prob_=p*prob1+(1-p)*prob2;ll=log(_prob_);modelmajordrg~general(ll);run;/*FitStatistics-2LogLikelihood8136.8AIC(smallerisbetter)8166.8AICC(smallerisbetter)8166.9BIC(smallerisbetter)8275.7ParameterEstimatesStandardParameterEstimateErrorDFtValuePr>|t|B1_intercept-2.44490.34971E4-6.99<.0001B1_age0.022140.0066281E43.340.0008B1_acadmos0.0005290.0007701E40.690.4920B1_minordrg0.050540.040151E41.260.2081B1_logspend0.21400.041271E45.18<.0001============B2_intercept-8.09351.59161E4-5.09<.0001B2_age0.011500.012941E40.890.3742B2_acadmos0.0045670.0020551E42.220.0263B2_minordrg0.26380.67701E40.390.6968B2_logspend0.68260.22031E43.100.0020============B3_intercept-1.42750.52781E4-2.700.0068B3_age-0.002770.010111E4-0.270.7844B3_acadmos0.0016140.0014401E41.120.2623B3_minordrg1.58650.17911E48.86<.0001B3_logspend-0.069490.074361E4-0.930.3501*/

need-to-insert-img

相关文章

网友评论

    本文标题:用SAS进行泊松模型,零膨胀泊松模型和有限混合Poisson模型

    本文链接:https://www.haomeiwen.com/subject/iwedmhtx.html