Skip to content

Commit

Permalink
Addresses a slient computation hiccup with + log(phat[k] / phat[K]) (
Browse files Browse the repository at this point in the history
  • Loading branch information
coatless committed Oct 29, 2020
1 parent e625257 commit e59e48e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: msos
Type: Package
Title: Data Sets and Functions Used in Multivariate Statistics: Old School by John Marden
Version: 1.1.1
Version: 1.1.2
Authors@R: c(
person("John", "Marden", role = c("aut", "cph"),
email = "jimarden@illinois.edu"),
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# msos 1.1.2 - Hotfix - "Old School Unbalanced"

## CHANGES

- Fixed `lda()`'s computation for unbalanced data sets. (thanks [Trevor Park](https://stat.illinois.edu/directory/profile/thp2))

# msos 1.1.1 - Hotfix - "Old School Revitalized"

## CHANGES
Expand Down
3 changes: 1 addition & 2 deletions R/lda.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ lda <-
ak <- NULL
vi <- solve(v)
for (k in 1:K) {
c0 <- -(1 / 2) * (m[k, ] %*% vi %*% m[k, ] - m[K, ] %*% vi %*% m[K, ])
+log(phat[k] / phat[K])
c0 <- -(1 / 2) * (m[k, ] %*% vi %*% m[k, ] - m[K, ] %*% vi %*% m[K, ]) + log(phat[k] / phat[K])
ck <- c(ck, c0)
a0 <- vi %*% (m[k, ] - m[K, ])
ak <- cbind(ak, a0)
Expand Down

0 comments on commit e59e48e

Please sign in to comment.