# 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.

273 questions
Filter by
Sorted by
Tagged with
12 views

### Python Mixed Linear Model Regression Interpretation of the Results

I cannot seem to find a proper guide on how to interpret the results from a Mixed Linear Model Regression. ...
40 views

### How to deal with extensive outlier periods caused by external factors like COVID?

I'm working on a timeseries that was significantly affected by the COVID-19 pandemic, but has since recovered to a more normal behavior. My objective is to have a good forecast for a couple of weeks, ...
10 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: ...
57 views

### Can't decide if my data is normally distributed

I have a problem comparing results from shapiro test and qqplot. Shapiro tells me my data doesn't have normal distribution characteristics (pvalue = 1.94...e-08 <= 0.05) however when I look on QQ ...
27 views

### Statsmodels: how to run and interpret a Gamma regression?

I have an endogenous variable that is continuous and non-negative. From what I can gather, a Poisson regression is not appropriate because the values of the response variable are not natural number, ...
24 views

### ARIMA model with delay in fitting and constant prediction

I am trying to use ARIMA (Python, statsmodel) on the following time series, values are collected with a weekly frequency: ...
15 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 ...
11 views

### ARIMA Forecasts (Python / Statsmodel)

Say I have an ARIMA model that I have fit and with with I want to make forecasts/predictions. Say the model is an ARIMA(2,0,2) with some seasonality (1,0,0,365) Since p and q are 2, we are relying on ...
31 views

### Forecasting Quarterly Time Series Data?

I've gotten very confused reading all the articles about forecasting time series data with seasonality on Medium and other sources. It seems that many provide useful background and importance of ...
18 views

### Can logistic regression be used when the dataset has observations from the same users but are unique per day

I have a dataset that captures user information by day (the users are unique per day but often have observations on multiple days) and I want to analyze a binary outcome. Is there a more appropriate ...
23 views

### How to calculate statistics for categorical variable level omitted by one-hot encoding?

I'm performing an ordinary least squares regression on a dataset whose predictors are two categorical variables and the dependent variable is continuous. The resulting model gives me stats like the ...
22 views

### Why aren't all my categorical variables included in the OLS model from statsmodels?

I'm using statsmodels to perform an Ordinary Least Squares regression between two categorical variables and a continuous dependent variable. My data is structured ...
21 views

### coint_johansen test results

I am running the coint_johansen test (Python) on stock data of 3 different banks. The results im getting are the following: Trace statistics: ...
35 views

### How to read and extract p & q values from the given ACF & PACF plot with fluctuations?

So I am new to Time-Series and have started with some basic financial data. Since it was not covariance stationary, I transformed it by taking daily percentage changed. The data became stationary and ...
75 views

### Measuring Strength of Trend and Seasonalities for Time-Series presenting Multi-Seasonal Patterns

My goal is to cluster time-series which may present daily/weekly/yearly seasonalities. To do so, I plan to use different variables and among them, the following ones: $F_{s_{daily}}$, $F_{s_{weekly}}$ ...
125 views

### is logistic regression stochastic like neural network?

I have observed that neural network models (using Keras TensorFlow) can be very unstable (when my sample size is small) in the sense that if I were to train 999 NN models, there might only be 99 with ...
93 views

### Standard Errors for LS Means

In Python, I'm trying to validate the LS means from a mixed model that I ran with R's lme4 after using the lsmeans library. I'm using Python's mixedlm() from statsmodels. I've successfully obtained ...
23 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 ...
32 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', ...
27 views

### VECM - Impulse reponse function - statsmodels - AttributeError: 'lr_effects'

I am using statsmodels version '0.11.1'. I am trying to sum cumulative effects of using the impulse response function derived of a VECM, but I am getting an AttributeError regarding 'lr_effects'. As ...
31 views

### Granger causality and meaning of lag for time series $X_{t}$ and $X_{t+1}$

Consider 2 time series $X_{t}$ and $X_{t+1}$ created as follows ...
34 views

### Statsmodel logit producing param nans, large std err, warnings, but model performance is fine [duplicate]

I keep getting warnings such as RuntimeWarning: invalid value encountered in greaterreturn (a < x) & (x < b) and my model summary is full of nans and ...
27 views

### Fitting a VAR model with nonstationary data and possible cointegration

I have time series data from multiple realisations (trials) of the same process in the shape (n_trials, n_sensors, n_times) which I would like to fit a vector ...
36 views

### Converting Cohen's $F^2$ to Cohen's $D$

How can I convert Cohen's $F^2$ to Cohen's $D$? I am interested in calculating the effect size for the difference between two groups in a mixed model. The data is from a within-subjects experiment ...
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 ...
125 views

### statsmodels seasonal_decompose(): What is the right “period of the series” in the context of a list column (constant vs. varying number of items)

Assume having a list column so that your time series is nested, see https://stackoverflow.com/questions/63246938/convert-pandas-df-with-data-in-a-list-column-into-a-time-series-in-long-format for ...
79 views

### all non-significant or NAN p-values in Logit

I'm running a logit with statsmodels that has around 25 regressors, ranging from categorical, ordinal and continuous variables. My code is the following, with its output: ...
19 views

### What do VAR model coeefficient probabilities represent?

I understand that with simple linear regression, each estimated coefficient has an associated p-value that corresponds to the null hypothesis that the coefficient in question is 0. If this p-value is ...
108 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(). ...
15 views

### Maximum likelihood estimation of a 3-parameter logistic function using statsmodels

I would like to fit a 3-parameter logistic function to data using maximum likelihood estimation via statsmodels (and/or pymc3). The logistic function is defined as follows: I am stuck because I don't ...
63 views

### chi squared test in python libraries

As I understand it, statsmodels.stats.contingency_tables.Table.test_nominal_association() and scipy.stats.chi2_contingency() ...
73 views

### How to find the 95% confidence interval when there is outliers?

I know how to find the 95% confidence interval for normal distributions. But how to find it when there is outliers? Question: The health-care costs, in thousands of dollars for 20 males aged 75 or ...
13 views

### Do I need to ensure that my time series are stationary before using statsmodels' grangercausalitytests?

The documentation here doesn't mention anything about stationarity, so I'm not sure how to proceed. Can I just apply grangercausalitytests to two non-stationary ...
78 views

### Unable to recreate Statsmodels ARIMAX (1, 1, 0) forecasts by hand

I have fit an ARIMAX (1, 1, 0) model to a timeseries dataset consisting of 1 endogenous timeseries ("Y") and 1 exogenous timeseries ("X"). My exogenous timeseries in the model was ...
15 views

### How do I know if p-hat is in the 75th percentile?

I have a statsmodels GLM model that returns a prediction: p-hat. If p-hat is in the 75th percentile I should assign the observation "class 1". If p-hat is below the 75th percentile I should ...
140 views

### Interpreting statsmodel Granger Causality test results: ssr_chi2test

I am trying to use statsmodels Granger Causality test: https://www.statsmodels.org/stable/generated/statsmodels.tsa.stattools.grangercausalitytests.html to assess whether "positivity score" ...
59 views

### Hierarchical modelling in Python with statsmodels

I have a dataset with random effects at different hierarchies and now I want to analyze how they influence my target variable. Somehow I'm looking into statsmodels ...
24 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: ...
18 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??
50 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 ...
207 views

### calculating variance inflation factor for logistic regression using statsmodels (or python)?

I am making a logistic regression model using Statsmodels while following the book "Discovering statistics using R" by Andy Field, Jeremy Miles, and Zoë Field . While following along the ...
9 views

### Performing ljung-box test on multiple timeseries at once

Background Performing multiple linear regression analysis on dataset containing 21 time-series of 4 data points. Each data points represents 9 variables which could describe a value. The 21 data ...
45 views

### How is the p-value in an OLS regression in statsmodels calculated?

I ran an OLS regression using statsmodels. The summary is as follows. I am confused looking at the t-stat and the corresponding p-values. For 'var_1' since the t-stat lies beyond the 95% confidence ...
47 views

### How to use HAC errors in VAR model

I would like to use the Newey-West method for the standard errors in a VAR(p)-model (I use statsmodels.tsa.vector_ar). The VAR(p)-model assumes that the residuals ...
36 views

### Can you explain how OLS for non-linear data is working in statsmodels OLS implementation?

reference: https://www.statsmodels.org/stable/examples/notebooks/generated/ols.html#OLS-non-linear-curve-but-linear-in-parameters How is OLS in this implementation working? Is it finding the best ...
20 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 ...
94 views

### Statsmodels multinomial logit returning nan for sparse features

I have a travel survey and wish to compare a discrete choice model with some machine learning approaches. For the former, I am using statsmodels MNLogit to calculate the coefficents and p-values of my ...
227 views

### Including random effects in prediction with Linear Mixed Model

I have a question regarding Linear Mixed Modeling using statsmodels. The first picture below shows the mixed model I fitted. My dummy dataset only contains one variable, and multiple groups. I would ...