naiveRandRUV Error When k is 1
1
1
Entering edit mode
Dario Strbenac ★ 1.5k
@dario-strbenac-5916
Last seen 5 days ago
Australia

The documentation doesn't specify what values of k are admissible, and k = 1 seems like a reasonable user choice, but results in an error, when using the example data used by the package.

nsY <- naiveRandRUV(Y, cIdx, nuCoeff = 0, k = 1)
Error in svdYc$u[, 1:k] %*% diag(svdYc$d[1:k]) :
  non-conformable arguments

Surprisingly, a value such as k = 2.5 does not produce any error.

nsY <- naiveRandRUV(Y, cIdx, nuCoeff = 0, k = 2.5)

There's also no description in the documentation how naiveRandRUV handles NA values.

> Y[2, 2] <- NA
> nsY <- naiveRandRUV(Y, cIdx, nuCoeff=0, k=2)
>

It does not produce any error, but are the results correct ? Are there plans to improve the user documentation and data input checking in a future version ?

RUVNormalize Subsetting • 1.4k views
ADD COMMENT
1
Entering edit mode
@laurentjacob-7905
Last seen 9.5 years ago
France

Dear Dario,

Thank you for the heads up on k=1. This should be admissible and will be fixed in the next release. In the meantime, you can use the following function:

FIXEDnaiveRandRUV <- function(Y, cIdx, nuCoeff = 0.001, k = nrow(Y))
{
    svdYc <- svd(Y[, cIdx])
    W <- svdYc$u[, 1:k, drop=FALSE] %*% diag(svdYc$d[1:k], nrow=k)
    nu <- nuCoeff * svdYc$d[1]^2
    nY <- Y - W %*% solve(t(W) %*% W + nu * diag(k), t(W) %*% 
        Y)
    return(nY)
}

where only the line starting with "W <-" changed with respect to the original function.

Regarding k=2.5, this seems to be the standard behavior in R:

> 1:2.5
[1] 1 2

 

Similarly, we do not do anything to deal with NAs, so the behavior of naiveRandRUV is induced by the behavior of svd and the %*% operator. So if you have missing values in one of the columns corresponding to negative controls (cIdx argument) you will get an error message as svd() does not deal with NAs. Otherwise, if there is at least one NA in columns j of Y, columns j of the corrected matrix nY will be entirely NAs as nY = CY for some matrix C.

Best,

Laurent

 

 

ADD COMMENT

Login before adding your answer.

Traffic: 629 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6