Skip to main content

Questions tagged [statsmodels]

Use this tag for an on-topic question that (a) involves statsmodels either as a critical part of the question or expected answer, and (b) is not *just* about how to use statsmodels, Python or coding. Do not use this tag for general statistical modeling questions.

Filter by
Sorted by
Tagged with
1 vote
1 answer
14 views

Hausman Test Reults Report

I've been working on a research project using a multi-level regression model, and I'm currently figuring out how to present the Hausman test results. I've seen some papers where authors mention doing ...
Sabrina's user avatar
  • 11
0 votes
0 answers
28 views

Why does R robustbase and rrcov covMcd compute reweighted step trimming adjustment with actual fraction of outliers?

covMcd and CovMcd in R robustbase and rrcov compute by default a reweighting step. Reweighting in MCD and similar computes the Mahalanobis distances and the uses a cutoff using the chisquare ...
Josef's user avatar
  • 3,292
0 votes
0 answers
32 views

How to implement ordering for VAR impulse response functions in statsmodels (python)

I'm trying to implement an impulse response function for a VAR system. However, I'm not sure how to implement the variable ordering. Does this correspond to the order of the columns in the data frame? ...
themanfromnowhere's user avatar
2 votes
1 answer
80 views

Compute R Squared by Fixing Betas for Multi Linear Regression without Intercept results in a large R Square

I want to fix the betas in multi linear regression based on some data I have, which leads to a RSquare value less than 0% and greater than 100 % based on the projection approach mentioned in ...
godimedia's user avatar
  • 123
0 votes
0 answers
20 views

statsmodels.stats.multitest.multipletests: 1.0 pvalues [duplicate]

I am running a series of statistical tests between many lists of values all sampled from the same population. After computing pvalues, I thought to apply an adjustment with statsmodels.stats.multitest....
Indefeasible's user avatar
0 votes
0 answers
35 views

Different P-Value and AIC before/after standardization [Python - Statsmodels]

I am investigating the correlation between environmental variables (15 continuous variables grouped as 'DHIs' in the code below) and fox occurrence (binary), using logistic regression / Python ...
Andrew Norfield's user avatar
1 vote
1 answer
52 views

Which statistical model is suitable?

I have the results of a survey of $n=132$ patients with their socio-economic profile and their spending behavior on mobility-coins (my thesis topic). In the survey, we asked people how they would ...
yaseen's user avatar
  • 11
1 vote
1 answer
44 views

(When) Does GLMM provide better predictions than logistic regression?

I am trying to test statsmodels GLMM vs logistic regression (by either statsmodels or scikit-learn - see the code with a toy example below). I understand the ...
Roger V.'s user avatar
  • 4,439
1 vote
1 answer
58 views

Linear regression on categorical variable, how to interpret the F-statistic?

I am using statsmodels to fit a regression: smf.ols(formula=change ~ C(location))` where change is a continuous variable. I have a lot of locations and some of the ...
benr's user avatar
  • 23
0 votes
0 answers
26 views

How to tell if an offset term is used from GLM model summary in Statsmodels?

I am currently working on Poisson regressions with offset terms via the GLM function in Statsmodels, but I think the same issue exists for the GLM function in R as the model summary is quite similar. ...
29703461's user avatar
3 votes
1 answer
75 views

Constructing a generalized linear model when the dependent variable has a Exponentially modified Gaussian distribution

I have some data where I have reason to believe the dependent variable $Y$ follows an Exponentially modified Gaussian distribution, i.e. $Y$ is the sum of one gaussian distributed stochastic variable $...
fj34ifj3ljfk3fj43jfk3jf's user avatar
2 votes
1 answer
32 views

Confusing SARIMAX Parameter Estimates from Simulated ARMA Data

I've been working on simulating ARMA (Autoregressive Moving Average) time series data in Python and fitting ARIMA models using the SARIMAX class from the ...
Quant In Spe's user avatar
1 vote
0 answers
27 views

Fit ARMA(p, q) model in the Python statsmodels library using maximum likelihood [closed]

I am trying to fit a ARMA(p,q) model using the exact methods where the exact maximum likelihood or conditional sum of squares likelihood is maximized. This was available in the statsmodels library in ...
SPaul's user avatar
  • 11
0 votes
2 answers
38 views

Approach to Handling Stationarity in Multi-dimensional Time Series Forecasting with AutoARIMA

I am working on a time series forecasting project for a meal delivery service that operates in multiple cities. The company has several fulfillment centers across these cities for dispatching meal ...
user172500's user avatar
1 vote
1 answer
51 views

Simulating non-zero mean autoregressive (AR(2)) samples

I asked this question in stackoverflow, with no success. I am hoping that i might get some suggestions here. I am trying to generate non-zero mean AR(2) samples using statsmodels package. But it seems ...
Shew's user avatar
  • 297
5 votes
1 answer
140 views

Why do my bootstrapped coefficient standard errors differ from statsmodels standard errors

In stats models, I run a regression and get the following SE from the regression output: SE(const) = 0.028 SE(AveBedrms) = .017 SE(HouseAge) = .0001 From the sample dataset, I randomly sample with ...
user2330624's user avatar
0 votes
0 answers
37 views

Log-rank vs Cox hazard model for survival analysis [duplicate]

I'm a medical oncologist and had some doubts concerning the stats behind clinical trials design. My question concerned the use of log-rank vs. univariable Cox-regression to compare the survival curves ...
DK80's user avatar
  • 1
1 vote
1 answer
252 views

SARIMAX.predict() and SARIMAX.forecast() exog? Does exog need to be preknown for predict()?

On SARIMAX.predict, when you have an exog but the exog is only known today and in the past, how do you predict the endog's next 12 months off just the exog and data ...
Lee's user avatar
  • 13
0 votes
0 answers
121 views

Understanding the differences between auto_arima and SARIMAX predictions

I would like to better understand the differences between the results obtained with the SARIMAX function and the auto_arima function. In particular, I would like to understand. why the two models ...
Cata's user avatar
  • 1
0 votes
0 answers
78 views

Why does a 1-knot spline regression have 3 coefficients?

I've been learning about spline regressions, and I'm trying out a statsmodels negative binomial spline regression as a changepoint detector for a time series of count data. I'm pretty confused about ...
BlueHarp's user avatar
  • 189
0 votes
0 answers
77 views

fitting an ARMAX model with box constraints in python

I would like to identify some parameters from real world data (actually time series). After some mathematical manipulations of some equations describing my system, I conveniently end-up having a ...
NokiYola's user avatar
  • 121
0 votes
0 answers
38 views

seasonal_order in statsmodels.tsa.statespace.sarimax.SARIMAX for daily data

I'm trying to understand how to set s for the seasonal order in the context of statsmodels.tsa.statespace.sarimax.SARIMAX. Per the documentation: s is an integer ...
Evan Volgas's user avatar
1 vote
0 answers
148 views

Python statsmodels GLM - log likelihood of null model

I have an issue when calculating log-likelihood for null model to double-check GLMResults.llnull parameter: https://www.statsmodels.org/devel/generated/statsmodels.genmod.generalized_linear_model....
Paweł Orliński's user avatar
0 votes
0 answers
50 views

Dynamic adjustment equations coefficients using VECM from statsmodels

I am looking to replicate a study that was conducted on running a VECM to assess the short- and long-term impacts of media on sales and brand health metrics (consideration & awareness). Using <...
Timothy Mcwilliams's user avatar
1 vote
1 answer
111 views

Why do we choose thresholds for the logistic regression instead of sampling from a Bernoulli with p (output of the LR) probability?

I would like to know what would be the disadvantages of sampling from a Bernoulli with p probability (p being the output of a logistic regression) to generate the binary classification? Choosing a ...
user11849's user avatar
0 votes
0 answers
83 views

understanding the fitting options of the statsmodels ARIMA.fit method

I am trying to fit an ARMAX model to some data in python and I am not exactly an expert in the field and I'm having a hard time understanding statsmodels fitting options. By the way my statsmodels ...
NokiYola's user avatar
  • 121
1 vote
1 answer
49 views

How does the least squares solution replace expectation by averages over the training data?

This is a follow-up question for this post This question is related to what is written in 19 page of ESL. We have two statements. The following is a quote from the post. The one below is the matrix ...
Sherlock_Hound's user avatar
3 votes
3 answers
314 views

What would cause all the coef and tvalue to be the same in regression model when using interaction terms?

I haven't seen a situation like this. Both B1 and B2 are dummy variables. If I regress them separately, it's fine, but if I add an interaction term, all the coefficients are the same. I'm using ...
confused's user avatar
  • 3,273
0 votes
0 answers
122 views

VECM predict gives forecasting results that lag behind actual data

I am using Python's statsmodels.tsa.vector_ar.vecm.VECM to estimate VECM models and generate pseudo out-of-sample forecasts with the .predict() function to compare with actual data. For example, I ...
Hanqing Ye's user avatar
1 vote
2 answers
309 views

Python - need help with Linear Mixed Effects Model results interpretation

I analyse a set of physicochemical data from the river and two rows of wells - one located closer and the other further from the river (in the N-S direction). The study's main aim is to investigate ...
crtnnn's user avatar
  • 103
0 votes
0 answers
19 views

How can I best correct / handle a slight right skew distribution in my residuals plot using stats.models mixed effects model?

I am using statsmodels mixedlm as follows: ...
user's user avatar
  • 1
2 votes
1 answer
251 views

Trouble selecting q-q plot settings with statsmodels. Do any of these plots properly compare the sample quantiles to theoretical normal quantiles?

I have an array of over 6,000 data points and am trying to show whether they follow a normal distribution. Statsmodels (the library I'm using to generate plots) gives the option of using a 45-degree ...
user395052's user avatar
1 vote
0 answers
43 views

How does statsmodels calculate in-sample predictions in MA models?

Running ...
ChickenGod's user avatar
0 votes
0 answers
2k views

Ordinal regression using statsmodels OrderedModel - basic interpretation

I want to run an ordinal regression in Python. My dependent variable describes a medical condition in an ordered manner (e.g. 0 = healthy, 1 = affected, 2 = very affected, 3= severely affected). I was ...
Jer Sto's user avatar
  • 13
0 votes
0 answers
24 views

Interpretation of Moving Average coefficient in ARIMA and its equivalance with exponential smoothing parameter

On Running an ARIMA (0,0,1) model from statsmodels.api on a differenced time series say X(t). I get the following output const = 5.34e-06 ma.L1 = 0.8934 How should I interpret the above MA model with ...
Math lover's user avatar
1 vote
0 answers
60 views

Exact diffuse initialization of the Kalman Filter: what does the design matrix look like?

I am using Python (statsmodels) to create a dynamic factor model on which I apply the Kalman filter. Thanks to earlier questions on this forum, I landed upon using exact diffuse initialization. My ...
eork's user avatar
  • 53
0 votes
0 answers
43 views

How to Improve forecasting efficacy on an ARIMA model in Python

I am new to Python and pieced some code together to construct a monthly forecast. The data is seasonal but the trend does not seem to be well defined. I've read a lot of posts on the reasons why the ...
Luis Gonzalez's user avatar
4 votes
1 answer
328 views

sklearn PoissonRegressor giving all coefficients zero

I'm doing a random exercise of comparing statsmodels and sklearn regression tools, specifically Poisson Regression (unregularised GLM). I am trying different libraries on the Insurance dataset from ...
A. Patel's user avatar
0 votes
0 answers
1k views

Clustered standard errors, python statsmodels

I am trying to understand clustered standard errors better. I created a very simple example: there are 100 rows, first 30 are from group 0 and next 70 are from group 1. I want to compare estimating ...
Gleb's user avatar
  • 1
0 votes
0 answers
48 views

Difference in the solutions of the linear regression problem: python-statsmodels versus python-sklearn

I have read in some blogs (I have not tested by myself) that (1) scikit-learn is slightly faster than statsmodels for 1,000 or less observations, this difference is not significant per the t-test ...
DanielTheRocketMan's user avatar
1 vote
1 answer
176 views

How to handle exact diffuse initialization of a Kalman filter?

This is partially a coding question so I hope I'm on the right platform for this. I am fitting a dynamic factor model using the state space framework. I don't know the initial distribution of the ...
eork's user avatar
  • 53
0 votes
1 answer
58 views

Maximum likelihood estimation with unknown distribution

I want to fit a model to some data using structural time series modeling and Kalman filtering. The hyperparameters need to be tuned using maximum likelihood estimation. I am using the Python package ...
eork's user avatar
  • 53
3 votes
2 answers
428 views

How does lowess handle gaps in time series?

I have been using the lowess smoother to calculate trends for time series data for a while now but until now my data was always without gaps. I now have to work with data where there are quite large ...
Krautsultan's user avatar
1 vote
0 answers
345 views

Statsmodel multinomial logistic regression outputs all nan values [closed]

I'm trying to fit a multinomial logreg with statsmodel. import statsmodel as sm X = sm.add_constant(df) logreg_model = sm.MNLogit(y[:n], X).fit() Where df is a one ...
pedritoanonimo's user avatar
1 vote
0 answers
294 views

Reconstruct a natural cubic spline from its fitted coefficients

Consider a predictor $X$ that predicts a non-linear response $y$. A natural cubic spline with $K$ knots can be fit to $y$. Several different linear basis expansions in $X$ can be used to fit the ...
Florent H's user avatar
  • 153
1 vote
0 answers
472 views

impulse response values VAR statsmodels

I am trying to understand how the values of the irf plots are estimated I read following page: https://www.statsmodels.org/stable/vector_ar.html But I don't understand how the values of the impulse ...
aze45sq6d's user avatar
  • 111
-1 votes
1 answer
115 views

How to interpret the results of a logistic regression in python [closed]

When I run a logistic regression using sm.Logit (from the statsmodel library), part of the result looks like this: The variable y is academic success (average greater than 10). The problem is that I ...
mferrer47's user avatar
1 vote
1 answer
80 views

Statsmodels VAR plot_acorr() amount of plots

I am working on a statsmodels VAR model to forecast some values and want to analyze the created model. In the examples and in some books I read about calculating the autocorrelation of the residuals ...
Krautsultan's user avatar
1 vote
2 answers
467 views

Validity of ANCOVA for Linear Models with Different Slopes

Does ANCOVA require homogeneity of regression slopes? In other words, do the slopes of the lines need to be the same in order to use this method? Per this blog post ANCOVA can be used to discriminate ...
Random Engineer's user avatar
1 vote
0 answers
700 views

How to calculate Prediction Intervals for time series forecasting with CI

I'm working on a project on time series multi-step ahead forecasting in Python. I have a time series, and I apply an ARMA model on it (statsmodels SARIMAX library). I know that ARMA models, as many ...
SuperFluo's user avatar

1
2 3 4 5
10