Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Challenge: Estimate Parameters of Chi-square Distribution | Estimation of Population Parameters
Advanced Probability Theory

book
Challenge: Estimate Parameters of Chi-square Distribution

Taak

Swipe to start coding

Suppose that we have samples from the Chi-square distribution. We must determine the parameter K of this distribution, which represents the number of degrees of freedom.
We know that the mathematical expectation of the Chi-square distributes value is equal to this parameter K.
Estimate this parameter using the method of moments and the maximum likelihood method. Since the number of degrees of freedom can only be discrete, round the resulting number to the nearest integer.
Your task is:

  1. Calculate the mean value over samples using .mean() method.
  2. Use .fit() method to get maximum likelihood estimation for the parameter.

Oplossing

import pandas as pd
from scipy.stats import chi2

samples = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/Advanced+Probability+course+media/chi2_samples.csv', names=['Value'])

# Method of Moments estimation
df_moments = samples.mean()['Value']
print('Estimated degrees of freedom (Method of Moments):', df_moments)
print('Rounded estimation(Method of Moments):', round(df_moments))

# Maximum Likelihood estimation
df_mle = chi2.fit(samples)[0]
print('Estimated degrees of freedom (Maximum Likelihood):', df_mle)
print('Rounded estimation (Maximum Likelihood):', round(df_mle))

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 3. Hoofdstuk 3
single

single

import pandas as pd
from scipy.stats import chi2

samples = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/Advanced+Probability+course+media/chi2_samples.csv', names=['Value'])

# Method of Moments estimation
df_moments = samples.___()['Value']
print('Estimated degrees of freedom (Method of Moments):', df_moments)
print('Rounded estimation(Method of Moments):', round(df_moments))

# Maximum Likelihood estimation
df_mle = chi2.___(samples)[0]
print('Estimated degrees of freedom (Maximum Likelihood):', df_mle)
print('Rounded estimation (Maximum Likelihood):', round(df_mle))

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

some-alt