0% found this document useful (0 votes)
3K views3 pages

Basics of Statistics and Probability Handsons

The document provides code snippets for functions to calculate various probability and statistics measures and distributions. It includes functions to calculate measures of central tendency, dispersion, and position for an array; combinations and permutations; solutions to probability questions about dancers, binomial distribution, Poisson distribution, a spinner, and an accident; and a chi-squared test with returned test statistic, degrees of freedom, p-value, and result. The document also invites the reader to join a Telegram channel for more on basics of statistics and probability hands-ons.

Uploaded by

harshit kuchhal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3K views3 pages

Basics of Statistics and Probability Handsons

The document provides code snippets for functions to calculate various probability and statistics measures and distributions. It includes functions to calculate measures of central tendency, dispersion, and position for an array; combinations and permutations; solutions to probability questions about dancers, binomial distribution, Poisson distribution, a spinner, and an accident; and a chi-squared test with returned test statistic, degrees of freedom, p-value, and result. The document also invites the reader to join a Telegram channel for more on basics of statistics and probability hands-ons.

Uploaded by

harshit kuchhal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Join the channel if you haven’t joined yet https://t.

me/fresco_milestone ( @fresco_milestone )

Basics of Statistics and Probability Hands-Ons

Probability and Statistics -1

import numpy as np

from scipy import stats

import statistics

def measures(arr):

mean=round(np.mean(arr),2)

median=round(np.median(arr),2)

std_deviation=round(np.std(arr),2)

variance=round(np.var(arr),2)

mode=round(statistics.mode(arr),2)

iqr=round(stats.iqr(arr),2)

return mean,median,std_deviation,variance,mode,iqr

Probability and Statistics -2

from itertools import combinations

from itertools import permutations

import numpy as np

import math

def comb_perm(arr):

no_of_comb= len(list(combinations(arr,2)))

no_of_perm= len(list(permutations(arr,2)))

return no_of_comb,no_of_perm
Join the channel if you haven’t joined yet https://t.me/fresco_milestone ( @fresco_milestone )

Probability and Statistics -3

import math

def dancers():

ans= 200

return int(ans)

Probability and Statistics -4

from scipy import stats

def binomial():

ans = 0.97

return ans

Probability and Statistics -5

from scipy import stats

def poisson():

ans= 0.03

return ans

Probability and Statistics -6

from scipy import stats

def spinner():

ans= 0.5

return ans
Join the channel if you haven’t joined yet https://t.me/fresco_milestone ( @fresco_milestone )

Probability and Statistics -7

from scipy import stats

def accident():

ans= 0.26

return ans

Probability and Statistics -8

from scipy.stats import chi2_contingency

from scipy.stats import chi2

def chi_test():

stat= 23.57

dof= 12

p_val= 0.02

res= "Reject the Null Hypothesis"

return stat,dof,p_val,res

You might also like