楼主: frankling
6286 13

求助:用SAS逻辑回归计算出现问题 [推广有奖]

  • 0关注
  • 0粉丝

学前班

90%

还不是VIP/贵宾

-

威望
0
论坛币
8 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
51 点
帖子
9
精华
0
在线时间
4 小时
注册时间
2009-10-30
最后登录
2010-2-23

楼主
frankling 发表于 2010-2-21 21:21:56 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
有这样一个案例:调查一个公司雇佣员工是否存在性别歧视,收集了28个求职者的数据,其中包含雇佣(y=1)或未雇佣(y=0);受高等教育的时间,工作经验时间,和性别(male=1,female=0)。数据在附件 discrim.xls (15 KB) 我用SAS9.0中的分析家(analyst),逻辑回归,得出的结果如下:    其中,性别的系数为-2.8526,意味着当性别为1,受雇佣机会更小,明显与数据中反映出的情况不符(男性明显受雇的几率大),我反复运算都是如此,请教各位高手这是为什么!!感激不尽!!
1                                                           

                                      The LOGISTIC Procedure

                                        Model Information

                     Data Set                      _PROJ_.DISCRIM            
                     Response Variable             hired                hired
                     Number of Response Levels     2                        
                     Number of Observations        28                        
                     Model                         binary logit              
                     Optimization Technique        Fisher's scoring         


                                         Response Profile

                                Ordered                      Total
                                  Value        hired     Frequency

                                      1            1             9
                                      2            0            19

                                 Probability modeled is hired=1.


                                     Class Level Information

                                                        Design
                                  Class     Value     Variables

                                  sex       0                 1
                                            1                -1


                                     Model Convergence Status

                          Convergence criterion (GCONV=1E-8) satisfied.         


                                       Model Fit Statistics

                                                           Intercept
                                            Intercept            and
                              Criterion          Only     Covariates

                              AIC              37.165         21.915
                              SC               38.497         27.244
                              -2 Log L         35.165         13.915


                             Testing Global Null Hypothesis: BETA=0

                     Test                 Chi-Square       DF     Pr > ChiSq

                     Likelihood Ratio        21.2493        3         <.0001
                     Score                   15.6824        3         0.0013
                     Wald                     5.5996        3         0.1328
1                                                           17:47 Saturday, February 15, 2003   2

                                      The LOGISTIC Procedure

                                    Type 3 Analysis of Effects

                                                      Wald
                          Effect          DF    Chi-Square    Pr > ChiSq

                          education        1        3.8720        0.0491
                          experience       1        4.5207        0.0335
                          sex              1        4.9405        0.0262


                             Analysis of Maximum Likelihood Estimates

                                                Standard          Wald
              Parameter       DF    Estimate       Error    Chi-Square    Pr > ChiSq

              Intercept        1    -11.1897      4.8002        5.4339        0.0197
              education        1      1.1540      0.5865        3.8720        0.0491
              experience       1      0.8777      0.4128        4.5207        0.0335
              sex        0     1     -2.8526      1.2834        4.9405        0.0262


                                      Odds Ratio Estimates

                                              Point          95% Wald
                      Effect               Estimate      Confidence Limits

                      education               3.171       1.005      10.008
                      experience              2.405       1.071       5.402
                      sex        0 vs 1       0.003      <0.001       0.509


                  Association of Predicted Probabilities and Observed Responses

                        Percent Concordant     94.2    Somers' D    0.883
                        Percent Discordant      5.8    Gamma        0.883
                        Percent Tied            0.0    Tau-a        0.399
                        Pairs                   171    c            0.942

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:逻辑回归 Optimization observations Convergence information 高等教育 工作经验 female 求职者 分析家

