Santiago Barreda
Assistant Professor, Department of Linguistics, UC Davis

Main Research Vignettes CV phonTools Statistics Links

 


ldboundary [phonTools]

 

Given two mean vectors and a covariance matrix (and optional prior probabilities), this function will return the slope and intercept of the boundary line between the two categories. This assumes linear boundaries and the same covariance matrix for each category (as in Linear Discriminant Analysis).

 

 

 

Code used to generate examples:


par (mfrow = c(1,2),mar = c(4,4,1,1)) ## create two groups with the same covariance patterns group1 = rmvtnorm (200, means= c(0,0), k=2, sigma = -.4) group2 = rmvtnorm (200, means= c(2.5,2.5), k=2, sigma = .2) covariance = (var (group1) + var (group2)) / 2 ## plot groups plot (group1, col = 2, pch = 16, ylim = c(-2,5), xlim = c(-2,5), xlab='Dim. 1', ylab='Dim. 2') points (group2, col = 4, pch = 16) ## plot groups and boundary line between categories. plot (group1, col = 2, pch = 16, ylim = c(-2,5), xlim = c(-2,5), xlab='Dim. 1', ylab='Dim. 2') points (group2, col = 4, pch = 16) ldboundary (c(0,0), c(3,3), covariance, add = TRUE, lwd = 3)