Link to the original text: http://tecdat.cn/?p=6145
Poisson model
< div class="cke_widget_wrapper cke_widget_block cke_widget_codeSnippet cke_widget_wrapper_has cke_widget_selected" data-cke-widget-wrapper="1" data-cke-filter="off" data-cke-display-name="off" data-cke-display-name="code segment" data-cke-display-name= "2">
proc fmm data = tmp1 tech = trureg;
Model majordrg = age acadmos minordrg logspend / dist = truncpoisson;
Probmodel age acadmos minordrg logspend;
/*
Fit Statistics
To
-2 Log Likelihood 8201.0
AIC (smaller is better) 8221.0
AICC (smaller is better) 8221.0
BIC (smaller is better) 8293.5
To
Parameter Estimates for ‘Truncated Poisson’ Model
To
Standard
Component Effect Estimate Error z Value Pr> |z|
To
1 Intercept -2.0706 0.3081 -6.72 <.0001
1 AGE 0.01796 0.005482 3.28 0.0011
1 ACADMOS 0.000852 0.000700 1.22 0.2240
1 MINORDRG 0.1739 0.03441 5.05 <.0001
1 LOGSPEND 0.1229 0.04219 2.91 0.0036
To
Parameter Estimates for Mixing Probabilities
To
Standard
Effect Estimate Error z Value Pr> |z|
To
Intercept -4.2309 0.1808 -23.40 <.0001
AGE 0.01694 0.003323 5.10 <.0001
ACADMOS 0.002240 0.000492 4.55 <.0001
MINORDRG 0.7653 0.03842 19.92 <.0001
LOGSPEND 0.2301 0.02683 8.58 <.0001
*/
To
*** HURDLE POISSON MODEL WITH NLMIXED PROCEDURE ***;
proc nlmixed data = tmp1 tech = trureg maxit = 500;
Parms B1_intercept = -4 B1_age = 0 B1_acadmos = 0 B1_minordrg = 0 B1_logspend = 0
B2_intercept = -2 B2_age = 0 B2_acadmos = 0 B2_minordrg = 0 B2_logspend = 0;
To
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);
If majordrg = 0 then _prob_ = p0;
Else _prob_ = (1-p0) * exp(-exp_eta2) * (exp_eta2 ** majordrg) / ((1-exp(-exp_eta2)) * fact(majordrg));
Ll = log(_prob_);
Model majordrg ~ general(ll);
run;
/*
Fit Statistics
To
-2 Log Likelihood 8201.0
AIC (smaller is better) 8221.0
AICC (smaller is better) 8221.0
BIC (smaller is better) 8293.5
To
Parameter Estimates
To
Standard
Parameter Estimate Error DF t Value Pr> |t|
To
B1_intercept -4.2309 0.1808 1E4 -23.40 <.0001
B1_age 0.01694 0.003323 1E4 5.10 <.0001
B1_acadmos 0.002240 0.000492 1E4 4.55 <.0001
B1_minordrg 0.7653 0.03842 1E4 19.92 <.0001
B1_logspend 0.2301 0.02683 1E4 8.58 <.0001
============
B2_intercept -2.0706 0.3081 1E4 -6.72 <.0001
B2_age 0.01796 0.005482 1E4 3.28 0.0011
B2_acadmos 0.000852 0.000700 1E4 1.22 0.2240
B2_minordrg 0.1739 0.03441 1E4 5.05 <.0001
B2_logspend 0.1229 0.04219 1E4 2.91 0.0036
*/
Zero expansion Poisson model
Two types of limited hybrid Poisson model
Big Data Tribe —— China's professional third-party data service provider provides customized one-stop data mining and statistical analysis consulting services
Statistical analysis and data mining consulting services: y0.cn/ teradat (for consulting services, please contact the official website customer service)
Share the latest big data information and learn every day A bit of data analysis, let us be an attitude data person together
WeChat customer service number: lico_9e
QQ exchange group: 186388004
Welcome to take our R language data analysis and mining must know, must know course!
< br>
Welcome to follow the WeChat official account to learn more about data and dry goods!
proc fmm data = tmp1 tech = trureg;
model majordrg = age acadmos minordrg logspend / dist = truncpoisson;
probmodel age acadmos minordrg logspend;
/*
Fit Statistics
To
-2 Log Likelihood 8201.0
AIC (smaller is better) 8221.0
AICC (smaller is better) 8221.0
BIC (smaller is better) 8293.5
To
Parameter Estimates for ‘Truncated Poisson‘ Model
To
Standard
Component Effect Estimate Error z Value Pr > |z|
To
1 Intercept -2.0706 0.3081 -6.72 <.0001
1 AGE 0.01796 0.005482 3.28 0.0011
1 ACADMOS 0.000852 0.000700 1.22 0.2240
1 MINORDRG 0.1739 0.03441 5.05 <.0001
1 LOGSPEND 0.1229 0.04219 2.91 0.0036
To
Parameter Estimates for Mixing Probabilities
To
Standard
Effect Estimate Error z Value Pr > |z|
To
Intercept -4.2309 0.1808 -23.40 <.0001
AGE 0.01694 0.003323 5.10 <.0001
ACADMOS 0.002240 0.000492 4.55 <.0001
MINORDRG 0.7653 0.03842 19.92 <.0001
LOGSPEND 0.2301 0.02683 8.58 <.0001
*/
To
*** HURDLE POISSON MODEL WITH NLMIXED PROCEDURE ***;
proc nlmixed data = tmp1 tech = trureg maxit = 500;
parms B1_intercept = -4 B1_age = 0 B1_acadmos = 0 B1_minordrg = 0 B1_logspend = 0
B2_intercept = -2 B2_age = 0 B2_acadmos = 0 B2_minordrg = 0 B2_logspend = 0;
To
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);
if majordrg = 0 then _prob_ = p0;
else _prob_ = (1 - p0) * exp(-exp_eta2) * (exp_eta2 ** majordrg) / ((1 - exp(-exp_eta2)) * fact(majordrg));
ll = log(_prob_);
model majordrg ~ general(ll);
run;
/*
Fit Statistics
To
-2 Log Likelihood 8201.0
AIC (smaller is better) 8221.0
AICC (smaller is better) 8221.0
BIC (smaller is better) 8293.5
To
Parameter Estimates
To
Standard
Parameter Estimate Error DF t Value Pr > |t|
To
B1_intercept -4.2309 0.1808 1E4 -23.40 <.0001
B1_age 0.01694 0.003323 1E4 5.10 <.0001
B1_acadmos 0.002240 0.000492 1E4 4.55 <.0001
B1_minordrg 0.7653 0.03842 1E4 19.92 <.0001
B1_logspend 0.2301 0.02683 1E4 8.58 <.0001
============
B2_intercept -2.0706 0.3081 1E4 -6.72 <.0001
B2_age 0.01796 0.005482 1E4 3.28 0.0011
B2_acadmos 0.000852 0.000700 1E4 1.22 0.2240
B2_minordrg 0.1739 0.03441 1E4 5.05 <.0001
B2_logspend 0.1229 0.04219 1E4 2.91 0.0036
*/
*** ZERO-INFLATED POISSON MODEL WITH FMM PROCEDURE ***;
proc fmm data = tmp1 tech = trureg;
model majordrg = age acadmos minordrg logspend / dist = poisson;
probmodel age acadmos minordrg logspend;
run;
/*
Fit Statistics
To
-2 Log Likelihood 8147.9
AIC (smaller is better) 8167.9
AICC (smaller is better) 8167.9
BIC (smaller is better) 8240.5
To
Parameter Estimates for ‘Poisson‘ Model
To
Standard
Component Effect Estimate Error z Value Pr > |z|
To
1 Intercept -2.2780 0.3002 -7.59 <.0001
1 AGE 0.01956 0.006019 3.25 0.0012
1 ACADMOS 0.000249 0.000668 0.37 0.7093
1 MINORDRG 0.1176 0.02711 4.34 <.0001
1 LOGSPEND 0.1644 0.03531 4.66 <.0001
To
Parameter Estimates for Mixing Probabilities
To
Standard
Effect Estimate Error z Value Pr > |z|
To
Intercept -1.9111 0.4170 -4.58 <.0001
AGE -0.00082 0.008406 -0.10 0.9218
ACADMOS 0.002934 0.001085 2.70 0.0068
MINORDRG 1.4424 0.1361 10.59 <.0001
LOGSPEND 0.09562 0.05080 1.88 0.0598
*/
To
*** ZERO-INFLATED POISSON MODEL WITH NLMIXED PROCEDURE ***;
proc nlmixed data = tmp1 tech = trureg maxit = 500;
parms B1_intercept = -2 B1_age = 0 B1_acadmos = 0 B1_minordrg = 0 B1_logspend = 0
B2_intercept = -2 B2_age = 0 B2_acadmos = 0 B2_minordrg = 0 B2_logspend = 0;
To
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);
if majordrg = 0 then _prob_ = p0 + (1 - p0) * exp(-exp_eta2);
else _prob_ = (1 - p0) * exp(-exp_eta2) * (exp_eta2 ** majordrg) / fact(majordrg);
ll = log(_prob_);
model majordrg ~ general(ll);
run;
/*
Fit Statistics
To
-2 Log Likelihood 8147.9
AIC (smaller is better) 8167.9
AICC (smaller is better) 8167.9
BIC (smaller is better) 8240.5
To
Parameter Estimates
To
Standard
Parameter Estimate Error DF t Value Pr > |t|
To
B1_intercept -1.9111 0.4170 1E4 -4.58 <.0001
B1_age -0.00082 0.008406 1E4 -0.10 0.9219
B1_acadmos 0.002934 0.001085 1E4 2.70 0.0068
B1_minordrg 1.4424 0.1361 1E4 10.59 <.0001
B1_logspend 0.09562 0.05080 1E4 1.88 0.0598
============
B2_intercept -2.2780 0.3002 1E4 -7.59 <.0001
B2_age 0.01956 0.006019 1E4 3.25 0.0012
B2_acadmos 0.000249 0.000668 1E4 0.37 0.7093
B2_minordrg 0.1176 0.02711 1E4 4.34 <.0001
B2_logspend 0.1644 0.03531 1E4 4.66 <.0001
*/
*** TWO-CLASS FINITE MIXTURE POISSON MODEL WITH FMM PROCEDURE ***;
proc fmm data = tmp1 tech = trureg;
model majordrg = age acadmos minordrg logspend / dist = poisson k = 2;
run;
/*
Fit Statistics
To
-2 Log Likelihood 8136.8
AIC (smaller is better) 8166.8
AICC (smaller is better) 8166.9
BIC (smaller is better) 8275.7
To
Parameter Estimates for ‘Poisson‘ Model
To
Standard
Component Effect Estimate Error z Value Pr > |z|
To
1 Intercept -2.4449 0.3497 -6.99 <.0001
1 AGE 0.02214 0.006628 3.34 0.0008
1 ACADMOS 0.000529 0.000770 0.69 0.4920
1 MINORDRG 0.05054 0.04015 1.26 0.2081
1 LOGSPEND 0.2140 0.04127 5.18 <.0001
2 Intercept -8.0935 1.5915 -5.09 <.0001
2 AGE 0.01150 0.01294 0.89 0.3742
2 ACADMOS 0.004567 0.002055 2.22 0.0263
2 MINORDRG 0.2638 0.6770 0.39 0.6968
2 LOGSPEND 0.6826 0.2203 3.10 0.0019
To
Parameter Estimates for Mixing Probabilities
To
Standard
Effect Estimate Error z Value Pr > |z|
To
Intercept -1.4275 0.5278 -2.70 0.0068
AGE -0.00277 0.01011 -0.27 0.7844
ACADMOS 0.001614 0.001440 1.12 0.2623
MINORDRG 1.5865 0.1791 8.86 <.0001
LOGSPEND -0.06949 0.07436 -0.93 0.3501
*/
To
*** TWO-CLASS FINITE MIXTURE POISSON MODEL WITH NLMIXED PROCEDURE ***;
proc nlmixed data = tmp1 tech = trureg maxit = 500;
B2_intercept = -8 B2_age = 0 B2_acadmos = 0 B2_minordrg = 0 B2_logspend = 0
To
eta1 = 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_);
model majordrg ~ general(ll);
run;
/*
Fit Statistics
To
-2 Log Likelihood 8136.8
AIC (smaller is better) 8166.8
AICC (smaller is better) 8166.9
BIC (smaller is better) 8275.7
To
Parameter Estimates
To
Standard
Parameter Estimate Error DF t Value Pr > |t|
To
B1_intercept -2.4449 0.3497 1E4 -6.99 <.0001
B1_age 0.02214 0.006628 1E4 3.34 0.0008
B1_acadmos 0.000529 0.000770 1E4 0.69 0.4920
B1_minordrg 0.05054 0.04015 1E4 1.26 0.2081
B1_logspend 0.2140 0.04127 1E4 5.18 <.0001
============
B2_intercept -8.0935 1.5916 1E4 -5.09 <.0001
B2_age 0.01150 0.01294 1E4 0.89 0.3742
B2_acadmos 0.004567 0.002055 1E4 2.22 0.0263
B2_minordrg 0.2638 0.6770 1E4 0.39 0.6968
B2_logspend 0.6826 0.2203 1E4 3.10 0.0020
============
B3_intercept -1.4275 0.5278 1E4 -2.70 0.0068
B3_age -0.00277 0.01011 1E4 -0.27 0.7844
B3_acadmos 0.001614 0.001440 1E4 1.12 0.2623
B3_minordrg 1.5865 0.1791 1E4 8.86 <.0001
B3_logspend -0.06949 0.07436 1E4 -0.93 0.3501
*/
大数据部落 ——中国专业的第三方数据服务提供商,提供定制化的一站式数据挖掘和统计分析咨询服务
统计分析和数据挖掘咨询服务 : y0.cn/teradat(咨询服务请联系 官网客服)
分享最新的大数据资讯,每天学习一点数据分析,让我们一起做有态度的数据人
微信客服号:lico_9e
QQ交流群:186388004
欢迎关注微信公众号,了解更多数据干货资讯!