Create "samples" with partial data

1

I am working with a normal distribution where 10% of the data is above a length0 and 5% below a length1.

I have been trying to use the functions sample and dnorm in different ways but since I do not have the minimum and maximum values or the average of them, the samples do not give me much confidence. Is there any form / function that allows me to generate a reliable sample with this data?

    
asked by Fumofu 02.11.2017 в 11:11
source

1 answer

0

I will answer you so as not to leave this question "hanging". The use of sample() for what you are looking for can help you as long as you understand that you need to establish the limits of any sample. In your case if your universe goes from 0 to 20 and you are looking for 10% of cases between 0 and 4, 85% between 5 and 10 and 5% for values greater than 10. You can build a sample of 100 values of the following Form:

  muestra <- c(sample(0:4,5,replace=TRUE),
             sample(5:10,85,replace=TRUE),
             sample(11:20,10,replace=TRUE))

If we plot the sample:

plot(muestra)
smoothingSpline = smooth.spline(muestra, spar=0.8)
lines(smoothingSpline, col='red', lwd=3)

    
answered by 06.11.2017 в 02:44