## Saturday, 25 January 2014

### Ecostats Workshop - Mixture Models

To all those coming to the UNSW Ecostats workshop on Mixture models,

Date: 31st January 2-3pm
Venue: Computer Lab Room 640...somewhere in Sydney =D
Topic: A very very short introduction to mixture models with a very very short taste of how to implement them in R
MC: Francis Hui (PhD student; UNSW School of Maths and Stats)

Please note that this blog is NOT to be used for indicating that you want to attend. That should have been done via the email sent out by Richard Kingsford earlier.

Unfortunately, blogger does not allow one to attach thing that aren't videos or images, so I've instead provided links to the material I shall be using.

Slides: https://www.dropbox.com/s/0ibha7nk2u8k22u/minilecturev1.pdf?dl=0
R script: https://www.dropbox.com/s/kg3bcyt65ec6nhl/scripts_cutdown.R?dl=0

Thank you.

Yours non-significantly,
FH

1. Code for crab cluster color gradient:

data(crabs)

declare.mod = FLXMRglmfix(varFix = F)
fitk2 = flexmix(CL ~ RW, data = crabs, k = 2, model = declare.mod)

crab.out = data.frame(crabs\$sp, crabs\$sex, round(posterior(fitk2),2))

col.scheme = colorRampPalette(c("red", "blue"))(101)

plot(crabs\$RW, crabs\$CL, xlab = "Rear Width", ylab = "Carapace length", main =
"Scatterplot of Carapace length vs. Rear Width", col = col.scheme[100*crab.out\$X1 + 1], pch = 19)
curve(parameters(fitk2)[1,1]+parameters(fitk2)[2,1]*x, add = T, col = "blue",
lwd = 2)
curve(parameters(fitk2)[1,2]+parameters(fitk2)[2,2]*x, add = T, col = "red",
lwd = 2)

2. to do a cluster analysis using brain-body allometry:
resp=log(Animals)
fitMV.animalk2 <- mvnormalmixEM(resp, k = 2, arbmean = T, arbvar = T)

3. plot(Animals\$body, Animals\$brain, log = "xy", xlab = "Body weight (kg)", ylab = "Brain weight (g)")