mardi 16 mars 2021

How to calculate probability of a condition (>X) from a random sample in a histogram/dataframe in R?

So I have a full dataset (DATA) of values with hundreds of columns and numerous rows. I have created a subset dataframe (SAMPLES) including only the values (from columns X:X and row 5) that I want to randomly sample from.

SAMPLES <- DATA[c(100:200), 5] 

I can print this dataset and see all 100 values for each item in row 5.

What I want to actually accomplish is to figure out the probability that a value randomly sampled from this dataset is > 5.

I can create a histogram from this dataset

hist(SAMPLES)

and see that the distribution of my values is in a normal distribution. But I am unsure as to how to randomly sample from this dataset to determine the probability of a value being > 5.

If anyone could point me in the right direction for which functions I should be looking at it would be greatly appreciated, I've looked through sample() and I can't see how to do it.




Aucun commentaire:

Enregistrer un commentaire