Questions tagged [statsmodels]

A Python module for exploration, testing, and estimation. Do not use this tag for general statistical modeling questions! Nb, questions only about the module itself, Python, or coding will likely be off topic.

122 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
12
votes
1answer
9k views

Cause of a high condition number in a python statsmodels regression?

I'm pretty new to regression analysis, and I'm using python's statsmodels to look at the relationship between GDP/health/social services spending and health outcomes (DALYs) across the OECD. Just to ...
6
votes
0answers
7k views

Assessing A/B test results using Python

Problem's setting Assume having results of an A/B test. You let you users experience two variants of your website and you counted how many converted: ...
5
votes
0answers
134 views

Why does uncertainty of the autocorrelation coefficient increase as lag increases?

The Python module statsmodels contains functions for ACF and PACF. Below is an example from the docs with a plot that shows the (zero-centered) confidence ...
5
votes
0answers
1k views

statsmodels: quantreg convergence cycle warning

I am getting the same Convergence cycle detected warning running a quantile regression with ...
4
votes
0answers
5k views

ARMA Model fitting using statsmodels.tsa.ARMA()

Two questions. 1.) When I use the statsmodels.tsa.ARMA() module, I enter my parameters and fit a model as follows: ...
3
votes
0answers
44 views

Dealing with leptokurtosis, should I be worried?

I modeled a mixed model with the lmer library in Rstudio and my residues don't seem normal, with a Shapiro-Wilk test p-value <0.0001 and a QQ-plot that looks heavy tailed. I then plotted the ...
3
votes
0answers
2k views

How to estimate weekly and daily seasonality for data with 15min frequency in Python?

I am relatively new to time series. My goal is to predict a few hours of data, measured every 15min based on three months of observations in Python. I assume I have daily and weekly cycles which I ...
3
votes
0answers
1k views

Python statsmodels ARIMA ValueErrors

I am using the statsmodels package in python to generate a set of ARIMA models for a series of log returns multiplied by 1000. I am iterating through possible models (p, d, q) starting from (1, 0, 0) ...
3
votes
0answers
913 views

Approximating cox model with time varying covariates using poisson

How do you reformat a dataset in order to perform a cox regression with time-varying covariates as a poisson regression. I'm trying to run a survival analysis regression in python with time varying ...
2
votes
1answer
38 views

Why are the p-values of this mixed effect model non-uniform when there is no effect (synthetic data)?

I've been looking into using mixed effect models for a project, and along the way wanted to experiment with how they'd work on synthetic data. However, I'm confused by the results — if I generate what ...
2
votes
0answers
84 views

Trend Dampen with SARIMA

Trend dampen exists as a parameter for Holt-Winters in the ExponentialSmoothing class for statsmodels but how can I do something ...
2
votes
0answers
13 views

Suggestion on statistical models that compare likeness

I have a large dataset with thousands of entries. there are two columns the first being a type value (A,B,C,D,E,F) and the second column is a raw data value. I'd like to run statistical analysis on ...
2
votes
0answers
125 views

statsmodel package grangercausalitytests output explanation?

Was told to post her from stack overflow. I'm currently doing a project where I'm trying to find evidence of causality between human activity and global warming. I've been trying to run a granger ...
2
votes
0answers
2k views

Ljung-Box test p-values

I am using the Ljung-Box test from the python statsmodel package to test if there are autocorrelations in a time series. To make sure I understand the test, I am performing it on white noise and ...
2
votes
0answers
400 views

Sampling a statsmodel KDEMultivariate

I have been exploring kernel density methods in statsmodel that allow categorical variables but it seems that, unlike scikit learn kernel density implementation, there are no methods to generate ...
2
votes
0answers
8k views

Variation Inflation Factor Gives inf

I have a dataset that contains 292 attributes. I want to calculate VIF to address multicollinearity in dataset. Here is a snippet which I have used to calculate VIF ...
2
votes
0answers
68 views

Measuring Difference Between Two Sets of Likert Values

I asked users to complete a likert survey (1-5) at the start of an activity and at the conclusion of the activity. What is the best manner to show the rate of change/difference between these two ...
2
votes
0answers
136 views

