marchtaylor / sinkr

A collection of functions with emphasis on multivariate methods and handling of geographic datasets
GNU General Public License v3.0
36 stars 12 forks source link

Argument x in northTest #9

Closed ckeating3000 closed 3 years ago

ckeating3000 commented 3 years ago

Thanks for developing this package! I noticed the northTest function uses the second dimension of input argument "x" to determine the # of samples (for estimating error for each eigenvalue). However, for column-wise datasets, this method calculates the incorrect # of samples. Since that's the only place x is used, I suggest removing "x" as an argument and just directly requesting number of samples.

marchtaylor commented 3 years ago

Thanks for your comment (and kind words). I don't understand what you mean by "column-wise datasets". The calculation is for matrices decomposed with svd, so there should always be a column dimension. Even if you only have a single column in your dataset, which doesn't make sense for empirical orthogonal function analysis, the current function should work. It may be that the class of x is not a matrix? e.g.:

library(sinkr)
x <- as.matrix(rnorm(10))
e <- eof(x)
northTest(x, e$Lambda)

Also, North's rule-of-thumb really only makes sense when comparing more than one singular value, as it looks for values that overlap in their error distribution.

ckeating3000 commented 3 years ago

Ah ok, I was misinterpreting the meaning of "x." Thanks for clarifying!