poisson

Randomly selecting values from a zero inflated distribution in R

大城市里の小女人 提交于 2020-01-16 03:52:08
问题 Hello and thanks in advance for the help! A while back I asked a question about randomly selecting values according to a probability distribution. This is related, but I think it deserves its own post. The vector I created in the last question was binary, now I would like to generate a weighted vector (ie with bounded integers). I am sampling from a zero-inflated or quasi-poisson distribution with a long tail, so there is a much higher probability of selecting a zero than another value, but

Randomly selecting values from a zero inflated distribution in R

佐手、 提交于 2020-01-16 03:52:07
问题 Hello and thanks in advance for the help! A while back I asked a question about randomly selecting values according to a probability distribution. This is related, but I think it deserves its own post. The vector I created in the last question was binary, now I would like to generate a weighted vector (ie with bounded integers). I am sampling from a zero-inflated or quasi-poisson distribution with a long tail, so there is a much higher probability of selecting a zero than another value, but

How to calculate with the Poisson-Distribution in Matlab?

霸气de小男生 提交于 2020-01-05 06:57:21
问题 I’ve used Excel in the past but the calculations including the Poisson-Distribution took a while, that’s why I switched to SQL. Soon I’ve recognized that SQL might not be a proper solution to deal with statistical issues. Finally I’ve decided to switch to Matlab but I’m not used to it at all, my problem Is the following: I’ve imported a .csv-table and have two columns with values, let’s say A and B (110 x 1 double) These values both are the input values for my Poisson-calculations. Since I

How to calculate with the Poisson-Distribution in Matlab?

狂风中的少年 提交于 2020-01-05 06:57:04
问题 I’ve used Excel in the past but the calculations including the Poisson-Distribution took a while, that’s why I switched to SQL. Soon I’ve recognized that SQL might not be a proper solution to deal with statistical issues. Finally I’ve decided to switch to Matlab but I’m not used to it at all, my problem Is the following: I’ve imported a .csv-table and have two columns with values, let’s say A and B (110 x 1 double) These values both are the input values for my Poisson-calculations. Since I

Fast Poisson Disk Sampling [Robert Bridson] in Python

非 Y 不嫁゛ 提交于 2019-12-31 04:50:05
问题 First of all, I implemented the ordinary, slow, Poisson Disk Sampling algorithm in the 2D plane and it works just fine. This slow version calculates the distances between all points and checks that the point you wish to place is at least R away from all the others. The fast version by Robert Bridson, available here: https://www.cs.ubc.ca/~rbridson/docs/bridson-siggraph07-poissondisk.pdf, suggests discretizing your 2D plane into quadratic cells with length = R/sqrt(2) since each cell can at

Calculation of Poisson distribution in C

不羁的心 提交于 2019-12-23 23:19:18
问题 I need a C function to calculate Poisson distribution for values of k up to 720. I need a highly efficient solution. 回答1: give a to try GSL: gsl_ran_poisson_pdf 回答2: Poisson Random Generator int poissonRandom(double expectedValue) { int n = 0; //counter of iteration double limit; double x; //pseudo random number limit = exp(-expectedValue); x = rand() / INT_MAX; while (x > limit) { n++; x *= rand() / INT_MAX; } return n; } I guess I'm pretty late for your urgent demand. 回答3: If you want to

Error with custom density function definition for mle2 formula call

泄露秘密 提交于 2019-12-23 00:25:14
问题 I want to define my own density function to be used in the formula call to mle2 from R 's bbmle package. The parameters of the model are estimated but I cannot apply functions like residuals or predict on the returned mle2 object. This is an example in which I define a function for a simple Poisson model. library(bbmle) set.seed(1) hpoisson <- rpois(1000, 10) myf <- function(x, lambda, log = FALSE) { pmf <- (lambda^x)*exp(-lambda)/factorial(x) if (log) log(pmf) else pmf } myfit <- mle2

How do I generate a Poisson Process?

≡放荡痞女 提交于 2019-12-21 08:25:12
问题 Original Question: I want to generate a Poisson process. If the number of arrivals by time t is N(t) and I have a Poisson distribution with parameter λ how do I generate N(t) ? How would I do this in C++? Clarification: I originally wanted to generate the process using a Poisson distribution. But, I was confused about what parameter from the process I needed; I thought I could use N(t) but that tells me how many arrivals have occurred on the interval (0,t] which wasn't what I wanted. So, then

Generate Poisson Arrival in Java

a 夏天 提交于 2019-12-21 06:04:15
问题 I would like to create a function in Java that generates Poisson arrivals given the mean arrival rate (lambda) and the mean service rate (mu). In my example I have: 2,2 requests/day, in other words 2,2 arrivals/day and a mean service time of 108 hours. Considering that my program starts at t=0 minutes, I would like to create a function that returns arrivals[], which will contain, t1, t2, and a possible t3. T1,t2 and t3 are the instants (in minutes) during the day where this arrivals occur. I

Adjust function for log(0)

老子叫甜甜 提交于 2019-12-20 05:45:39
问题 I wrote a function for a poisson regression. The data set discoveris have some count data where 5 entries are y = 0. I want compute the deviance residuals, acroding to the formula in my function : devianceResiduals <- sign(y - fittedValuesFullModell) * sqrt(2 * y * log(y / fittedValuesFullModell) - 2 * (y - fittedValuesFullModell)) My problem ist that i get NaN because log(y = 0) = -inf. So tried to write a loop that use 2 different forumals to compute the deviance residuals. If y = 0 the