BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
SBuc
Obsidian | Level 7

Dear Braintrust,

I am analyzing data to predict an outcome in 600 calves (lung lesions 0/1) based on clinical signs observed in calves.

I used Proc logistic to obtain the regression coefficient. I want to make some prediction rules based on these coefficients.

however, I want to take into account overoptimistic weights and I therefore want to have robust estimates of these regressions coefficients.

I want to know if there is any macro to be able to obtain distribution of these regression coefficients based on bootstrapped samples.

Many thanks!

 

basic code I used:

proc logistic data=final;

class x1 x2 x3 x4;

model lesion = x1 x2 x3 x4;

run;

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

For a general overview of how to bootstrap in SAS, see "Compute a bootstrap confidence interval in SAS"

 

To resample from the data to form the bootstrap samples:

1) Use PROC SURVEYSELECT to draw B samples with replacement from your data. You will obtain one SAS data set that has a REPLICATE variable that identifies the B samples:

proc surveyselect data=final NOPRINT seed=12345
     out=SAMPLES
     method=urs              /* resample with replacement */
     samprate=1              /* each bootstrap sample has N observations */
     OUTHITS                 
     reps=10;       /* generate this many bootstrap resamples */
run;

2) Use a BY REPLICATE statement in your PROC LOGISTIC code:

proc logistic data=SAMPLES;
by REPLICATE;
class x1 x2 x3 x4;
model lesion = x1 x2 x3 x4;
run;

3. To analyze the bootstrap estimates, follow the ideas in "Simulate many samples from a logistic regression model."

View solution in original post

1 REPLY 1
Rick_SAS
SAS Super FREQ

For a general overview of how to bootstrap in SAS, see "Compute a bootstrap confidence interval in SAS"

 

To resample from the data to form the bootstrap samples:

1) Use PROC SURVEYSELECT to draw B samples with replacement from your data. You will obtain one SAS data set that has a REPLICATE variable that identifies the B samples:

proc surveyselect data=final NOPRINT seed=12345
     out=SAMPLES
     method=urs              /* resample with replacement */
     samprate=1              /* each bootstrap sample has N observations */
     OUTHITS                 
     reps=10;       /* generate this many bootstrap resamples */
run;

2) Use a BY REPLICATE statement in your PROC LOGISTIC code:

proc logistic data=SAMPLES;
by REPLICATE;
class x1 x2 x3 x4;
model lesion = x1 x2 x3 x4;
run;

3. To analyze the bootstrap estimates, follow the ideas in "Simulate many samples from a logistic regression model."

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 4596 views
  • 0 likes
  • 2 in conversation