沙发
bobguy 发表于 2010-2-22 02:49:21
frankling 发表于 2010-2-21 21:21
有这样一个案例:调查一个公司雇佣员工是否存在性别歧视,收集了28个求职者的数据,其中包含雇佣(y=1)或未雇佣(y=0);受高等教育的时间,工作经验时间,和性别(male=1,female=0)。数据在附件。我用SAS9.0中的分析家(analyst),逻辑回归,得出的结果如下:    其中,性别的系数为-2.8526,意味着当性别为1,受雇佣机会更小,明显与数据中反映出的情况不符(男性明显受雇的几率大),我反复运算都是如此,请教各位高手这是为什么!!感激不尽!!
1                                                           

                                      The LOGISTIC Procedure

                                        Model Information

                     Data Set                      _PROJ_.DISCRIM            
                     Response Variable             hired                hired
                     Number of Response Levels     2                        
                     Number of Observations        28                        
                     Model                         binary logit              
                     Optimization Technique        Fisher's scoring         


                                         Response Profile

                                Ordered                      Total
                                  Value        hired     Frequency

                                      1            1             9
                                      2            0            19

                                 Probability modeled is hired=1.


                                     Class Level Information

                                                        Design
                                  Class     Value     Variables

                                  sex       0                 1
                                            1                -1


                                     Model Convergence Status

                          Convergence criterion (GCONV=1E-8) satisfied.         


                                       Model Fit Statistics

                                                           Intercept
                                            Intercept            and
                              Criterion          Only     Covariates

                              AIC              37.165         21.915
                              SC               38.497         27.244
                              -2 Log L         35.165         13.915


                             Testing Global Null Hypothesis: BETA=0

                     Test                 Chi-Square       DF     Pr > ChiSq

                     Likelihood Ratio        21.2493        3          ChiSq

                          education        1        3.8720        0.0491
                          experience       1        4.5207        0.0335
                          sex              1        4.9405        0.0262


                             Analysis of Maximum Likelihood Estimates

                                                Standard          Wald
              Parameter       DF    Estimate       Error    Chi-Square    Pr > ChiSq

              Intercept        1    -11.1897      4.8002        5.4339        0.0197
              education        1      1.1540      0.5865        3.8720        0.0491
              experience       1      0.8777      0.4128        4.5207        0.0335
              sex        0     1     -2.8526      1.2834        4.9405        0.0262


                                      Odds Ratio Estimates

                                              Point          95% Wald
                      Effect               Estimate      Confidence Limits

                      education               3.171       1.005      10.008
                      experience              2.405       1.071       5.402
                      sex        0 vs 1       0.003
The design matrix is

                                    Class Level Information

                                                        Design
                                  Class     Value     Variables

                                  sex       0                 1
                                            1                -1


The result  "
sex        0     1     -2.8526      1.2834        4.9405        0.0262" should refer to an "average sex level".

Here (sex=0 / female) coef does have negative scores.

What I like to use,

First about syntax, please

class sex/ param=glm;

Before model statement, these will give you the contrast level between sex=0 and sex=1.

Note All slope coefs will be the same in both
design matrix also the regression statistics. But the constant term will be different, the explaination will be slight different.

藤椅
bobguy 发表于 2010-2-22 02:55:26
frankling 发表于 2010-2-21 21:21
有这样一个案例:调查一个公司雇佣员工是否存在性别歧视,收集了28个求职者的数据,其中包含雇佣(y=1)或未雇佣(y=0);受高等教育的时间,工作经验时间,和性别(male=1,female=0)。数据在附件。我用SAS9.0中的分析家(analyst),逻辑回归,得出的结果如下:    其中,性别的系数为-2.8526,意味着当性别为1,受雇佣机会更小,明显与数据中反映出的情况不符(男性明显受雇的几率大),我反复运算都是如此,请教各位高手这是为什么!!感激不尽!!
1                                                           

                                      The LOGISTIC Procedure

                                        Model Information

                     Data Set                      _PROJ_.DISCRIM            
                     Response Variable             hired                hired
                     Number of Response Levels     2                        
                     Number of Observations        28                        
                     Model                         binary logit              
                     Optimization Technique        Fisher's scoring         


                                         Response Profile

                                Ordered                      Total
                                  Value        hired     Frequency

                                      1            1             9
                                      2            0            19

                                 Probability modeled is hired=1.


                                     Class Level Information

                                                        Design
                                  Class     Value     Variables

                                  sex       0                 1
                                            1                -1


                                     Model Convergence Status

                          Convergence criterion (GCONV=1E-8) satisfied.         


                                       Model Fit Statistics

                                                           Intercept
                                            Intercept            and
                              Criterion          Only     Covariates

                              AIC              37.165         21.915
                              SC               38.497         27.244
                              -2 Log L         35.165         13.915


                             Testing Global Null Hypothesis: BETA=0

                     Test                 Chi-Square       DF     Pr > ChiSq

                     Likelihood Ratio        21.2493        3          ChiSq

                          education        1        3.8720        0.0491
                          experience       1        4.5207        0.0335
                          sex              1        4.9405        0.0262


                             Analysis of Maximum Likelihood Estimates

                                                Standard          Wald
              Parameter       DF    Estimate       Error    Chi-Square    Pr > ChiSq

              Intercept        1    -11.1897      4.8002        5.4339        0.0197
              education        1      1.1540      0.5865        3.8720        0.0491
              experience       1      0.8777      0.4128        4.5207        0.0335
              sex        0     1     -2.8526      1.2834        4.9405        0.0262


                                      Odds Ratio Estimates

                                              Point          95% Wald
                      Effect               Estimate      Confidence Limits

                      education               3.171       1.005      10.008
                      experience              2.405       1.071       5.402
                      sex        0 vs 1       0.003
