File:Bootstrapped Probability Density of the Mean of a Sample.png
From Wikimedia Commons, the free media repository
Jump to navigation
Jump to search
Bootstrapped_Probability_Density_of_the_Mean_of_a_Sample.png (640 × 480 pixels, file size: 31 KB, MIME type: image/png)
File information
Structured data
Captions
Summary[edit]
DescriptionBootstrapped Probability Density of the Mean of a Sample.png |
English: Bootstrap distribution |
Date | |
Source | Own work |
Author | Biggerj1 |
PNG development InfoField | This plot was created with Matplotlib. |
Source code InfoField | Python codeimport numpy as np
#generate random examples for computing the confusion matrix
true_mean=0.5
true_scale=0.5
y_true = np.random.normal(loc=true_mean, scale=true_scale, size=100)
print("non-bootstrapped point estimate mean", np.mean(y_true), "standard error", np.std(y_true)/np.sqrt(len(y_true)))
def bootstrap(data, statistic, boostrap_size, num_boostrap_samples=1000):
indices=range(len(data))
statistic_values=[]
for i in range(num_boostrap_samples):
choice= np.random.choice(indices, size = boostrap_size, replace = True)
y_true = data[choice]+np.random.normal(loc=0, scale = 0.3, size=boostrap_size)
statistic_value = statistic(y_true)
statistic_values.append(statistic_value)
return np.average(statistic_values, axis = 0), np.std(statistic_values, axis = 0), statistic_values
mean_statistic, std_statistic, statistic_values= bootstrap(y_true, np.mean, boostrap_size= int(len(y_true)))
print("bootstrapped estimate for the mean", mean_statistic)
print("bootsrapped estimate for the standard error of mean", std_statistic)
a=true_mean
b=true_scale/np.sqrt(len(y_true)) #np.std(y_true, ddof=1)/np.sqrt(len(y_true))
import matplotlib.pyplot as plt
plt.hist(statistic_values, density=True, bins=50, label = "(Smooth) bootstrap density of mean values")
xs=np.linspace(0.2,0.8, num = 100)
#plt.plot(xs, 1/(np.sqrt(2*np.pi)*std_statistic)*np.exp(-(xs-mean_statistic)**2/(2*std_statistic**2)), label = "(Smooth) bootstrap distribution of mean values")
plt.vlines(np.mean(y_true), 0,9, color = "red", label = "Estimate mean value")
plt.plot(xs, 1/(np.sqrt(2*np.pi)*b)*np.exp(-(xs-a)**2/(2*b**2)), label = "Ground truth normal distribution of sample mean values")
plt.xlabel("Mean value")
plt.ylabel("Proability density")
plt.legend()
plt.show()
|
Licensing[edit]
I, the copyright holder of this work, hereby publish it under the following license:
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 21:14, 19 September 2021 | 640 × 480 (31 KB) | Biggerj1 (talk | contribs) | Uploaded own work with UploadWizard |
You cannot overwrite this file.
File usage on Commons
There are no pages that use this file.
File usage on other wikis
The following other wikis use this file:
- Usage on de.wikipedia.org
Metadata
This file contains additional information such as Exif metadata which may have been added by the digital camera, scanner, or software program used to create or digitize it. If the file has been modified from its original state, some details such as the timestamp may not fully reflect those of the original file. The timestamp is only as accurate as the clock in the camera, and it may be completely wrong.
Software used | |
---|---|
Horizontal resolution | 39.37 dpc |
Vertical resolution | 39.37 dpc |
Structured data
Items portrayed in this file
depicts
19 September 2021
image/png
720df6f10d360f5b085840cde6e78d9802b8884c
31,675 byte
480 pixel
640 pixel
Hidden categories: