From: z on 18 Apr 2007 15:24 OK, I got handed a piece of code that used to work and doesn't any more. "What did you change?" "Nothing, honest!!" After much, I discover that what "used to work" was: 1) using proc logistic to model an outcome and generate a set of parameter estimates, years ago; 2) every quarter since, feeding proc logistic with that same model that pre-estimated set of parameters from step 1, using inest=; giving it a dataset of current values for the model input variables but with the outcome variable always = 0; and having it just calculate predicted values for the outcome for each observation from the model using the parameter estimates file and the current model input variables in the dataset, without doing any actual model fitting since the outcome value is always 0 in the new dataset. That doesn't work now, proc logistic just complains that there is no variation in the modeled otucome and quits without calculating any predictions. (SAS 9.1.3, UNIX) I have a workaround that's fine, I don't need any fixes; but, they insist that it used to work and SAS disagrees that it would ever work, with any version. For my own random curiosity, (and future SAS trivia bowls), does anybody actually know of any version of SAS where proc logistic would crank through one iteration before quitting, when the modeled variable had no variation, as in the above?
From: Kevin Roland Viel on 18 Apr 2007 15:41 On Wed, 18 Apr 2007, z wrote: > OK, I got handed a piece of code that used to work and doesn't any > more. > "What did you change?" > "Nothing, honest!!" > After much, I discover that what "used to work" was: > 1) using proc logistic to model an outcome and generate a set of > parameter estimates, years ago; > 2) every quarter since, feeding proc logistic with that same model > that pre-estimated set of parameters from step 1, using inest=; giving > it a dataset of current values for the model input variables but with > the outcome variable always = 0; and having it just calculate > predicted values for the outcome for each observation from the model > using the parameter estimates file and the current model input > variables in the dataset, without doing any actual model fitting since > the outcome value is always 0 in the new dataset. > > That doesn't work now, proc logistic just complains that there is no > variation in the modeled otucome and quits without calculating any > predictions. (SAS 9.1.3, UNIX) > > I have a workaround that's fine, I don't need any fixes; but, they > insist that it used to work and SAS disagrees that it would ever work, > with any version. For my own random curiosity, (and future SAS trivia > bowls), does anybody actually know of any version of SAS where proc > logistic would crank through one iteration before quitting, when the > modeled variable had no variation, as in the above? No, but could you post the code? Kevin Viel PhD Candidate Department of Epidemiology Rollins School of Public Health Emory University Atlanta, GA 30322
From: z on 19 Apr 2007 10:54 On Apr 18, 3:41 pm, k...(a)EMORY.EDU (Kevin Roland Viel) wrote: > On Wed, 18 Apr 2007, z wrote: > > OK, I got handed a piece of code that used to work and doesn't any > > more. > > "What did you change?" > > "Nothing, honest!!" > > After much, I discover that what "used to work" was: > > 1) using proc logistic to model an outcome and generate a set of > > parameter estimates, years ago; > > 2) every quarter since, feeding proc logistic with that same model > > that pre-estimated set of parameters from step 1, using inest=; giving > > it a dataset of current values for the model input variables but with > > the outcome variable always = 0; and having it just calculate > > predicted values for the outcome for each observation from the model > > using the parameter estimates file and the current model input > > variables in the dataset, without doing any actual model fitting since > > the outcome value is always 0 in the new dataset. > > > That doesn't work now, proc logistic just complains that there is no > > variation in the modeled otucome and quits without calculating any > > predictions. (SAS 9.1.3, UNIX) > > > I have a workaround that's fine, I don't need any fixes; but, they > > insist that it used to work and SAS disagrees that it would ever work, > > with any version. For my own random curiosity, (and future SAS trivia > > bowls), does anybody actually know of any version of SAS where proc > > logistic would crank through one iteration before quitting, when the > > modeled variable had no variation, as in the above? > > No, but could you post the code? > > Kevin Viel > PhD Candidate > Department of Epidemiology > Rollins School of Public Health > Emory University > Atlanta, GA 30322- Hide quoted text - > > - Show quoted text - Well, OK, just didn't want to bore everyone. The setup: There's an old file, model_outest, of the parameter estimates produced by the actual model fitting back at the dawn of time, here's a table of column name and value: _LINK_ LOGIT _STATUS_ 0 Converged _NAME_ post_hda_edadmimg_ex Intercept -2.900853263 age_cent -0.011878038 GENDER_CDF 0.016704286 bar_rxds_clc 0.002017138 ccb_rxds_clc 0.000688877 DZ_CAN 0.571382351 DZ_CBD 0.647533496 DZ_DEP 0.248451107 DZ_EPL 0.652219539 DZ_LBP 0.198143203 DZ_LUC 1.22721579 DZ_MSS 1.040160926 DZ_OMD 0.212108582 hda_adm_events_num 0.273170497 hda_ed_events_num 0.71975008 hda_pcp_visit_num 0.135852384 nhd_ed_events_num 0.193786457 nhd_pcp_visit_num 0.021560728 region_w -0.332936142 RTRSPCTV_RSK_NBR 0.041735812 _LNLIKE_ -2293.184975 Then there's a file of a large numbers of new individuals with various values of all these variables, all of which have post_hda_edadmimg_ex=0. The idea is to apply the above model to all these individuals, and calculate a predicted value for post_hda_edadmimg_ex for each, without actually fitting anything, just keeping that old model. So, the code says: proc logistic data = pop inest =model_outest; class gender_cd DZ_1P; weight wgt1; model post_hda_edadmimg_ex (event='1') = age_cent gender_cd bar_rxds_clc ccb_rxds_clc DZ_CAN DZ_CBD DZ_DEP DZ_EPL DZ_LBP DZ_LUC DZ_MSS DZ_OMD hda_adm_events_num hda_ed_events_num hda_pcp_visit_num nhd_ed_events_num nhd_pcp_visit_num region_w rtrspctv_rsk_nbr / ridging = none stb outroc=rocset ; output out=predvals pred=pred; run; And from all that, all that's really desired is the value of pred for each individual from predvals dataset. Even the rocset dataset just gets deleted. Anyway, that produces the message: ERROR: All observations have the same response. No statistics are computed. which is no surprise because all observations do have post_hda_edadmimg_ex=0; but it doesn't produce an output file with pred in it. Now, the one side swears that it used to work for years (in terms of just coughing up an initial value for pred for each row before bailing out), and the other side swears that it never would have worked. My hunch is that it probably did work once, but I'm just idly curious. (Real fix would probably be to hardcode the model and calcs; I just tossed some random ones and zeros in as post_hda_edadmimg_ex but used maxiter=0 to prevent any fitting and it spits out the correct values of pred in the right places).
From: David L Cassell on 20 Apr 2007 22:01 gzuckier(a)SNAIL-MAIL.NET wrote: > >OK, I got handed a piece of code that used to work and doesn't any >more. >"What did you change?" >"Nothing, honest!!" >After much, I discover that what "used to work" was: >1) using proc logistic to model an outcome and generate a set of >parameter estimates, years ago; >2) every quarter since, feeding proc logistic with that same model >that pre-estimated set of parameters from step 1, using inest=; giving >it a dataset of current values for the model input variables but with >the outcome variable always = 0; and having it just calculate >predicted values for the outcome for each observation from the model >using the parameter estimates file and the current model input >variables in the dataset, without doing any actual model fitting since >the outcome value is always 0 in the new dataset. > >That doesn't work now, proc logistic just complains that there is no >variation in the modeled otucome and quits without calculating any >predictions. (SAS 9.1.3, UNIX) > >I have a workaround that's fine, I don't need any fixes; but, they >insist that it used to work and SAS disagrees that it would ever work, >with any version. For my own random curiosity, (and future SAS trivia >bowls), does anybody actually know of any version of SAS where proc >logistic would crank through one iteration before quitting, when the >modeled variable had no variation, as in the above? Ick. Sorry, I wasn't supposed to say that out loud. :-) Let me solve the problem without answering your question. (Which is better than I usually do, since I usually don't solve the problem, just say "What's the big picture?" and "Why are you doing this?" :-) PROC LOGISTIC now has a SCORE statement which will do this for you. HTH, David -- David L. Cassell mathematical statistician Design Pathways 3115 NW Norwood Pl. Corvallis OR 97330 _________________________________________________________________ Download Messenger. Join the i�m Initiative. Help make a difference today. http://im.live.com/messenger/im/home/?source=TAGHM_APR07
From: z on 24 Apr 2007 16:04 On Apr 20, 10:01 pm, davidlcass...(a)MSN.COM (David L Cassell) wrote: > gzuck...(a)SNAIL-MAIL.NET wrote: > > >OK, I got handed a piece of code that used to work and doesn't any > >more. > >"What did you change?" > >"Nothing, honest!!" > >After much, I discover that what "used to work" was: > >1) using proc logistic to model an outcome and generate a set of > >parameter estimates, years ago; > >2) every quarter since, feeding proc logistic with that same model > >that pre-estimated set of parameters from step 1, using inest=; giving > >it a dataset of current values for the model input variables but with > >the outcome variable always = 0; and having it just calculate > >predicted values for the outcome for each observation from the model > >using the parameter estimates file and the current model input > >variables in the dataset, without doing any actual model fitting since > >the outcome value is always 0 in the new dataset. > > >That doesn't work now, proc logistic just complains that there is no > >variation in the modeled otucome and quits without calculating any > >predictions. (SAS 9.1.3, UNIX) > > >I have a workaround that's fine, I don't need any fixes; but, they > >insist that it used to work and SAS disagrees that it would ever work, > >with any version. For my own random curiosity, (and future SAS trivia > >bowls), does anybody actually know of any version of SAS where proc > >logistic would crank through one iteration before quitting, when the > >modeled variable had no variation, as in the above? > > Ick. > > Sorry, I wasn't supposed to say that out loud. :-) > > Let me solve the problem without answering your question. (Which > is better than I usually do, since I usually don't solve the problem, just > say "What's the big picture?" and "Why are you doing this?" :-) > > PROC LOGISTIC now has a SCORE statement which will do this for you. Yeah, a couple of folks have mentioned the SCORE statement, i'll have to see if it's what I want. Last time I did something similar, I hardcoded the parameters from the modeling so as to calculate out the estimate, complete with untransforming the logit link. I can see why they figured to just use Logistic to do the heavy math. The whole idea is simply to take this model fitted at great expense once upon a time, and apply it to current data to see who's estimated to be at risk for the next quarter. Kind of thing you'd figure to use SAS for, it would seem.
|
Pages: 1 Prev: Range Proc export Next: customizing SAS session WORK.REGSTRY WORK.PROFILE |