【发布时间】:2011-10-12 02:06:39
【问题描述】:
我想使用 SAS 在逻辑回归中执行标准似然比检验。我将有一个完整的逻辑模型,包含所有变量,命名为 A 和一个嵌套逻辑模型 B,它是通过从 A 中删除一个变量得出的。
如果我想测试退出变量是否显着,我将对模型 A 和 B 执行似然比测试。在 SAS 中执行此测试(本质上是卡方检验)是否有简单的方法使用PROC?非常感谢您的帮助。
【问题讨论】:
标签: sas regression
我想使用 SAS 在逻辑回归中执行标准似然比检验。我将有一个完整的逻辑模型,包含所有变量,命名为 A 和一个嵌套逻辑模型 B,它是通过从 A 中删除一个变量得出的。
如果我想测试退出变量是否显着,我将对模型 A 和 B 执行似然比测试。在 SAS 中执行此测试(本质上是卡方检验)是否有简单的方法使用PROC?非常感谢您的帮助。
【问题讨论】:
标签: sas regression
如果您要执行完整模型与模型的似然比检验。一个变量删除模型,您可以使用带有 type3 选项的 GENMOD 过程。
脚本:
data d1;
do z = 0 to 2;
do y = 0 to 1;
do x = 0 to 1;
input n @@;
output;
end; end; end;
cards;
100 200 300 400
50 100 150 200
50 100 150 200
;
proc genmod data = d1;
class y z;
freq n;
model x = y z / error = bin link = logit type3;
run;
输出:
LR Statistics For Type 3 Analysis
Chi-
Source DF Square Pr > ChiSq
y 1 16.09 <.0001
z 2 0.00 1.0000
【讨论】:
我不确定可以专门执行 LRT 的 PROC 语句,但您可以计算嵌套模型的测试。
脚本
proc logistic data = full_model;
model dependent_var = independent_var(s);
ods output GlobalTests = GlobalTests_full;
run;
data _null_;
set GlobalTests_full;
if test = "Likelihood Ratio" then do;
call symput("ChiSq_full", ChiSq);
call symput("DF_full", DF);
end;
run;
proc logistic data = reduced_model;
model dependent_var = independent_var(s);
ods output GlobalTests = GlobalTests_reduced;
run;
data _null_;
set GlobalTests_reduced;
if test = "Likelihood Ratio" then do;
call symput("ChiSq_reduced", ChiSq);
call symput("DF_reduced", DF);
end;
run;
data LRT_result;
LR = &ChiSq_full - &ChiSq_reduced;
DF = &DF_full - &DF_reduced;
p = 1 - probchi(ChiSq,DF);
run;
【讨论】:
proc logistic(不是ligistic)吗?
我不是逻辑回归方面的专家,但我认为您可以使用 PROC LOGISTIC 完成您想要完成的任务,在 MODEL 语句中使用“SELECTION=SCORE”选项。还有其他可用的 SELECTION 选项,例如 STEPWISE,但我认为 SCORE 匹配最接近您正在寻找的内容。不过,我建议您阅读一下,因为有一些相关选项(BEST=、START= STOP=)您也可能从中受益。
【讨论】: