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

Bernoulli graphs can have p>1 #20

Closed
karlrohe opened this issue Jul 2, 2021 · 7 comments
Closed

Bernoulli graphs can have p>1 #20

karlrohe opened this issue Jul 2, 2021 · 7 comments

Comments

@karlrohe
Copy link
Contributor

karlrohe commented Jul 2, 2021

Bernoulli probabilities can exceed one... because we simulate from poisson and threshold anything above 1.

So, I think this error shouldn't be there.

> b_model = fastRG::sbm(n = 100, k =2, 
+                       B = matrix(c(.8,.4,.4,.8), nrow = 2),  edge_distribution = "bernoulli")
Error: Elements of `B` must be not exceed 1 for bernoulli SBMs.
@alexpghayes
Copy link
Collaborator

Maybe we should switch the name of the edge distribution to "approximately-bernoulli" then too? And switch from an error to a warning? Does that sound good to you?

@karlrohe
Copy link
Contributor Author

karlrohe commented Jul 2, 2021 via email

@alexpghayes
Copy link
Collaborator

We can do things on a model by model basis. I think it makes sense to leave the error for model where the approximation is exact (i.e. above).

@karlrohe
Copy link
Contributor Author

karlrohe commented Jul 2, 2021

But my probabilities weren't greater than one.... it only happens because of the -log(1-p) needed to inflate the Poisson probabilities... so that after thresholding, we get Bernoulli( p)

@karlrohe
Copy link
Contributor Author

karlrohe commented Jul 2, 2021

So, the check should go before the -log(1-p)

@alexpghayes
Copy link
Collaborator

Ah I should move this code out of the SBM model and into the general factor model constructors.

@alexpghayes alexpghayes reopened this Jun 30, 2022
@alexpghayes
Copy link
Collaborator

General solution in #29

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

2 participants