Interpreting result of OrdinalGEE

I am trying to understand the IPython notebook here. The output of the GEE fit displays: ...
2
votes
0answers
860 views

What is the formula of Median Magnitude of Relative Error? (MdMRE)

I'm familiar with these terms 1 - MRE Mean Relative Error 2 - MMRE Mean Magnitude of Relative Error I need to compute MdMRE which is Median Mean Relative Error. I searched on the net but didn't ...
2
votes
0answers
670 views

Equivalence of intercept beta test to one-sample t-test in linear regression model with categorical variable

I am testing my understanding of the equivalence between basic linear regression with categorical variables, and one-sample / independent samples t-tests. I don't think this corresponds to an existing ...
2
votes
0answers
1k views

Python: Compute the Generalized Impulse Responses

I am using the tsa.vector_ar in Python, StatsModel Package and when I do a Forecast Error Variance Decomposition using the command ...
1
vote
0answers
14 views

Numpy and Statmodel issue - LinAlgError - Singular Matrix

I have seen other topics on this, but I couldn't get their solutions working for me. Perhaps someone else will know why. namely: statsmodels: error in kde on a list of repeated values However, my ...
1
vote
0answers
14 views

Marginal effect for mixed effects models (for python statsmodels)

I have a mixed effects model, developed using python statsmodels, and I want to know the effect of each independent variable on the response variable, assuming all other variables are constant. Based ...
1
vote
0answers
25 views

Mixed Linear Model Regression missing output

I'm running a mixed linear model regression and I get some missing output and for the one I get it doesn't make too much sense (or at least I think so as the p-value is always equal to 1). The columns ...
1
vote
0answers
58 views

Using ar_select_order from Python statsmodels 0.12.0 to determine optimal lag for AutoRegressive model

Using statsmodels 0.12.0 I am attempting to determine the optimal lag for a statsmodels.tsa.ar_models.AutoReg model. I am using US population data with monthly ...
1
vote
0answers
36 views

How to interpret the coefficients of a regressor in a ARIMAX model

I'm fitting an ARIMAX model with statsmodels SARIMAX library. I've done a logarithm transformation for both the dependent variable and the regressor and I've been left with the following coefficients: ...
1
vote
0answers
17 views

Unable to match numerical output of Newey-West standard error in statsmodel

I'm trying to implement Newey-West from scratch to better understand each component. Currently having trouble replicating a basic numerical example of Newey-West with lag=1 from ...
1
vote
0answers
28 views

How to visually verify correlation in a Generalized Linear Model with Binomial Distribution?

I am trying to determine whether my exogenous variables have significant influence over an endogenous variable. This response variable is a count, so I am using a generalized linear model with a ...
1
vote
0answers
38 views

Why does my ARIMA model forecast drastic drop at the second timestamp in the prediction period?

I am trying to reproduce SPSS results with python. I'm using statsmodels SARIMAX package in python. My model produces forecasting results which shows sudden drop at '2020-08-01'. After '2020-08-01', ...
1
vote
0answers
598 views

Difference between forecasting and predicting in statsmodels SARIMAX

I am using SARIMAX model from the statsmodels library to predict(forecast) future values in a time-series. The library contains four methods: predict(), get_predictions(), forecast(), get forecast(). ...
1
vote
0answers
57 views

How to update an ExponentialSmoothing model on new data without refitting

I'm trying to find the correct way to update an already fitted ExponentialSmoothing model on new data. My guess was like this: ...
1
vote
0answers
19 views

how to check heteroskedasticity in pyhton?

After building model by using glm. How to check heteroskedasticity? are there any tests available to find or is it checked by using graphs??
1
vote
0answers
28 views

Confidence intervals for bootstrapped multinomial proportions: Sison-Glaz?

I read the rules and looked for similar posts, but couldn't find any. New to the platform, so if I missed anything, pardon me. I have started looking into uncertainty quantification and I want to ...
1
vote
1answer
419 views

