Description Usage Arguments Value Author(s) References Examples

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.

1 | ```
ldboundary (mean1, mean2, covariance, prior1 = .5, prior2 = .5, add = F, ...)
``` |

`mean1` |
A mean vector for category 1, must contain 2 elements. |

`mean2` |
A mean vector for category 2, must contain 2 elements. |

`covariance` |
A 2x2 covariance matrix for both distributions. |

`prior1` |
The prior probability of category 1. |

`prior2` |
The prior probability of category 2. |

`add` |
If TRUE, the boundary line is added top the plot. |

`...` |
Additional parameters are passed to the internal call of the line plotting function, in the event that add = T. |

The slope and intercept of the boundary line are returned.

Santiago Barreda <sbarreda@ucdavis.edu>

http://en.wikipedia.org/wiki/Linear_discriminant_analysis https://onlinecourses.science.psu.edu/stat557/book/export/html/35

1 2 3 4 5 6 7 8 9 | ```
## create two groups with the same covariance patterns
group1 = rmvtnorm (200, means= c(0,0), k=2, sigma = -.4)
group2 = rmvtnorm (200, means= c(3,3), k=2, sigma = -.4)
covariance = (var (group1) + var (group2)) / 2
## plot groups and boundary line between categories.
plot (group1, col = 2, pch = 16, ylim = c(-2,5), xlim = c(-2,5))
points (group2, col = 4, pch = 16)
ldboundary (c(0,0), c(3,3), covariance, add = TRUE)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.