Questions tagged [poisson]
The Poisson distribution is a statistical discrete distribution for describing events occurring at random intervals. It is defined on the non-negative integers that has the property in which the mean is equal to the variance.
709
questions
0
votes
0
answers
13
views
XGBoost and count:poisson
Quick question: the XGBoost library lists count:poisson as one of its learning task parameters. The official documentation is pretty limited and only says:
Poisson regression for count data, output ...
-1
votes
0
answers
12
views
Is there R package to fit zero inflated negative binomial/poisson generalized additive models? [closed]
I need to run either a zero inflated negative binomial gam (generalized additive model) or a zero inflated poisson gam. (I need to compare these two models for my data.)
But I can not find ways to ...
1
vote
0
answers
31
views
sklearn and statsmodels Poisson GLM yield different intercept & coefficient
I'm trying to reproduce the same Poisson GLM with sklearn and statsmodels. Unfortunately, that doesn't work. I get different intercepts/coefficents for the two implementations with the same parameters....
0
votes
1
answer
188
views
How to implement Poisson regression with scikit-learn for count data prediction
I'm looking for a way to couple Linear Regression with Poisson distribution. After a simple Linear Regression, its result is a numerical value that i would like to use in a Poisson Distribution, ...
0
votes
0
answers
21
views
model.fit is taking too long to train using colab
I'm trying to create a neural network to solve a Poisson Partial Differential Equation (PDE). However, for some reason, it's taking a long time to process the epochs, taking an average of 7 minutes. I ...
0
votes
0
answers
32
views
How to calculate the propabilty of a specific Y in a poisson regression model in R?
In my R session, I fitted a poisson regression model on patients in an emergency room like this:
fit <- glm(Patients ~ Day + Event, data = df, family = poisson)
(Day is day of the week; Event is &...
-1
votes
2
answers
58
views
Numpy power with array as exponent
I have a Python code containing the following lines:
# Poisson model
lambda_param = 3.0
x_model = numpy.linspace(0, 10, num=11, dtype=int)
y_model = numpy.zeros(10)
index = 0
for x in x_model:
...
0
votes
0
answers
14
views
How to create a mixed model with count data and random effects in R for complex ecological data? [migrated]
I have a question about performing a mixed effects model with random effects in R. I want to test whether there are differences in symbiont genus between coral genera from 4 different types of reef ...
1
vote
0
answers
68
views
Python catboost custom loss function
I know that there is built-in Poisson loss function in catboost. I want to try to reproduce it. I used the tutorial example https://github.com/catboost/catboost/blob/...
1
vote
1
answer
113
views
Truncated Maximum Likelihood estimator
I am trying to estimate the parameters of Truncated New Generalized Poisson Lindly distribution.
Here in this distribution, we use two parameters which are alpha1, beta1, When I run Optimum function ...
0
votes
0
answers
33
views
Problem with fitting glm.nb : Error in glm.fitter, NA/NaN/Inf in 'x'
I have problems fitting a glm.nb model.
model <- glm.nb(y ~ temp + perc + width + water , data = df)
I'm getting the following error.
Error in glm.fitter(x = X, y = Y, w = w, etastart = eta, ...
1
vote
0
answers
18
views
Upper and Lower Error Bar at Confidence Level 68.3% for number of count is 500
import numpy as np
from scipy.stats import poisson
# Parameters
N = 500 # Poisson parameter
confidence_level = 0.683 # Desired confidence level (68.3%)
# Calculate the upper and lower errors
...
0
votes
0
answers
28
views
Removing outliers in count data for poisson glm?
Does it make sense to remove outliers from count data?
After all, by doing so, data won't fit a parametric distribution. The data will be modelled through a poisson glm.
0
votes
0
answers
21
views
Error in rep.int(sep, ncolumns - 1) : invalid 'times' value in bayesx function [R2BayesX package] in R
I am trying to run a STAR model within the R2BayesX package using the bayesx function. My model works with the cases of leptospirosis in Colombia ('observed' and 'expected') by department in a ...
0
votes
0
answers
18
views
Zero-truncated Poisson model in INLA
I am working on a spatial SDM using INLA. My data has a Poisson distribution with no zeros. I want to apply a zero-truncated INLA Poisson model but I do not understand the meaning of the parameter E ...
0
votes
0
answers
68
views
Why am I getting a log-likelihood of -infinity when using positive poisson regression on a large dataset in R?
I need to run a regression on a count dependent variable containing only non-zero positive integers with a mean of 2.31 and a variance of 3.86. Thus, I am using a positive poisson regression using the ...
1
vote
0
answers
35
views
Make predicitions with model in R after using sandwich package
I've tried to create a reproducible example of what I'm working with:
data <-
starwars %>%
mutate(sex = if_else(sex == "male", 1, 0)) %>%
filter(!is.na(sex)) %>%
...
1
vote
1
answer
34
views
Native xgb and XGBRegressor same predictions but not the same metric
I don't understand why the metric are not the same between xgb.train and xgb.XGBRegressor. I do have the same prediction values. Do you have an idea ?
Here below a little example on simulated data.
...
2
votes
0
answers
60
views
Imputation of NaNs on count variables using a Poisson's regression
I have a Pandas dataframe with variables that are all counts (integer data, such as count of pieces of fruit ingested on average, count of hours slept on average, etc). Here is a dummy dataset that is ...
0
votes
0
answers
98
views
Problem passing family argument to fit.mult.impute for multiple imputation with modified Poisson using Hmisc package
I was previously able to run a modified Poisson regression using data created through multiple imputation with the Hmisc package. I ran the code a month ago without issue, but I'm now having problems ...
2
votes
1
answer
107
views
Fit Poisson binomial distribution to data
I keep hitting the same error when trying to fit distribution to data using fitdistrplus. MWE is below. In short, I want to fit a Poisson binomial distribution to some data. I'm using the poibin R ...
1
vote
0
answers
43
views
How to extract Lambda and Nu parameters from glmmTMB Conway-Maxwell Poisson regression model
I'm trying to build Conway Maxwell Poisson model with glmmTMB package with model's family = "compois". The model works okay but I cannot find any output from the model that expresses the ...
0
votes
1
answer
51
views
Why does the p-value of the scipy.stats.ketest drop when the number of samples increases?
Now days I am working on a time-series event, and want to show it is NOT randomly generated events. For this purpose, I am trying to use the kstest in scipy. By the way, I have a question about the ...
0
votes
0
answers
14
views
Replicate univariable poisson regression results from a single-row-per-patient dataset on a multiple-row-per-patient dataset
I performed univariable Poisson regression on a dataset of individuals where each individual had one row of data. The variable Sex, for example, had the incidence rate ratio 2.11 (95% CI 1.73-2.56, p&...
0
votes
0
answers
23
views
ZIP Model returns "non-finite value supplied by optim"
I'm trying to fit a ZIP (Zero inflated Regression Model) to my dataset which contains 4 predictors. The dependent variable is 60% full of zeros which fits the model assumption. 2 of my 4 predictors ...
0
votes
0
answers
40
views
Python implementation of MLE for NHPP model
The context:
Hi, I need to perform reliability analysis for a set of components using Power-NHPP (Non-Homogeneous Poisson Process following Power Law) model like it is performed in SAS using proc ...
0
votes
0
answers
97
views
Statsmodel Zero Inflated Poisson doesn't converge (statsmodels.discrete.count_model.ZeroInflatedPoisson)
Lately, I've been working with a risk model in Python.
My target variable is a frequency (float), which was calculated as
freq = number of events/total exposition
and my dataset is really unbalanced, ...
0
votes
0
answers
40
views
Potentially Normal Iterator Behaviour which seems like "Weird behaviour in Python Itertools Monte Carlo using itertools.takewhile"
Edit after slothrop's comment:
It seems that takewhile eats up the last checked object in iterators (see comment) which means there is no telling if the next element will also satisfy the condition, ...
2
votes
0
answers
68
views
I have a problem assessing my zero-inflated negative binomial model against a poisson model
I have replicated a zero-inflated negative binomial model (model 1, table 1) from the article:
Scharpf, Adam. 2020. “Why Governments Have Their Troops Trained Abroad: Evidence
from Latin America.” ...
0
votes
0
answers
37
views
gvlma and poisson: Error in if (class(x)==formula) : the condition has length > 1
I am running several models (linear, log+1, poisson, and negative binomial). I am assessing all these models because of the funky distribution of my data, and to be consistent with previous ...
0
votes
0
answers
73
views
Adding variable as a factor to glm
My dataset has been collected from two different locations. I want to add the locations to my GLM, and got the feedback to add them as a random effect, but I'm not sure how to do that. I have tried ...
1
vote
0
answers
35
views
Calculating Probability of Earthquakes in a Four-Week Period Using Poisson Distribution in Octave
Question: In an area of a country, it is known that earthquakes occur 1.4 times in 8 days in an average sense since the dawn of history. However, there were 15 earthquakes in the last four
weeks. ...
0
votes
1
answer
49
views
How to implement the Polya-Aeppli distribution in Python using rv_discrete?
I have tried to implement the Polya-Aeppli (Geometric Poisson) distribution in Python by specifying the PMF via subclassing the scipy.stats.rv_discrete class.
I have implemented it as follows:
from ...
0
votes
1
answer
46
views
How to use s() and I() in the same time in r?
I am using gam to fit the data and I get s() and gam() from mgcv. However, when I tried to type the formula:
y = data.frame(n = c(1:5),b = runif(5),c = runif(5,min = 2,max = 3),d = c(5:9),e = scale(c(...
1
vote
1
answer
109
views
How to fix 'Error in vars$family.glmm$checkData(y) : data must be nonnegative integers'?
I am trying to run a glmm for the first time with my data. I have population data across 13 study sites and I am using a test file to see the results for blesbok in South Africa. This is my code (...
0
votes
0
answers
31
views
Discrepancy between calculated p values
I am using survey package to calculate weighted Poisson regression however I am not sure that the weights are used in a correct way.
Each observation of my dataset has been assigned a weight based on ...
1
vote
0
answers
95
views
Poisson regression with offset variable in neural network using Python
I have large count data with 65 feature variables, Claims as the outcome variable, and Exposure as an offset variable. I want to implement the Poisson loss function in a neural network using Python. I ...
0
votes
1
answer
54
views
Certain Poisson prob for Google Sheets
Image. What formula should be used so that the number in cell A4 corresponds to a certain Poisson probability (highlighted in yellow and =0.8) from the data range in column "B"?
By hand, I ...
0
votes
0
answers
27
views
posthoc test on poisson model gives NA values
when trying to perform a post hoc test (Tukey)on my glmer fit, I keep receiving NA values, even when adding the offset value.
this is my code and dataset https://drive.google.com/file/d/1W7D-...
0
votes
0
answers
38
views
How to apply Poisson noise on image data, NON-INTEGERS
I have images with a very low number of counts per pixel/voxel (in float32).
I would like to add Poisson noise. I tried apply_poisson_noise and random_noise, but this only creates integers.
the addum ...
0
votes
1
answer
75
views
How do I obtain rate estimates with 95% CIs for each level of a factor from a Poisson regression in R?
I am running a Poisson regression model in R structured the following way:
mod <- glm(outcome ~ X + A + B + C + offset(log(time)), data = dat, family = poisson(link = "log"))
Where X is ...
0
votes
0
answers
22
views
Numpy Random Poisson Giving the Same Results [duplicate]
Why would the following code assign the same values to each row of the percent errors list when a nested for loop iterating over sizes [1*10,columns*10] j times produces unique outputs?
import numpy ...
0
votes
1
answer
82
views
Is it possible to do prediction with Poisson regression that fitting with spline functions?
I am trying to do prediction with poisson regression that fitting with spline functions.
The code is as below:
#poisson regression
#sample dataset
set.seed(123)
index = rpois(24,26)
index = splines::...
1
vote
1
answer
297
views
Problem with pooling estimates from multiple imputed datasets using MICE in R- Zero-Inflated Poisson
I have been attempting to run a zero-inflated poisson regression on a dataframe that I have used mice() to impute missing data. My code successfully runs the multiple imputations and pools the results....
0
votes
0
answers
71
views
R MFP (Multivariable Fractional Polynomials) function with Poisson offset function
I want to use R mfp function for Poisson model with offset function. However, when I compared the result with the glm function. It seems the offset function didn't work in the mfp function.
For ...
0
votes
0
answers
83
views
PCL Poisson reconstruction function "NonLinearUpdateWeightContribution" does not generate unit weight
Function in pcl/1.13.0_2/include/pcl-1.13/pcl/surface/3rdparty/poisson4/multi_grid_octree_data.hpp:
template<int Degree>
int Octree<Degree>::NonLinearUpdateWeightContribution( ...
2
votes
3
answers
273
views
How to Write Poisson CDF as Python Polars Expression
I have a collection of polars expressions being used to generate features for an ML model. I'd like to add a poission cdf feature to this collection whilst maintaining lazy execution (with benefits of ...
0
votes
1
answer
91
views
Can I use poisson distribution as family in Generalized Additive Model (GAM) for continuous, non-negative data?
I am building a GAM with a data set which distribution resembles poisson-distributed data. However, my data is continuous, i.e., it contains information on tree volumes in cubic meters. So, when doing ...
0
votes
1
answer
40
views
How to simulate number of occurences over a time period
I have an event which happens on average once every x seconds. In Python, I wish to "simulate" a specific time interval of t seconds, and obtain a reasonable randomly sampled integer n ...
0
votes
1
answer
66
views
Negative binomial , Poisson-gamma mixture winbugs
Winbugs trap error
model
{
for (i in 1:5323) {
Y[i] ~ dpois(mu[i]) # NB model as a Poisson-gamma mixture
mu[i] ~ dgamma(b[i], a[i]) # NB model as a poisson-gamma mixture
a[i] <- b[i] / Emu[i]
b[...