楼主: dmchuxue
4634 6

proc logistic遇到权重缺失就会停下来 [推广有奖]

  • 0关注
  • 0粉丝

初中生

23%

还不是VIP/贵宾

-

威望
0
论坛币
1 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
65 点
帖子
9
精华
0
在线时间
8 小时
注册时间
2009-7-27
最后登录
2022-5-2

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
我用少量数据来运行proc logistic,
data temp;
input active x y z k;
cards;
1 2 45 123 1200
0 10 45 222 2400
1 14 56 . 1400
1 22 47 200 1500
0 9 35 . 1700
1 12 26 455 2000
;
run;
proc logistic data=temp descending;
weight z;
model active=x y k;
output out=temp1 pred=pred;
run;
其中z是权重,当运行程序的时候只进行到第二行,应该是程序碰到缺失值而停止执行,但是除了第三行我第四行的权重并没有缺失,怎么也会不给执行呢?希望各位能给以解答,小弟困惑了好久了!
二维码

扫码加我 拉你入群

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

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

关键词:logistic ogistic logisti logist logis proc 缺失 logistic 权重

回帖推荐

坐看云起时 发表于5楼  查看完整内容

MODEL Statement MODEL events/trials= < effects > < / options >; MODEL variable < (variable_options) >= < effects > < / options >; Two forms of the MODEL statement can be specified. The first form, referred to as single-trial syntax, is applicable to binary, ordinal, and nominal response data. The second form, referred to as events/trials syntax, is restricted to the case of binary response da ...

坐看云起时 发表于2楼  查看完整内容

logistic回归中,当数据中含加权值而反应变量是一个二分变量,应使用MODEL Y/N=X1 X2......的方式来界定模型而非 MODEL Y=X1 X2... 的 方式 。也就是找出active/k与x y 之间的关系。 data temp; input active x y z k; cards; 1 2 45 123 1200 0 10 45 222 2400 1 14 56 . 1400 1 22 47 200 1500 0 9 35 . 1700 1 12 26 455 2000 ; run; proc logistic data=temp descending; model active/k=x y ; output out=temp1 ...

本帖被以下文库推荐

沙发
坐看云起时 在职认证  发表于 2009-8-24 21:26:27 |只看作者 |坛友微信交流群
logistic回归中,当数据中含加权值而反应变量是一个二分变量,应使用MODEL Y/N=X1 X2......的方式来界定模型而非 MODEL Y=X1 X2... 的 方式 。也就是找出active/k与x y 之间的关系。
data temp;
input active x y z k;
cards;
1 2 45 123 1200
0 10 45 222 2400
1 14 56 . 1400
1 22 47 200 1500
0 9 35 . 1700
1 12 26 455 2000
;
run;
proc logistic data=temp descending;
model active/k=x y ;
output out=temp1 pred=pred;
weight  z;
run;
已有 1 人评分经验 论坛币 收起 理由
bakoll + 3 + 3 精彩帖子

总评分: 经验 + 3  论坛币 + 3   查看全部评分

使用道具

藤椅
dmchuxue 发表于 2009-8-25 00:59:38 |只看作者 |坛友微信交流群
2# 坐看云起时


的确是这样,谢谢阁下的解答,谢谢!

使用道具

板凳
jingju11 发表于 2009-8-25 22:17:45 |只看作者 |坛友微信交流群
2# 坐看云起时

希望赐教:

proc logistic data=temp descending;
model active/k=x y ;
output out=temp1 pred=pred;
weight  z;
run;
我对model active/k=x y ;的理解是 active =事件发生的次数,k=实验的次数;

可是原始的程序好像是active是0 1 反应变量;另外原始程序里说他运用的是少量数据,其实按照active/k 的写法,数据并不小,只是事件发生的次数少而已;
另外楼主认为程序中断运行是因为权重的关系。缘何判断呢?有没有可能过大的权重以及过少的观察数造成算法出错呢?比如说改写程序:

proc logistic data=temp descending;
freq K;
model active=x y ;
output out=temp1 pred=pred;
weight  z;
run;
此处增多的观察数保证程序运行无误。

使用道具

