I'm trying to generate a list of std_error
by calling all the std_dev
_of_sample_means by its [i]
index and dividing that by its respective [i^.5]
, but I'm not sure how to properly call the [i]
in the std_dev_of_sample_means
. thanks!
sample_sizes2 = np.arange(1,1001,100)
mean_of_sample_means = []
std_dev_of_sample_means = []
for i in sample_sizes2:
probabilities=make_throws(200,i)
mean_of_sample_means.append(np.mean(probabilities))
std_dev_of_sample_means.append(np.std(probabilities))
std_error = std_dev_of_sample_means[i]/(i^.5)
print(std_dev_of_sample_means)
print(std_error)
I hope this is what you are looking for :) Do let me know if i misinterpreted your question
sample_sizes2 = np.arange(1,1001,100)
mean_of_sample_means = []
std_dev_of_sample_means = []
std_errors = []
for i in sample_sizes2:
probabilities=make_throws(200,i)
mean_of_sample_means.append(np.mean(probabilities))
std_dev_of_sample_means.append(np.std(probabilities))
std_errors.append(std_dev_of_sample_means[-1]/(i**.5)) # previously it was i^.5
print(std_dev_of_sample_means)
print(std_errors)
std_dev_of_sample_means[-1]
refers to the value of the last element in the list (because the [-1]
access the last value in the list). In this case it is the value that you just appended to std_dev_of_sample_means
Edit 1: changed i^.5
to i**.5
. You were using ^ when you want a ** to raise a value to a power. Python interprets this as an xor.