```Date: Fri, 30 Mar 2007 08:33:10 -0700 Reply-To: Savvy Sender: "SAS(r) Discussion" From: Savvy Organization: http://groups.google.com Subject: Re: logistic regression Comments: To: sas-l@uga.edu In-Reply-To: <1175267695.041248.245320@y66g2000hsf.googlegroups.com> Content-Type: text/plain; charset="iso-8859-1" Thanks. Will try this. On Mar 30, 11:14 am, shilin...@yahoo.com wrote: > On Mar 30, 9:49 am, "Savvy" wrote: > > > I am doing a binary logistic regression. All of the variables in my > > model are untransformed variables. Should I be concerned that none of > > the transformations came in? > > It really depends on the relationship between log odds and covariates. > The relationship between log odds and covariates may be very > complicatied when there are interactions and correlations among your > covariates. Usually the first step is to investigate the relationships > by plotting log odds and each and every covariate candidate. If it is > not linear, you may consider tranforming your covariates and using any > theritical work to guide if there is any interaction. This is JUST the > first step and a of dirt work. > > Here is an example to plot the logodds with a numeric variable. The > plots will give you the relationship between log odds and covariate x1 > is quadratic, and covariate x3 is linear and covariate x4 is none. > > HTH. > > data t1; > do i = 1 to 5000; > x1=ceil(ranuni(1234567890)*70)+5; x2=x1*x1; > x3=rannor(1234567890);x4=rannor(1234567890); > y=0.5-0.05*x1+0.001*x2+0.5*x3 > rannor(1234567890); > output; > end; > run; > > %macro logit_plot(idsn=t1,odsn=all,y=y,x=x1 x3 x4, group=100, > combined=0,standard=n); > title ; > %let n=%eval((%sysfunc(countc(%cmpres(&x),%str( ))) > +1)*(%length(&x)>0)); > %let keepit=&y &x; > %let rankvar=; > > %do i = 1 %to &n; > %let rankvar=&rankvar %scan(&x, &i)_r; > %end; > > proc rank data=&idsn(keep=&keepit) out=_&idsn group=&group > TIES=MEAN ; > var &x; > ranks &rankvar; > run; > > %if %upcase(&standard)=Y %then %do; > proc standard data=_&idsn mean=0 std=1 replace print out=_&idsn; > var &x; > run; > %end; > > data _v&idsn/view=_v&idsn; > set > %do i = 1 %to &n; > %let var=%scan(&x, &i); > _&idsn(rename=(&var=_X_ &var._r=_X_R) in=_&var ) > %end; > ; > %do i = 1 %to &n; > %let var=%scan(&x, &i); > if _&var then class_var="%upcase(&var)"; > %end; > run; > > proc means data=_v&idsn nway noprint; > class class_var _X_R ; > var &y _x_; > output out=&odsn(keep=class_var _X_R &y _x_) mean=&y _x_; > run; > > data &odsn; > set &odsn; > &y._logit=log(&y/(1-&y)); > run; > > title 'logit values VS NUM covariate values'; > proc print data=&odsn; run; > > %if "&combined"="1" %then %do; > title ">logodd plot of &y._logit VS. %upcase(&x)<"; > %let byit=; > %let plotit=%str(plot &y._logit*_x_ =class_var/;); > symbol i=j value=circle cv=r; > symbol2 i=j value=dot cv=b; > symbol3 i=j value='=' cv=g; > symbol4 i=j value='\$' cv=pk; > symbol5 i=j value='&' cv=o; > symbol6 i=j value='%' cv=p; > > %end; > %else %do; > %let byit=%str(by class_var;); > %let plotit=%str(plot &y._logit*_x_ /regeqn;); > symbol i=rlclm95 > value=diamond > cv=r > ci=b > co=g > ; > %end; > > proc gplot data=&odsn; > &byit > &plotit > run; > quit; > > proc datasets lib=work; > delete _&idsn _v&idsn(memtype=view) > ; > quit; > %mend logit_plot; > > %logit_plot(idsn=t1,odsn=all,y=y,x=x1 x3 x4, group=100, > combined=0,standard=n) ```

Back to: Top of message | Previous page | Main SAS-L page