How do I interpret the coefficients of a statsmodels multiple regression model with 2 dichotomous variables?

I have a continuous dependent variable Y and 2 dichotomous, crossed grouping factors forming 4 groups: A1, A2, B1, and B2. I am looking for the main effects of either factor, so I fit a linear model ...
1
vote
0answers
126 views

Interpreting the Granger Causality Test

I am trying to go through an online time series analysis tutorial and they use the Granger Causality Test to see if there is some benefit to jointly model two time ...
1
vote
2answers
477 views

Relaxed Lasso Logistic Regression: Estimating second penalty parameter

I'm trying a relaxed lasso logistic regression by first using sklearn's cross validation to find an optimal penalty parameter (C = 1/lambda). Then, I use that parameter to fit statsmodel's logit model ...
1
vote
0answers
52 views

How does Noise affect the results of Transfer Entropy?

I was reading about Transfer Entropy and came across this package: https://cran.r-project.org/web/packages/TransferEntropy/TransferEntropy.pdf The code in the package: ...
1
vote
0answers
34 views

Which model for testing “has this binary variable changed over time?”

I am trying to figure out if a list of historical documents (N=50) drifted from one value of a binary variable $w$ to the other. Users have given 1 to 5 votes whether they think they think the ...
1
vote
0answers
2k views

python StatsModels use training parameters for test data summary

I ran a linear regression on a month of hourly Nox concentration using StatsModels ols function. how can I get summary OLS Regression Results on the test data? I ...
1
vote
0answers
1k views

OLS regression using the CAPM model in python

I've checked several posts here and haven't found what I'm looking for... The goal is to do a CAPM regression and assume that you have the following information: monthly prices for company AAPL, S&...
1
vote
0answers
70 views

Can I do seasonal decomposition on a series on a rolling window basis?

I've been experimenting with the seasonal_decompose() feature from Python's statsmodels (equivalent to the same in R). The ...
1
vote
0answers
1k views

Partial regression plots for regularized (L2) linear regression

I'm trying to get to grips with multiple linear regression and partial regression plots. The answer to this question from @Silverfish really helped initially, so I had a go with my own data using ...
1
vote
0answers
304 views

Why are all my coefficients negative in my binomial regression, even though they are percentages that add to 100% for each group?

my git-hub file, demonstrating the problem I am trying to run a binomial regression on a dataset of groups that have taken a pass/fail test. I am working in Python, with statsmodels. My dependent ...
1
vote
0answers
24 views

Measuring effect size with two groups and one independent variable

I have conducted a study in which I am trying to assess how fast participants recognize familiar objects shown within white noise. Given my results, I suspect that for a given level of coherence(more ...
1
vote
0answers
2k views

GLM.fit() in Matlab vs. Python Statsmodels: why the different results?

In what ways is Matlab's glmfit implemented differently than Python statsmodels' GLM.fit()? Here is a comparison of their ...
1
vote
0answers
508 views

Problem with least squares cross validation in statsmodels

I'm trying to calculate a KDE bandwidth using the least-squares cross validation (LSCV) method. I'm using the statsmodels KDEMultivariate function in Python. But I'm running into an issue where the ...
1
vote
0answers
520 views

Knowing what exogenous variable cause quasi-separation

I'm trying to build a classifier using a logistic regression and statsmodel is telling me that there is an issue of quasi-separation. Well this isn't an issue! This is exactly what i'm trying to do: ...
1
vote
0answers
8k views

Statsmodels: What can cause LinAlg error?

I am trying to do a mixed linear model for a dataset I am helping a colleague analyze, as in an earlier question I had posted, GLMs were unable to handle random effects. With the appropriate imports ...
1
vote
0answers
366 views

Backward ARIMA forecast

I want to try and predict previous values for random data that has properties of ARIMA process. Problem is that I dont understand ARIMA model mathematically, so I dont know if that's even possible ...
0
votes
0answers
10 views

Statsmodel linear combination of previous values that fit the model

I have two list X and Y of length 500 with numbers. And i would like to make a forecasting model that make a linear combination of K values of Y to deduce the next value. For instance i train this ...