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.

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

Statsmodels tests for proportions give different results than other software

An example from Primer of Biostatistics by Glantz: 8 patients out of 61 died while undergoing heart surgery with one anesthetic. With another anesthetic, 10 patients died out of 67. If we use R, chisq....
1
vote
1answer
43 views

How can I edit this code to determine the accuracy of data? [closed]

My employer has asked me to perform a few analysis on a data about wood piles which contains their diameter and bark thickness. I am a beginner in R and started with some basic descriptive analysis ...
1
vote
0answers
29 views

How To Approach Fit Method Selection for SARIMAX Models

I am building SARIMAX models using the statsmodels library in Python. Some of these models are single variable models and some are multi variable models. In general, I am finding that I get very ...
1
vote
1answer
22 views

Why is the mean of confidence interval the same as the coefficients in Logistic Regression?

I'm currently using statsmodels library to train a Logistic Regression. However, I noticed that logit.conf_int().mean(axis=1) and logit.param generates the same values. Why is that? What am I missing ...
3
votes
2answers
69 views

Different results for ANOVA power calculation by R and statsmodels

I am studying statistics now so the example is from a textbook. We have 3 groups with means 11.5, 10.1, 9.1 but want to see what would be the test power for a difference of 1.0. So for this assumed ...
0
votes
1answer
25 views

Studentized residuals when I have an observed and predicted value in a dataframe without a model in Python?

I have data that contains observed and predicted values in a dataframe - thus the residual can be calulated. But, how can I calculate and plot Studentized Standardized Residuals without building a ...
0
votes
0answers
12 views

How to generate a state space model from data?

I am trying to identify a state space model from discrete time series data in Python using statsmodels library: ...
1
vote
0answers
16 views

What units are the cumulative response functions of a VAR measured in, and why does orthogonalisation appear to change the scale?

There are quite a few questions on this site regarding the interpretation of the impulse-response-function plots of a VAR, but none answer my query directly. I will attempt to be as concrete as ...
0
votes
0answers
15 views

Impulse response function of the exogenous variable in a VARMAX model

I am learning about VAR models "by doing", so to speak. I am using statsmodels; comparing the documentation on VAR and VARX models, I would like to ...
0
votes
0answers
16 views

Understanding how seasonal terms are calculated in unobserved components model (statsmodels)- python

Context I am running an unobservedcomponents model from statsmodel api in python The data is daily in nature , and these are the parameters I have set for my model: I have a day of week pattern in ...
0
votes
1answer
33 views

Interaction for dummies

I used an OLS regression to find correlation between wage gaps and skill similarity in a paired combinations data (ie. A|B, A|C, B|C). To expand the analysis, I included workplace gender distribution ...
0
votes
0answers
20 views

SARIMAX's predictions are pretty inaccurate - what am I doing wrong?

I have flu incidence rates from 2009 to 2014. I have also multiple columns with environmental with mean, max, min temperature, mean, max, min humidity, mean, max, min rain + couple of extra ones. The ...
0
votes
1answer
42 views

ARMA Model constant estimation in statsmodels library

I have a question concerning the statsmodels library, I am just trying to play a bit with that library in order to understand how it work. ...
1
vote
1answer
47 views

SARIMAX model slopes downwards instead of upwards

I'm a complete beginner to time series forecasting, so I worry that some of my questions might be downright stupid, but here we go. My Code: I am trying to fit a SARIMAX model to predict CPRAVG while ...
0
votes
0answers
32 views

Unexpected fittedvalues using statsmodels SARIMAX [duplicate]

I have noticed that SARIMAX model in statsmodels does not produce the expected (correct) fittedvalues when the model is specified as an ARMA. Below is an example showing the discrepancy between what I ...
1
vote
0answers
9 views

Can I enter missing responses as a covariate in ANOVA when compare across groups?

I have a dataset collected from 3 groups of clinical samples. I want to compare measures among 3 groups but each group has substantial missing responses. What are the strategies for handling missing ...
1
vote
1answer
73 views

Probability of $X$ > $Y$, given $X$, $Y$ being the maximum of distinct Normal Distribution Families

Let $ \begin{matrix} X_i & \sim & N(\mu_X, \sigma_X^2) \\ Y_i & \sim & N(\mu_Y, \sigma_Y^2) \\ X & := & \max(X_i, i \in \{ 1,2, ..., n_X\}) \\ Y & := & \max(Y_i, i \...
1
vote
1answer
46 views

Time Series Model (SARIMA) Consistently Underpredicting

I have a SARIMA model of order (0,1,1)(0,1,1)52 on a log transformed variable (originally non-negative count data, y = log(x+1), '+1' as zero is possible for x). The series plot along with prediction (...
0
votes
0answers
20 views

Does Box-Cox need to be Reversed Prior to Running Model Evaluation?

I am building an ARIMA time series model using the Statsmodels package for Python. As a part of my pipeline, I am doing Box-Cox transformation on the response variable (i.e. the series I am seeking ...
2
votes
2answers
39 views

Interpreting odds ratio units

I'm running logistic regressions in Python using statsmodels logit and, downstream, am calculating odds ratios for each independent variable. I know that, conventionally, an odds ratio is interpreted ...
1
vote
1answer
21 views

Confirming the dependent variable / outcome in logistic regression

I'm running logistic regressions in Python using statsmodels logit. My dependent variable is binary, 0 or 1. How do I know whether the regression is modeling an outcome of 1 or an outcome of 0 for ...
1
vote
0answers
25 views

Mixed effect model with one vs two random slopes

I am running a multilevel model in R looking at the responses of 5 different groups of participants across 4 conditions. I am adding individual random effects to account for the variability among ...
0
votes
0answers
17 views

How to find optimal p, q, d values for an ARIMA Model?

I have collected a downlink network throughput trace. I want to predict the throughput for future forecasts using ARIMA. This is how the rolling avg of my data looks like. The autocorrelation graph is ...
0
votes
0answers
12 views

Causal inference and components relationship

I am fairly new to more advanced stats and I am looking for a way to model the influence of features into one another in a group. Imagine we have 3 people: A, B, C; These people take some time to ...
0
votes
0answers
8 views

2 dependent variables (cont and cat), 2 independent ones (cat): Manova?

I'm trying to interpret some results I have from a Stroop test. My hyphotesis was that emotional words would have a higher reaction time than neutral words. I have 4 variables: 2 dependent ones (...
1
vote
0answers
59 views

Performance of Holt-Winter´s seasonal method is different from Python to Excel

I have to code the "Forecast.ETS" function from excel in Python to predicts a future values based on existing (historical) values. In the Excel documentation they write that it is based on ...
1
vote
0answers
71 views

Statsmodels MixedLM - How to get group coefficients?

I recently switched from using Pymer4 to Statsmodels. I am working with a random intercept model, and I need to get the conditional coefficients estimated for each group (i.e., random + fixed effects) ...
0
votes
1answer
31 views

statsmodels SARIMAX simulate generate negative values?

I read the example code here on how to simulate a time series: Sampling with python statsmodels ARIMA package I used myseries data and it simulated a series. However, the values are negative? I ...
0
votes
0answers
8 views

Untangling complex interaction with 24 cells

I have evaluated a number of models, using several metrics. Each model is the result of a combination of two variables: type and compression. There are 4 types, and 6 compression rates. Here's a ...
0
votes
0answers
28 views

control for a variable in python

I am trying to perform multiple linear regression using statsmodels while controlling for one variable but I am not sure how to control for a variable in python. ...
2
votes
1answer
44 views

Mixed Effect Model Coefficients

I am trying to fit a mixed effects model in python ( using MixedLM model from "statsmodels.regression.mixed_linear_model" ) for inferential purposes. I have an intercept 'a', a slope ...
0
votes
0answers
17 views

Is it necessary to evaluate model performance for logistic regression inferencing (vs prediction)?

I'm newer to the world of statistics, forgive me if this is a rudimentary question. I transitioned from point-and-click SPSS to Python, and am realizing that one can use logistic regression for ...
0
votes
0answers
26 views

Trying to replicate stats model auto correlation function using scipy

I have a residual made from a compressed sensing 1D reconstruction (observations - model). I am trying to plot and interpret the autocorrelation of my residuals in order to know how close they are to ...
1
vote
3answers
79 views

mixed linear model for repeated-measures

I am trying to analyze if I can expect some differences between regions in the following dataset. I believe (I am not sure at all) that one way to do this is to use statsmodels: I have got 4 subjects, ...
1
vote
1answer
98 views

Exogenous variable in the state equation in statespace MLEmodel in statsmodels [closed]

I'm trying to fit the following model: $y_t = \left[\begin{matrix} (1-w) & 1 & w \end{matrix}\right] \left[\begin{matrix} d_t \\ \mu_t \\ m_t \end{matrix}\right] + \mathcal{N}(0,\sigma_\eta^2)...
0
votes
0answers
34 views

'low limit of 30% confidence interval' is higher than 'forecasts' in arimax model

I ran the ARIMAX model for multi-step forecasts (steps=n). The code was written in python and I used the ARIMA model from statsmodels library. (https://www.statsmodels.org/stable/generated/statsmodels....
0
votes
0answers
19 views

Large negative intercept value in python statsmodels regression for a time-series [duplicate]

I am quite new to regression analysis and am using python's statsmodels. My dataset is a time-series, which consists of values of a variable recorded for a long ...
2
votes
1answer
82 views

Hyperparameter tuning of statsmodels quantile regression

I am working in statsmodels and I am trying to do linear quantile regression with the function QuantReg. I can however not figure out a way to tune any ...
0
votes
0answers
96 views

How to correct conditional Poisson standard errors for over-dispersion

I want to estimate a conditional negative binomial model, which an economist might call a negative binomial model with individual fixed effects. I use Python and statsmodels, which has a conditional ...
0
votes
0answers
15 views

How to set Ancova model for following data and hypotheses with attached dataset

How to set Ancova model for following data and hypotheses with attached dataset Data set :
0
votes
0answers
156 views

Python statsmodels, handling over-dispersion for Poisson Regression

I have a Poisson model (displayed below), where my $\epsilon_e$ term is designed to handle over-dispersion. I was curious if statsmodels has an easy way of returning a coefficient $\epsilon$ that fits ...
0
votes
1answer
83 views

Python statsmodels error when trying to use OLS to calculate price elasticity from sales history

I have some order data with the items included in it, the prices of each item, the brand, the customer and the date of the order that I am trying to use to calculate the price elasticity of the ...
1
vote
1answer
163 views

Calculating AIC & BIC

I have an output from two LMER-models and I'd like to calculate AIC & BIC. I believe I've understood the tables correctly, but I'm uncertain regarding the k parameter; have I understood it ...
0
votes
0answers
112 views

Python statsmodels. How to compared nested GLM , binomial family , with an anova test?

I'm trying to test if the addition of extra variables reduces the residuals variance and improves the model fit. Consider the below reproducible example: ...
0
votes
0answers
13 views

Repeated measure ANOVA with Zero for baseline

I have 20 patients and I'm measuring their blood drug level at different time with increasing doses recorded 3 times and compared with baseline which is zero for all. Can I use repeated measure ANOVA ...
1
vote
1answer
68 views

Interpretation of Group Var and visualizing LMER-model

I've fitted an LMER-model in Statsmodels, and I'd like to illustrate my results with a plot. My data consists of 14 groups, measured once daily during a timeperiod of 15 days (there are a few ...
0
votes
1answer
48 views

Computing condition number for OLS

In https://www.statsmodels.org/0.8.0/examples/notebooks/generated/ols.html, if you scroll down to the section "Multicollinearity" (bolded), it shows that the condition number of $X$ is $4....
0
votes
1answer
45 views

Choleskly constraint in mlemodel in statsmodel

I want to constraint the off diagonal terms in the covariance matrix in a dynamic linear model. I tried using Cholesky method but it does not seem to converge. I am trying to fit a multivariate CAPM ...
0
votes
0answers
88 views

Markov Autoregression model not converging

I am trying to fit Markov Autoregression model to S&P500 data similar to https://www.statsmodels.org/devel/examples/notebooks/generated/markov_autoregression.html This is the code ...
1
vote
1answer
105 views

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

I am very new to time series modeling and statsmodels and trying to understand the AR model in statsmodels. Suppose I have a data record y of 1000 samples, and I ...

1
2 3 4 5
7