Your sample size(28) is really small in the logistics regression sense. If you can provide a much larger sample result and more detail analysis in the sense of more control variables. That will be a insteresting topic.

That is an separated issue.

板凳
醉_清风 发表于 2010-2-22 09:03:35
确实 样本数量实在太小了 很难做出好的结果
从来不需要想起 永远也不会忘记

报纸
frankling 发表于 2010-2-22 10:47:18
Thank you, Bobguy!!
I' m new learner of SAS. I don't quite understand about  "average sex level" in your reply.
What should I do to get the right result of  "sex" ?   Would you please tell me the right way using Analyst or the complete command syntax?

地板
bobguy 发表于 2010-2-22 11:24:26
frankling 发表于 2010-2-22 10:47
Thank you, Bobguy!!
I' m new learner of SAS. I don't quite understand about  "average sex level" in your reply.
What should I do to get the right result of  "sex" ?   Would you please tell me the right way using Analyst or the complete command syntax?
I believe it will be ,

proc logistic data=_PROJ_.DISCRIM;
class  sex /param=glm;
model hired (event='1') =  education experience sex ;
run;

7
jingju11 发表于 2010-2-22 11:24:32
5# frankling


其中,性别的系数为-2.8526,意味着当性别为1,受雇佣机会更小,明显与数据中反映出的情况不符(男性明显受雇的几率大),...

Odds Ratio Estimates

                                              Point          95% Wald
                      Effect               Estimate      Confidence Limits

                      education               3.171       1.005      10.008
                      experience              2.405       1.071       5.402
                      sex        0 vs 1       0.003      <0.001       0.509
I didn’t understand “the average level” neither.
I am quite confused about your confusion.
From the SAS output, the odds ratio of sex 0 vs. 1 (male = 1 and female = 0), that is, female vs. male, is 0.003, that is, women are much less likely to be employed from the result,
which is consistent to your conclusion from the data:男性明显受雇的几率大.

8
frankling 发表于 2010-2-22 11:32:10
7# jingju11
But the coef of sex is  -2.8526, which may lead to the result of " when sex =1, the P of employment is lower".

9
bobguy 发表于 2010-2-22 12:03:22
frankling 发表于 2010-2-22 11:32
7# jingju11
But the coef of sex is  -2.8526, which may lead to the result of " when sex =1, the P of employment is lower".
The coef of (sex=0) female is -2.8526. Here sex is a catagorical variable.

10
jingju11 发表于 2010-2-22 12:07:46
5# frankling

Not really. From odds ratio part in SAS output, we see that OR for 0 vs. 1 is 0.003, that is from exp (-2.8526*2). Why multiplied by 2? The reason is the default parameterization is EFFECT in proc logistic,and that is why BOBGUY suggested we look at the design matrix for the variable.
Whatever, Odds Ratio Estimates give you the result directly. You don’t need to do the calculation anymore. I don’t understand why you insist that?

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-29 18:00