Gaussian वितरण

R में Mixture Models

Victor Medina

Researcher at The University of Edinburgh

Gender डेटासेट पर Mixture मॉडल

R में Mixture Models

Mixture मॉडल फिट करने के पैकेज

  • mixtools
    • Poisson वितरण लागू नहीं है।
  • bayesmix
    • Bayesian inference इस कोर्स के दायरे से बाहर है।
  • EMCluster
    • केवल Gaussian वितरण।
  • flexmix
    • हमें चाहिए सभी वितरण उपलब्ध, और जटिल मॉडलों के लिए लचीलापन देता है।
R में Mixture Models

Gaussian वितरण के गुण

Mean

Standard deviation

R में Mixture Models

Gaussian वितरण से सैंपल

Gaussian वितरण से सैंपल जनरेट करने के लिए:

  • rnorm(n, mean, sd)

उदाहरण: mean 10 और standard deviation 5 वाले Gaussian वितरण से 100 मान जनरेट करें

 

> population_sample <- rnorm(n = 100, mean = 10, sd = 5)
> head(population_sample)
[1]  6.248874  9.564190 16.006521  9.139647 10.114969 16.423538
R में Mixture Models

Mean का अनुमान

  • mean और standard deviation नहीं पता, सिर्फ observations पता हैं
    • इन्हें observations से estimate करना होगा
  • mean के लिए sample mean निकाल सकते हैं

 

> mean_estimate <- mean(population_sample)
10.35759
R में Mixture Models

sd estimate करने के लिए यह प्रक्रिया करें

$$value_i\rightarrow (. -mean\_estimate)\rightarrow (.)^2\rightarrow mean (.)\rightarrow \sqrt{(.)}$$

> population_sample %>%  
+   subtract(mean_estimate) %>%
+   raise_to_power(2) %>% mean() %>% sqrt()
5.318641
  • sd फंक्शन का उपयोग करते हुए
> standard_deviation_estimate <- sd(population_sample)
> standard_deviation_estimate
5.345435
R में Mixture Models

अनुमानित Gaussian वितरण का विज़ुअलाइज़ेशन

# सैंपल को डेटा फ्रेम में बदलें
population_sample <- data.frame(x = population_sample)

# हिस्टोग्राम प्लॉट करें
ggplot(data = population_sample) + 
   geom_histogram(aes(x = x, y = ..density..)) +
   stat_function(geom = "line", 
                 fun = dnorm, 
                 args = list(mean = mean_estimate, 
                             sd = standard_deviation_estimate))
R में Mixture Models

R में Mixture Models

अभ्यास करते हैं!

R में Mixture Models

Preparing Video For Download...