stephenslab / susieR

R package for "sum of single effects" regression.
https://stephenslab.github.io/susieR
Other
174 stars 44 forks source link

summary statistics computation of var(y) is fragile #85

Closed stephens999 closed 5 years ago

stephens999 commented 5 years ago

if y is input as a 1 by n matrix then compute_ss completes but returns a matrix of NAs for the var(y) instead of a scalar...

set.seed(1)
n    <- 1000
p    <- 1000
beta <- rep(0,p)
beta[1:4] <- 1
X        <- matrix(rnorm(n*p),nrow=n,ncol=p)
y        <- t(X %*% beta + rnorm(n))   # note i replaced c() with t() here
input_ss <- compute_ss(X,y,standardize = TRUE)
input_ss$vary

it is probably better to use sd instead of var to compute sample variance of a vector ?

A bigger picture issue is that it might be clearer to use yty instead of vary throughout as for vary it is unclear whether you divide by n or (n-1)...

gaow commented 5 years ago

@stephens999 we have agreed to use yty in the new susie_ss function. Will close when it is done.