Open In App

sciPy stats.sem() function | Python

Last Updated : 18 Feb, 2019
Comments
Improve
Suggest changes
Like Article
Like
Report
scipy.stats.sem(arr, axis=0, ddof=0) function is used to compute the standard error of the mean of the input data.
Parameters : arr : [array_like]Input array or object having the elements to calculate the standard error. axis : Axis along which the mean is to be computed. By default axis = 0. ddof : Degree of freedom correction for Standard Deviation. Results : standard error of the mean of the input data.
Example: Python3 1==
# stats.sem() method 
import numpy as np
from scipy import stats
 
 
arr1 = [[20, 2, 7, 1, 34],
        [50, 12, 12, 34, 4]]

arr2 = [50, 12, 12, 34, 4]

print ("\narr1 : ", arr1)
print ("\narr2 : ", arr2)

print ("\nsem ratio for arr1 : ", 
       stats.sem(arr1, axis = 0, ddof = 0))

print ("\nsem ratio for arr1 : ", 
       stats.sem(arr1, axis = 1, ddof = 0))

print ("\nsem ratio for arr1 : ", 
       stats.sem(arr2, axis = 0, ddof = 0)) 
Output :
arr1 :  [[20, 2, 7, 1, 34], [50, 12, 12, 34, 4]]

arr2 :  [50, 12, 12, 34, 4]

sem ratio for arr1 :  [10.60660172  3.53553391  1.76776695 11.66726189 10.60660172]

sem ratio for arr1 :  [5.62423328 7.61892381]

sem ratio for arr1 :  7.618923808517841

Next Article
Practice Tags :

Similar Reads