Issue
I am trying to find bootstrap 95% confidence intervals for a small set of data, but when I try it, it says that my "list object has no attribute sample". I am not sure what list they are talking about, and how do I add that attribute?
I tried doing 1000 bootstrap samples with replacing the data each time for a very small, 9-number set of data. However, when I tried using the CreateBootstrapMeans function in In[84], it says that my "list object has no attribute 'sample'". I am not sure what this means.
I later need to use the np.percentile function to find the 95% confidence intervals, but I cannot do that until this part gets sorted out.
Please help in whatever way you can! I am also sorry if this is a stupid question, I am a beginner in coding!
Solution
you have to replace the line where you define d
with:
d = np.random.choice(data, n, replace=True)
this because list
object has no method named sample
EDIT:
also the return
has to be placed at the end of the for
loop and not inside it.
Answered By - Salvatore Daniele Bianco
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.