如何在SAS中对逻辑回归进行似然比检验?

发布于 2024-12-09 03:03:00 字数 186 浏览 0 评论 0原文

我想使用 SAS 在逻辑回归中执行标准似然比检验。我将有一个完整的逻辑模型,包含所有变量,名为 A 和嵌套逻辑模型 B,该模型是通过从 A 中删除一个变量而派生的。

如果我想测试该删除变量是否显着,我将执行模型 A 和 B 的似然比检验。是否有一种简单的方法可以使用 PROC 在 SAS 中执行此检验(本质上是卡方检验)?非常感谢您的帮助。

I want to perform the standard likelihood ratio test in logsitic regression using SAS. I will have a full logistic model, containing all variables, named A and a nested logistic model B, which is derived by dropping out one variable from A.

If I want to test whether that drop out variable is significant or not, I shall perform a likelihood ratio test of model A and B. Is there an easy way to perform this test (essentially a chi-square test) in SAS using a PROC? Thank you very much for the help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

迷离° 2024-12-16 03:03:00

如果要执行完整模型与单变量丢弃模型的似然比检验,可以使用带有 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

If you want to perform likelihood ratio tests that are full model v.s. one variable dropped model, you can use the GENMOD procedure with the type3 option.

Script:

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;

Output:

     LR Statistics For Type 3 Analysis

                          Chi-
Source           DF     Square    Pr > ChiSq

y                 1      16.09        <.0001
z                 2       0.00        1.0000
迷迭香的记忆 2024-12-16 03:03:00

我不确定是否有专门执行 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;

I'm not sure about a PROC statement that can specifically perform LRT but you can compute the test for nested models.

Script

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;
老旧海报 2024-12-16 03:03:00

我不是逻辑回归方面的专家,但我认为您想要完成的事情可以通过 PROC LOGISTIC 来完成,使用 MODEL 语句上的“SELECTION=SCORE”选项。还有其他可用的选择选项,例如 STEPWISE,但我认为 SCORE 与您要查找的内容最匹配。不过,我建议您仔细阅读它,因为有一些相关的选项(BEST=、START= STOP=)您也可能会从中受益。

I'm no expert on logistic regression, but I think what you are trying to accomplish can be done with PROC LOGISTIC, using the "SELECTION=SCORE" option on the MODEL statement. There are other SELECTION options available, such as STEPWISE, but I think SCORE matches closest to what you are looking for. I would suggest reading up on it though, because there are some associated options (BEST=, START= STOP=) that you might benefit from too.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文