报纸
坐看云起时 在职认证  发表于 2009-8-26 03:42:39 |只看作者 |坛友微信交流群
MODEL Statement
MODEL events/trials= < effects > < / options >;
MODEL variable < (variable_options) >= < effects > < / options >;

Two forms of the MODEL statement can be specified. The first form, referred to as single-trial syntax, is applicable to binary, ordinal, and nominal response data. The second form, referred to as events/trials syntax, is restricted to the case of binary response data. The single-trial syntax is used when each observation in the DATA= data set contains information on only a single trial, for instance, a single subject in an experiment. When each observation contains information on multiple binary-response trials, such as the counts of the number of subjects observed and the number responding, then events/trials syntax can be used.

In the events/trials syntax, you specify two variables that contain count data for a binomial experiment. These two variables are separated by a slash. The value of the first variable, events, is the number of positive responses (or events). The value of the second variable, trials, is the number of trials. The values of both events and (trials-events) must be nonnegative and the value of trials must be positive for the response to be valid.

In the single-trial syntax, you specify one variable (on the left side of the equal sign) as the response variable. This variable can be character or numeric. Options specific to the response variable can be specified immediately after the response variable with a pair of parentheses around them.

For both forms of the MODEL statement, explanatory effects follow the equal sign. Variables can be either continuous or classification variables. Classification variables can be character or numeric, and they must be declared in the CLASS statement. When an effect is a classification variable, the procedure enters a set of coded columns into the design matrix instead of directly entering a single column containing the values of the variable.

你也可以查阅“《世界统计与分析全才SAS系统应用指南”p387页关于于逻辑回归中对权数设定时,model的要求。
已有 1 人评分经验 论坛币 收起 理由
bakoll + 3 + 3 精彩帖子

总评分: 经验 + 3  论坛币 + 3   查看全部评分

使用道具

地板
jingju11 发表于 2009-8-26 04:23:33 |只看作者 |坛友微信交流群
5# 坐看云起时

感谢你的回复。只是看大段的英文解释让人头痛。我没有那本书,暂时没法查阅。
举例:

p ro c    l o g i s t i c d a t a = t o d a y ;
  model   d i s e a s e = f ema l e ;
  we i g h t     we i g h t ;
run;
从此处而来 http://www.biostat.umn.edu/~melanie/PH7402/2009/NOTE/proc%20logistic%20traps.pdf

我的理解是,model的写法,要采用第一或者第二种方法, 与是否含有weight statement无关。model的写法只是取决于data 的形式。如果是weight发生错误,不应该用改变model的写法来解决问题。K如果在等式的右边,那就是个自变量。如果是 */K= , 在等式的左边,那它就是实验的次数。

如果按照 model active/k=x y;我的理解还是:very few events occurred on a large numer of observations. 去掉missing,total number of responses(events)=3, and total number of trials=1200+2400+1500+2000=7100. 这也是我为什么说这是一个很大的dataset。既然data很大,此时用weight,没有运算错误也是可以理解的。

如果按照 model active=x y z。此时total number of responses(events)=3, and total number of observations=4.;这是一个很小的data。

所以,我的理解还是,你和原始程序用的是不同的数据。

input active x y z k;
cards;
1 2 45 123 1200
0 10 45 222 2400
1 14 56 . 1400
1 22 47 200 1500
0 9 35 . 1700
1 12 26 455 2000
;
run;

使用道具

7
坐看云起时 在职认证  发表于 2009-8-26 05:35:14 |只看作者 |坛友微信交流群
1、上面的英文说明是sas帮助文件里的解释
2、total number of trials=1200+2400+1500+2000=7100,但事件发生的次数(count)为123 、222 、56.。。。。。。。。
3、在sas的logistic回归中,当数据中含加权值(权重)而反应变量是一个二分类变量,应使用MODEL Y/N=X1 X2......的方式来界定模型而非 MODEL Y=X1 X2... 的 方式。这里的y可以是:binary, ordinal, and nominal response data
4、“世界统计与分析全才SAS系统应用指南”论坛里就有。
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
footbook + 1 + 1 + 1 精彩帖子

总评分: 学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

使用道具

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

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-5-16 19:49