mardi 1 juin 2021

How to sample from a distribution generated by custom data in R?

My Issue: I have a dataset of continuous values, but need to generate more "artificial" data points so that I have enough power to do some analyses.

My proposed solution: Sample from the density distribution of the dataset by dividing the dataset into bins of equal width and then sampling a random number from that bin's range based on its height. Something like this:

enter image description here

Issue is I dont know what bin size to choose, etc. Is there a function/package in R that takes in my data vector and automatically generates new data that matches the vector's distribution?




Aucun commentaire:

Enregistrer un commentaire