## Query about implementing Linear Discriminant Analysis

Hi, I am trying to implement LDA on some fMRI data. Trying to do it myself rather that using a package as I'd like to understand whats going on under the bonnet as it were.

I have obtained a weight vector, $\mathbf{w}$, according to the formula

$\mathbf{w} \propto \mathbf{\Sigma}^{-1}_{w} (\mathbf{m}_{2} - \mathbf{m}_{1})$

where $\mathbf{\Sigma}^{-1}_{w}$ is the (inverse of the) total within-class covariance matrix and $\mathbf{m}$ denotes the mean of a class (class 2 and 1 in this case)

I can renormalise $\mathbf{w}$ to counter any numerical issues, since it is the direction and not the magnitude of this vector that is important. So far so good.

I should then be able to find a discriminant $c$, such that a new datum $\mathbf{x}$ is classified as belong to class 1 if $\mathbf{w} \cdot \mathbf{x} > c$ and class 2 otherwise.

I see intuitively that if the prior on each class is the same then (I think) $c = 1/2 \cdot (\mathbf{w} \cdot \mathbf{m}_{1} + \mathbf{w} \cdot \mathbf{m}_{2})$

Is that correct? But more importantly, is there a simple but principled way to establish $c$ in the case of asymmetric priors?

Many thanks in advance, MD