User:Trettels:Session 8 - 04FEB

From Computational Statistics (CSE383M and CS395T)
Jump to navigation Jump to search

In Class Activity

Worked with: Tameem, Kai, and Rcardenas

Matlab code

For determining probability that the given data was from either a normal distribution or a Student distribution.

data=load('Events20130204.txt','ascii');
mu=mean(data);
sig=std(data);

n_pdf=normpdf(data,mu,sig);
prob_norm=(sum(log(n_pdf)));

t_mu=2;
t_sig=1.2;
t_nu=5;
zscore_data=(data-t_mu)/t_sig;
t_pdf=1/t_sig*tpdf(zscore_data,t_nu);
prob_t=(sum(log(t_pdf)));

ratio=prob_norm/prob_t;

Results

* Probability the data was drawn from a normal distribution (<math>\mu=2.2368</math>, <math>\sigma=2.2364</math>): <math>e^{-2223.3}</math>
* Probability that the data was drawn from a Student's distribution (<math>\mu=2</math>, <math>\sigma=1.2</math>, <math>\nu=5</math>): <math>e^{-2208.2}</math>
* Ratio of probability that the data is from a student distribution to that it was drawn from a normal distribution: 1.0069

Back to TrettelS Index