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

Dear SAS-community,

 

I would like to sample from an estimated kernel density. So essentially I have observations on some key variables, for which i generate estimated kernel densities. This has succeeded so far.

 

The next step is to redraw new samples from the estimated kernel densities. Does anyone have a good idea on how to do this?

 

This following example from stack exchange shows how to do it in R (see "best answer"):

https://stats.stackexchange.com/questions/321542/how-can-i-draw-a-value-randomly-from-a-kernel-densi...

 

 

Using the code i generate KDE:

 

proc KDE data=dat;
	univar variableA / out=EstimatedKD;
run;

i obtain the relevant levels using "out".

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Sampling from a kernel densty is equivalent to the "Smooth Bootstrap." Since PROC KDE uses a normal kernel, you would use the kernel bandwidth as the standard deviation of the normal distribution placed around each observation. You randomly select an observation (say, x_i) and then randomly generate a point p_i ~ N(x_i, delta), where delta is the KDE bandwidth.

 

For details and a SAS program, see "The smooth bootstrap method in SAS"

View solution in original post

2 REPLIES 2
Rick_SAS
SAS Super FREQ

Sampling from a kernel densty is equivalent to the "Smooth Bootstrap." Since PROC KDE uses a normal kernel, you would use the kernel bandwidth as the standard deviation of the normal distribution placed around each observation. You randomly select an observation (say, x_i) and then randomly generate a point p_i ~ N(x_i, delta), where delta is the KDE bandwidth.

 

For details and a SAS program, see "The smooth bootstrap method in SAS"

bjarkeahm
Fluorite | Level 6

Thank you! That seems like the optimal solution.

sas-innovate-2024.png

 

Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.

 

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 

 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 447 views
  • 2 likes
  • 2 in conversation