Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

negative Z scores #12

Closed
karlrohe opened this issue Nov 27, 2023 · 3 comments
Closed

negative Z scores #12

karlrohe opened this issue Nov 27, 2023 · 3 comments

Comments

@karlrohe
Copy link
Contributor

I'm having trouble making a simulation that re-creates this issue, but in multiple different data sources, I often see the Z-score going negative.

Screenshot 2023-11-27 at 10 50 31 AM

In a simulation, I can kinda recreate it via fastRG by making the non-zero values of A all 1's. but it is not as severe as I see here.

set.seed(1)
library(fastRG)
mod = fastRG::dcsbm(n = 10000, k = 10,expected_degree = 50)
diag(mod$S) = diag(mod$S) + mean(mod$S)
A = sample_sparse(mod)+0
mean(rowSums(A))

out_A = gdim::eigcv(A, k_max = 50, num_bootstraps = 1, laplacian = FALSE)
# notice how the first 5 p-values are small,
#   then they become uniform.  
# This is what we expect.
out_A$summary$pvals %>% plot


#  if you threshold non-zero entries of A to be one...
A1 = A
A1@x[] = 1
out_A1 = gdim::eigcv(A1, k_max = 50, num_bootstraps = 1, laplacian = FALSE)

# then you get 4 small p-values... then they jump to 1!
#   they should be uniform, but the thresholding
#   makes the test biased. 
out_A1$summary$pvals %>% plot
@karlrohe
Copy link
Contributor Author

This is not a request for any code fix... just documenting a strange behavior that I think we understand from a different perspective... we will want to give clear guidance to users on how to interpret this.

@karlrohe
Copy link
Contributor Author

ope! it's over here....

#6

moving these comments now.

@karlrohe
Copy link
Contributor Author

moved it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant