Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

confidence intervals in python

import numpy as np
import scipy.stats as st

#define sample data
data = [12, 12, 13, 13, 15, 16, 17, 22, 23, 25, 26, 27, 28, 28, 29]

#create 95% confidence interval for population mean weight
st.t.interval(alpha=0.95, df=len(data)-1, loc=np.mean(data), scale=st.sem(data)) 

(16.758, 24.042)
Comment

plot confidence interval matplotlib

from matplotlib import pyplot as plt
import numpy as np

#some example data
x = np.linspace(0.1, 9.9, 20)
y = 3.0 * x
#some confidence interval
ci = 1.96 * np.std(y)/np.sqrt(len(x))

fig, ax = plt.subplots()
ax.plot(x,y)
ax.fill_between(x, (y-ci), (y+ci), color='b', alpha=.1)
Comment

python plot confidence interval

sns.lineplot(data=fmri, x="timepoint", y="signal", hue="event")
Comment

PREVIOUS NEXT
Code Example
Python :: pytorch argmax 
Python :: django abstractuser fields 
Python :: default arguments 
Python :: rename a column 
Python :: run python in background ubuntu 
Python :: yahoo finance python chart 
Python :: save python plot 
Python :: python string index 
Python :: pygame get rect 
Python :: how to replace a character in python 
Python :: login python code 
Python :: linux python virtual environment 
Python :: pandas 
Python :: python oops 
Python :: remove dict python 
Python :: how to check if a value is nan in python 
Python :: semaphore in python 
Python :: how to use loop in python 
Python :: numpy split 
Python :: counter method in python 
Python :: how to read mysql table in python 
Python :: inline for python 
Python :: matplotlib subplots share x axis 
Python :: quiz game in python 
Python :: copy multiple files from one folder to another folder 
Python :: python 3.9 release date 
Python :: partition python 
Python :: np.unique 
Python :: do while loop python 
Python :: python array spread 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =