Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
0answers
5 views

Importance of tests summary in multiple regression using statsmodels

Greetings to the community. I have a practical question regarding the interpretation of the summary statistics that you get from statsmodels when you fit a model. I have e.g.,: model = smf.ols(...
0
votes
0answers
31 views

McNemar or Cochran's Q for evaluating multiclass classifiers?

full disclosure: I did a semi-cross post of this question due to low traffic. Once I get an answer on any of the two questions, I will link the answer back to the respective other. tl;dr For ...
3
votes
2answers
65 views

Does the dependent variable in a GLM have to be transformed before running the model or does the model do it?

I'm trying to fit a Tweedie model with statsmodels and was wondering if I have to transform the dependent variable before I run the model or if ...
0
votes
1answer
47 views

Why do I get NAN for p-values while using statsmodels logit function?

My data I used statsmodels to build a logistic regression as follows: ...
0
votes
0answers
27 views

Statsmodels Kalman Filter: simple equivalent to pykalman set up (partly answered) [closed]

Following some examples on Chad Fulton's blog and in statsmodels' tests, I have tried to come up with an equivalent of a pykalman implementation. The original question was deemed unclear and was ...
0
votes
2answers
105 views

Fitting pmf of a scaled Poisson distribution and Python histogram plotting

I have a nuclei meanlife of $550\mu s$, for which I've taken the frequency(rate) to be $1/meanlife = 1818$. I then sampled randomly from a poisson distribution with that frequency, taking the ...
1
vote
1answer
17 views

Why do you set 1 as intercept in linear regression model in python?

I'm learning linear regression in Udacity as a beginner. I know statsmodels.regression.linear_model.OLS() needs interception but why do you set ...
0
votes
2answers
36 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 ...
0
votes
1answer
56 views

Manually calculate SARIMAX forecast

I'm trying to manually replicate the forecast that I obtained using statsmodels.api sarimax (python). Its actually just an AR(1) model with one exogenous variable, in the form of SARIMAX(1,0,0)(0,0,0)...
1
vote
0answers
37 views

Statsmodels VECM - Predicting out-of-sample

After fitting a VECM model, I would like to study its out-of-sample behavior but haven't been able to find a way to do it. More precisely, given X_train and ...
0
votes
2answers
115 views

How can one interpret a heat map plot

I am doing a stats assignment in python and during my preliminary data analysis I created a heatmap plot and would like to be able to explain the correlation among the variables. However, I don't ...
0
votes
2answers
340 views

StatsModel Logistic Regression

I am running a fairly simple Logistic Regression model y= (1[Positive Savings] ,0]) X = (1[Treated Group],0) I got a coefficient of Treated -.64 and OR of .52. My question is how to interpret the ...
0
votes
0answers
23 views

Expected differences in charts when plotting additive vs multiplicative seasonal decomposition charts?

I've started studying time series analysis and I'm looking at additive vs multiplicative models. I've taken a sample dataset of flights and I've used python statsmodels to plot the seasonal ...
0
votes
0answers
29 views

Goodness of Fit Tests for Logistic Regression [duplicate]

I am trying to build a logistic regression model from a data set with several different features, and ~500 entries. Some of these features are discrete, some are continuous, and some are binary. What ...
0
votes
0answers
49 views

Statistical Model for multivariate timeseries

I'm new to timeseries prediction and I would like to try several classical methods before getting into more complicated model. Concretely, I have a multivariate timeseries of ...
0
votes
0answers
27 views

Dealing with correlated variables and choosing between models

One of the things I've always been confused about is the framework around model selection in the cases where $n$ predictor variables $x_i$'s are correlated. My thoughts on the different approaches: ...
2
votes
1answer
57 views

Removing Variance in Time Series After Applying Log Transformation

I'm trying to look at natural gas prices from 2003-2018. The issue is after applying log transformation and then diffrencing data by 1, I still seem to get an increase in variance from mid 2014-2018. ...
0
votes
1answer
66 views

Different regression coefficients from statsmodels OLS API and formula ols API

I work at a relatively large Swedish retail company where I am currently performing initial linear regression in order to understand the linkage between dependent variable store sales (number of ...
0
votes
0answers
24 views

Abbreviations: StatsModels handling NaN

In StatsModels there are keywords to specify how to deals with NaNs. 'none' := no checks for missing values 'drop' := drops missing values 'raise' := raises an error But there is another keyword: '...
0
votes
1answer
94 views

within-subject regression analysis

I have three levels (suppose A,B, and C) in my experiment and wish to do within-subject regression analysis. All the 3 levels are manipulated within-subject. Also A is outcome category, B is outcome ...
2
votes
1answer
339 views

Python ARIMA generates different predictions than SARIMAX for same orders

I was under the impression that Python Statsmodels SARIMAX with seasonal order parameters set to 0 will generate the same forecasts as ARIMA. But apparently the forecasts are wildly different. What ...
0
votes
0answers
287 views

Why are the critical values in coint_johansen in statsmodels in Python so different from the ones in ca.jo in urca in R?

When i run the same johansen test across Python and R I get very different critical values. If I normalize the two columns in <...
0
votes
0answers
82 views

regression change point model

I am novice at best with linear regression models and I am interested to learn how to do a change point model in Python if possible. The data that I analyze is a years worth of electrical energy (kWh) ...
1
vote
1answer
572 views

Paired samples t test in Python

I'm trying to conduct a paired samples t-test in Python (statsmodels package), but I don't see a function for it in their documentation. The closest I can find is ttost_paired, but I don't think its ...
0
votes
1answer
300 views

Statsmodels' Negative Binomial: after .fit_regularized(), how to turn PMF into PPF to get the discrete values?

I used the package statsmodels to fit a Negative Binomial to my data. This data contains ~1500 samples with 21 covariates. Since I have overdispersion in my data ...
0
votes
1answer
307 views

2-way ANOVA in Python statsmodels yields different Sum of Squares than SPSS

I am learning to use Python for my statistical analyses, and while figuring out how to perform a 2-way ANOVA with statsmodels I found that my Python code yielded slightly aberrant values. Comparing ...
2
votes
1answer
175 views

Apply statsmodels PCA to new data

I am working on a personal project, and I want to use Statsmodels' PCA on a dataset. The ultimate goal is to then perform a linear regression and evaluate its prediction. I know scikit-learn may be ...
0
votes
1answer
73 views

Ljung-Box test on a out of sample residue with good forecast

To test the fbprophet library, I created a very simple synthetic series and generated a model like this: ...
4
votes
1answer
44 views

Appropriate Distribution for Survival Probability Parameters

I have a model that assumes a probability of survival over discrete time (example: decades) ...
0
votes
1answer
70 views

zero inflated poisson iregression AIC values

Im trying to regress count data (DV). There are a few IV's both continuous and categorical. Frequency count of my DV as show below.Two groups , treatment and control. About 75 % are zeros. ...
0
votes
1answer
338 views

Tukey HSD plot_simultaneous - how does it work?

I have performed a Tukey HSD in Python. I am not sure what values are plotted when using the .plot_simultaneous() command (see statsmodels documentation). The resulting plot is: I am wondering: how ...
0
votes
0answers
131 views

Are these Granger-causality F-tests equivalent?

I am comparing results of a Granger causality implementation I wrote in Python to the established package statsmodels, and noticed that the equation implemented has a scaling factor equal to the ...
0
votes
0answers
46 views

How to interpret regression results when there are categorical independent variables? (statsmodels | python) [duplicate]

I'm using a toy dataset from sklearn and adapted it for a linear regression framework. In this example, I'm constructing a ...
0
votes
2answers
141 views

Is this linear model overfitting when I add more parameters?

I am trying to figure out if my models are overfitting. This is a trend I noticed with my actual dataset associating metadata with compositional data. The more parameters I add, the better the ...
8
votes
2answers
5k views

Can we say 50% of data will be between 25th-75th percentile?

Let's say we have the following dataframe: ...
1
vote
0answers
30 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: ...
0
votes
3answers
522 views

SARIMAX(1,0,0)(0,0,0,0): Regression with ARMA errors or ARMAX?

I'm trying to unravel the influences of various exogenous regressors on a time series dataset. I'm getting good results with a sarimax(1,0,0)(0,0,0,0) specification, but I'm confused about the ...
7
votes
1answer
850 views

The identity link function does not respect the domain of the Gamma family?

I am using using a gamma generalized linear model (GLM) with an identity link. The independent variable is the compensation of a particular group. Python's statsmodels summary is giving me a warning ...
0
votes
0answers
132 views

ADF test and seasonal series

Hi I'm new in the time series field and so I've different doubts. Considering this dataset https://archive.ics.uci.edu/ml/datasets/Individual+household+electric+power+consumption And considering ...
1
vote
2answers
128 views

Nonlinear regressor in GLM link function

Try to reproduce Robert E. McCulloch and Ruey S. Tsay’s paper Nonlinearity in High-Frequency Financial Data and Hierarchical Models with local market data. the paper uses GLM to model high-frequency ...
1
vote
0answers
107 views

How to make statsmodels treat timeseries values as continuous? [closed]

This is basically a copy of the stackoverflow question here, which never received an adequate answer. The problem is that the Python's statsmodels package insists ...
1
vote
0answers
23 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 ...
3
votes
2answers
1k views

Why is gradient descent so bad at optimizing polynomial regression?

As part of a self-study exercise, I am comparing various implementations of polynomial regression: Closed form solution Gradient descent with Numpy Scipy optimize Sklearn Statsmodel When the ...
1
vote
2answers
160 views
1
vote
1answer
723 views

Interpretation of PACF and ACF plots [duplicate]

I am trying to fit an ARMA model to a time series of a power spectral density values that I have calculated. Here is the plot of the data: with corresponding autocorrelation and partial ...
0
votes
1answer
88 views

Can log-likelihood of the data decrease when adding parameters in a linear mixed model?

I'm trying to fit different linear mixed models in the context of model selection. I'm using the StatsModel Python package in order to do that. However, I encounter a very strange phenomenon. Say I ...
2
votes
0answers
901 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
1answer
30 views

model building - regression in statistical analysis

I have a theoretical question regarding model building. I have some real empirical data, but I will present the problem in more general terms. I have two groups. I have a dependent variable, and an ...
1
vote
2answers
465 views

Mixed Effects Model with Pre-Post Dependent Variable

I have a dataset that most likely requires a mixed effects model, but which has a few quirks that make me want to confirm that my current modeling approach is correct. Background My DV is a ...
0
votes
2answers
2k views

statsmodels SARIMAX forecast has downward slope

I fit a statsmodels.tsa.statespace.sarimax.SARIMAX model (statsmodels==0.8.0) but I'm getting unexpected forecasting behavior, ...