**Bootstrapping Logistic Regression**

Generates m new training data sets. Each new training data set picks a sample of observations with replacement (bootstrap sample) from original data set. By sampling with replacement, some observations may be repeated in each new training data set. The m models are fitted using the above m bootstrap samples and combined by averaging the output (for regression).

%MACRO boot (data=,target=, ivars=, n=,outfile=);

%DO i=1 %to &n;

data bootstrap;

choice = INT(RANUNI(23456+&i)*n)+1;

set &data POINT = choice NOBS = n;

ch = choice;

j+1;

IF j > n then stop;

run;

ods output ParameterEstimates = mest;

proc logistic data=bootstrap descending;

model &target= &ivars/ selection=stepwise stb;

run;

ods output close;

data mest;

set mest;

helper = abs (StandardizedEst);

run;

proc rank data = mest descending tied = low out=mest (drop= helper);

var helper;

ranks Importance;

run;

proc append base=&outfile data=mest;

%end;

proc means data= &outfile MIN MEAN MEDIAN MAX;

where variable ne 'Intercept';

class variable ;

var Importance;

run;

%MEND boot;

%boot(data=mydata,target= bad, ivars=var1 var2 var3, n=10,outfile=res);

Pls can you provide this in Base SAS codes and not macros?

ReplyDeleteThanks.

Pls can you provide this in Base SAS codes and not macros?Thanks.

ReplyDeletehello,

ReplyDeletei really appreciate ur great work.

but i would like to know how would u specify categorical variable in proc logistic part of this marcro. there is no class statement O.o

You can add class statement and define your variable there and make sure adding that categorical variable in the right hand side of model = statement.

DeleteHi, please can you tell me the importance of ranking instead of original ones?

ReplyDelete