Date: Sat, 19 Sep 2009 15:23:33 -0400
Reply-To: William Shakespeare <shakespeare_1040@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: William Shakespeare <shakespeare_1040@HOTMAIL.COM>
Subject: Re: proc glm
This is the way I do it with proc logistic and I would think there would
be some way to set up the F-test for a glm in a similar fashion.
/*FULL MODEL*/
ods listing;
ods output Globaltests=sasdata.full;
proc logistic data=sasdata.cf_log_training_2008;
model buy(event='1')= cust_sales
cust_trans
cust_trans2
cust_sales_07
cust_sales_06
cust_sales_05
cust_sales_04
cust_sales_03
cust_sales_02
cust_sales_022
cust_orders_07
cust_orders_06
cust_orders_05
cust_orders_04
cust_orders_03
cust_orders_02
/link=logit aggregate scale=none rsquare lackfit;
title 'Full Model';
run;
ods listing;
ods output Globaltests=sasdata.nested;
proc logistic data=sasdata.cf_log_training_2008;
model buy(event='1')= cust_sales
cust_trans
cust_trans2
/*cust_sales_07
cust_sales_06*/
cust_sales_05
/*cust_sales_04
cust_sales_03*/
cust_sales_02
cust_sales_022
cust_orders_07
cust_orders_06
cust_orders_05
cust_orders_04
cust_orders_03
cust_orders_02
/link=logit aggregate scale=none rsquare lackfit;
title 'Reduced Model';
run;
/*LR TEST*/
data sasdata.both;
merge sasdata.full(in=full keep=test chisq df rename=(chisq=fullchisq
df=fulldf))
sasdata.nested(in=nested keep=test chisq df);
where (index(test,"Likelihood Ratio") ge 1);
lldiff=fullchisq - chisq;
dfdiff=fulldf - df;
pdiff=1-probchi(lldiff,dfdiff);
output sasdata.both;
label fullchisq="Chi-squared (full model)";
label chisq="Chi-squared (nested model)";
label fulldf="Degrees of freedom (full model)":
label df="Degrees of freedom (nested model)";
label lldiff="-2*log likelihood chi-squared";
label dfdiff="DF difference (full - nested)";
label pdiff="Probability: difference betw full + nested";
run;
proc print data=sasdata.both uniform label;
id test;
title2 "Statistics for difference between full and reduced models";
run;