This homework (see original statement here) is a freeform exercise that consists in applying Bayes decision rule to Normally distributed data. The next homework will consists in a peer review of this homework.

Here is a link to a lab on Bayes Classifier that you might find helpful. Please use it as a reference.

Enjoy, Raj..

Here is a link for a theoretical and practical assignment on Bayes Classifier.

--Ralazrai 21:55, 17 February 2010 (UTC)

**Generating correlated multi-variate normal (MVN) data:**
I don't know if anyone else ran into this issue, but FreeMat doesn't know how to generate MVN random samples. The solution is to generate independent standard normal data points and perform a linear transformation. Refer to the link below for details:

To make matters worse, FreeMat cannot perform Cholesky decomposition. Two ways to get the desired results:

- Instead of starting with the covariance matrix and taking the square root, start with the upper triangular matrix A and take A'A as the covariance. (Prof. Boutin's suggestion).
- Perform singular value decomposition using FreeMat's "svd" command on the covariance matrix to get [u s v]. Then $ B = u \sqrt{s} v $ would serve as the square root.

The transformed data, using either A or B, should have be the desired statistics (please verify!).

-Satyam

## Turn It In

So... where do we turn this thing in? Do we upload it to Mimi's dropbox? Anybody know? Thanks!

Pritchey 15:33, 26 February 2010 (UTC)

- In my Rhea dropbox, as the peer review system is not quite ready yet. --Mboutin 09:48, 1 March 2010 (UTC)

## R packages useful for this homework assignment

Don't know yet anybody is using R for this homework. Compared with FreeMat and Matlab, I think R is in between of them. R has more useful packages compared with FreeMat, but not as powerful as Matlab for general purpose scientific computing, except in the aspect of Statistic computing.

Until now, I'm still having problems with drawing the decision boundary in R and calculating the Characteristic function of F_T(\omega) in a simple way (i.e. using prod function together with integrate). Other than that, I'll list the packages/functions here that I think would be useful for finishing this homework in R.

1. sample:http://stat.ethz.ch/R-manual/R-patched/library/base/html/sample.html, for randomly generating data from different classes.

2. rnorm,dnorm,pnorm: http://stat.ethz.ch/R-manual/R-patched/library/stats/html/Normal.html, for dealing with 1D normal distribution.

3. mvtnorm package: http://stat.ethz.ch/CRAN/web/packages/mvtnorm/index.html, for multivariate normal distribution.

4. elliptic package: http://stat.ethz.ch/CRAN/web/packages/elliptic/index.html, for integral with complex numbers.

5. clusterGeneration package: http://stat.ethz.ch/CRAN/web/packages/clusterGeneration/clusterGeneration.pdf, for generating multidimensional covariance matrix.

--Yuanl 16:23, 28 February 2010 (UTC)

For calculating covariance in Freemath as I don’t want to recreate the wheel I used cov function in Matlab. If you don’t know how to use it just type “edit cov” in Matlab and then copy the whole function as a new function to your freemath program; I don’t know if it’s acceptable or not but of course it works.

-Golsa