Skip to content

Commit

Permalink
optionally use rfunctions::geninv instead of MASS::ginv for increased…
Browse files Browse the repository at this point in the history
… performance
  • Loading branch information
daroczig committed Jun 14, 2014
1 parent d0d472d commit ac185e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ License: AGPL-3
Depends:
Matrix,
MASS
Suggests:
rfunctions
6 changes: 4 additions & 2 deletions R/unbalanced.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ WithinTransformation1c <- function(i = m[, 1], j = m[, 2], t = m[, 3], value = m
Qa <- t(D2) %*% Da

## geninv of Qa
Qai <- ginv(as.matrix(Qa))
if (require('rfunctions'))
Qai <- geninv(as.matrix(Qa))
else
Qai <- ginv(as.matrix(Qa))
Qai <- Matrix(Qai)

## full value (added NA)
Expand All @@ -58,7 +61,6 @@ WithinTransformation1c <- function(i = m[, 1], j = m[, 2], t = m[, 3], value = m
## this should work on smaller matrices (formula 22)
## Pa <- (It - (D1 %*% dN2i %*% t(D1))) - (Da %*% Qai %*% t(Da))


fia <- Qai %*% t(Da) %*% value

t <- as.numeric(factor(t))
Expand Down

0 comments on commit ac185e6

Please sign in to comment.