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
0 votes
0 answers
28 views

State space models in python statsmodels: including lag state innovation in observation equation

I am trying to fit the following state space model via the (excellent and highly useful) statsmodels state-space module. The model is a standard local level model but where last period's innovation ...
  • 1
0 votes
0 answers
12 views

Simulating Ordered Logit Model with Statsmodels in python

I am trying to recreate an analysis in which the first step is creating an ordered logit model to predict class probabilities. The model is: y' = βx + error, error ∼ L(μ|σ), μ = 0, σ = π/√3 To ...
0 votes
0 answers
11 views

Finding Confidence

I am running A/B testing . Created 4 groups with 3 group as variant and one as Control. I found the confidence values for this hypotheses More Number of events(Group) per day Drive Higher Uninstalls ...
0 votes
0 answers
19 views

One-sample hypothesis test for population proportion [closed]

I'm stuck folks. Help an old lady out will ya? Here's what I've got to complete: Load the gpa.csv data set. Find the number of students with a gpa greater than the user input value. Find the total ...
  • 1
1 vote
0 answers
22 views

Fitting TVP-VAR statespace mlemodel in statsmodel

1 Thanks to everyone in advance for their time! I am trying to run a TVP-VAR for a panel in the statespace mlemodels in statsmodel. I get an error while trying to fit the model ...
  • 21
0 votes
1 answer
30 views

What's the difference between statsmodels' RLM and robustbase's glmrob?

The Python package statsmodels comes with robust models of linear regression (RLM, https://www.statsmodels.org/stable/rlm.html). ...
  • 1
1 vote
0 answers
5 views

Can I run a Manova after conducting a cluster analysis?

So my study intends to conduct a cluster analysis using 2 variables (RP and AP). I intend to find four clusters (AC, BC, CC and DC). I would then like to examine differences in education, height, age, ...
  • 11
1 vote
1 answer
23 views

SARIMAX prediction: including 'deterministic polynomial trend'

I'm wanting to use Statsmodel's SARIMAX model to predict sharemarket values into the future. This is part of a larger effort towards helping strictly non-profits and social-enterprise organisations. ...
1 vote
0 answers
60 views

"SVD did not converge" while using statsmodel.timeseriesanalysis.MarkovRegression

I am trying to fit a MarkovRegression model sm.tsa.MarkovRegression(spread, k_regimes=2, switching_variance=True) to a time series of price spread. This is the ...
0 votes
1 answer
30 views

statespace mlemodel in statsmodel does not converge

I'm trying to estimate the following state-space model: $$ y_{t} = \begin{bmatrix}1& 1 \end{bmatrix}\begin{bmatrix}\mu_{t}\\v_{t}\end{bmatrix} + \epsilon_{t},\quad \epsilon_{t}\sim N(0,\sigma_{\...
  • 3
1 vote
0 answers
15 views

How is it possible that the statsmodels KPSS test rejects trend-stationarity but not stationarity?

take the time series in the code block below - if I run a KPSS test using statsmodels based on a regression around a constant (i.e. test for regular stationarity), ...
  • 51
0 votes
1 answer
29 views

Multi-level mixed effects model - intercept insignificant

I am running a multi-level model in R, and the results suggest that the intercept is highly non-significant p = 0.9, but that two of the variables are significant. All the variables are Likert scores ...
  • 1
0 votes
1 answer
41 views

Are all difference stationary time series trend stationary?

My understanding of this article and this article is that: If a time series needs to be differenced to become stationary (i.e. is difference-stationary), then it has at least one unit root Trend-...
  • 51
0 votes
0 answers
37 views

Understanding deterministic processes from a variable/feature

I have been trying to understand the statistics behind a deterministic process. I'm currently doing this exercise from this guide to understand better seasonality and time series modeling. This code ...
  • 343
1 vote
0 answers
28 views

TVP-VAR fails statespace.MLEModel

I am trying to run a TVP-VAR for a panel in python using statsmodels. I am using the site example, trying to adopt it in my model. Data are from 1945-2020 for 50 countries Furthermore, I am getting ...
  • 21
2 votes
1 answer
78 views

Why is my statistical prediction interval not as I'd expect? (statsmodels, python)

I am using the statsmodels python package to perform multivariate linear regression. I want to produce 80% prediction interval bands as part of my result. The statsmodels package can produce ...
  • 95
0 votes
1 answer
63 views

What are the main difference between a QQ plot and a probability plot for measuring nomality? [duplicate]

I am trying to evaluate the normality of the distribution of my model's residuals. I have been using statsmodels.api.qqplot and ...
  • 95
1 vote
1 answer
42 views

linear regression and logistic regression global p values aren't associated to the same test? How to interpret them?

I'm using the package statsmodels in Python 3.9.10. When I carry out a linear regression model, I get this: Am I right when I ...
2 votes
1 answer
58 views

Scikit-learn QuantileRegressor memory allocation error. No issue with statsmodel QuantReg with the same data

I'm trying to fit a quantile regression model to my input data. I would like to use sklearn, but I am getting a memory allocation error when I try to fit the model. The same data with the statsmodels ...
  • 95
0 votes
0 answers
25 views

Simulating from VECM to VAR in statsmodels

I need to simulate from a VECM in Python. My VECM doesn't have constants nor linear trends (this holds true for both inside and outside the cointegration matrix). However, the statsmodels VECM doesn't ...
  • 595
1 vote
1 answer
108 views

How to interpret the current function value in the logistic regression from the statsmodel api?

Whenever I train a logistic regression model with the statsmodel api, it always feeds back a message similair to this one: ...
0 votes
0 answers
22 views

Dynamic linear Regression model using dynlm

I came across the package "dynlm" which offers the function dynlm to create lagged independent variables. I have 3 time series as Independent variables (PSVI,NVSI,BTC_RET) and I want to ...
0 votes
1 answer
20 views

Mean of target variable differs by one percent for independent variable, yet it has a coefficient of 0.43 and is highly significant in logistic reg

I have a dataset that contains information on what an individual likes! The question is posed do you get energy from ..... (my X). These X variables are categories. One of these categories is whether ...
1 vote
0 answers
76 views

OLS regression - Create a map from categorical location-related variable?

With multiple linear regression in Python/statsmodels I would like to analyze quote data from the last 10 years as a hedonic price regression. The dependent and independent variables are given in the ...
  • 11
1 vote
0 answers
50 views

Using a log-poisson model to predict mortality

I'm trying to build a GLM in Python that uses a log-poisson model from the statsmodels package to predict mortality rates. I have a policy level dataset that, among other features, contains attained ...
  • 11
2 votes
1 answer
76 views

Why does the order of the pair of series passed to a cointegration test matter?

Update 2022-07-13 My question could be rephrased as Why do I get a different result for cointegration test when I swap the independent and dependent variables? The link leads you to a thread on this ...
  • 41
1 vote
1 answer
317 views

Implementing a Conditional Logit in Python StatsModels

I have a dataframe with some horseracing data, and each row contains a predicted speed rating for each of the runners. I am now trying to convert that information into a winning probability for each ...
  • 31
0 votes
0 answers
35 views

Creating custom trends or perform trend reversal in unobserved components model

I am using statsmodels unobserved components model to forecast some time series. I use the 'local linear trend' model, however I expect a reversal of trend at some point in the future. Is there a way ...
0 votes
1 answer
37 views

Parameters of Linear Regression... predictor must be normal? [duplicate]

I am reading about the standard errors of parameters in the linear regression: $$ y^{*}=\beta_0+\beta_1X+\epsilon$$ with this, I mean the variance of $\beta_0,\beta_1$. The proof assumes that the ...
0 votes
0 answers
15 views

linear mixed effects model comparing recorded data to 'random' control data

I'm new to mixed-effects models and have some questions about the best way to analyze my data. Experimental Design: I have x-y coordinates for groups of 5 fish swimming around freely in a tank. We are ...
  • 97
0 votes
0 answers
9 views

Forcing Statsmodel Formula regression through Origin [duplicate]

I wrote following code model1 = smf.ols(formula="Annual_Sales ~ Confidence_Match_Score + Annual_Sales + 0", data=df).fit() Now using the above the code ...
0 votes
0 answers
34 views

How to use log-likelihood for linear mixed model selection using statsmodels

I've ran a linear mixed model using statsmodels and obtained the follow result: ...
1 vote
1 answer
357 views

Getting confidence interval for prediction from statsmodel Robust Linear model

I'm using statsmodels to fit a statistical model. I have a formula that is fitted like this: ...
2 votes
1 answer
207 views

Linear Mixed Model R2 Calculation using statsmodels

I've ran a linear mixed model using statsmodels and obtained the follow result: ...
0 votes
0 answers
32 views

statsmodels.adfuller weird behaviour of usedlag value

I'm learning about time-series analysis and have two series on which I'm performing an Augmented Dickey-Fuller test in order to check for stationarity. I'm trying to understand why I get very ...
0 votes
1 answer
86 views

Getting different AIC / BIC values for AR(2) estimation via AutoReg(2) vs ARIMA(2,0,0) through python statsmodels

I am trying to fit an AR(2) model to a data series claims_df['initial claims'] via statsmodels.tsa.ar_model.AutoReg and ...
0 votes
0 answers
12 views

Winning Bid probability [duplicate]

I had asked this question earlier, but I guess I was too late to respond to the questions. Hence reposting. Top 10 win probabilities I have a task at my hand to create some kind of model that can help ...
0 votes
1 answer
486 views

Doubts with cross correlation in Python's statsmodels

I have been trying to understand statsmodels.tsa.stattools.ccf, the cross correlation between two random vectors and I tried ...
  • 281
0 votes
0 answers
22 views

what formula does python statsmodels library uses to compute the bp_stat value (the Q value for the Box Pierce test)

As far as I know, the $Q$ statistics is computed with the formula $Q = N \sum_{j=1}^K \rho_j^2 $ I created an example where I compute $Q$ by hand and by using:\ ...
0 votes
0 answers
34 views

Help Johansen test interpretation for co-integration confirmation

I have run following test ...
  • 51
0 votes
0 answers
53 views

Top 10 win probabilities

I am a newbie here, hoping to find the right response for my question. I have a task at my hand to create some kind of model that can help me to determine what is the chance of winning a certain ...
0 votes
0 answers
79 views

Replicating a nested mixed effects model in R using python statsmodels

I am using this tutorial that is written in R to build a nested mixed effects model. The R code is as follows: ...
2 votes
1 answer
94 views

Linear model coefficient has a high p-value (insignificant) but the fitted value looks perfect

I have made an OLS model using statsmodels in python, in an attempt to model the response variable: energy cost per tonne. Note: ...
  • 125
0 votes
0 answers
20 views

How to improve statsmodels SARIMAX forecast [duplicate]

I am trying to improve my statemodels SARIMAX model compared to the below naïve forecaster. Naive forecast = y.mean() + ( X-X.mean() ) * y.std() / X.std() where X is a series that has .75 ...
  • 1
0 votes
0 answers
17 views

Is the likelihood of a discrete binomial variable same as it probability? Like in the case of tossing a coin lets say 12 times

I am working on a probability project where we first generate random variables for a given Binomial experiment and then we generate a PMF for 10 coin tosses using the list of random variables we ...
  • 1
1 vote
0 answers
63 views

How do you calculate F-value for three groups, given only the mean and standard deviation in Python

I am learning about power analysis for different scenarios in Python, e.g. for three groups (assuming equal sample in each group). I've seen videos demo for SPSS and other softwares, where you simply ...
1 vote
0 answers
38 views

Modifying covariance structure in statsmodels mixedLM

I am using the following command to fit a linear mixed model for repeated measures (MMRM) in statsmodels: ...
  • 31
0 votes
0 answers
94 views

Explained and Unexplained Effects don't add up to gap in Oaxaca-Blinder decomposition (statsmodels)

Here's a Python implementation of Oaxaca-Blinder decomposition analysis using statsmodels. First, how do I interpret the negative value for Explained Effect here? ...
0 votes
0 answers
326 views

Python: Markov switching model out of sample forecasts

Is there a way to obtain out of sample forecasts for Markov switching models estimated via statsmodels (or any other package)? https://www.statsmodels.org/dev/examples/notebooks/generated/...
  • 123
0 votes
0 answers
52 views

Mixed model with nested fixed and nested random effects

This question is related to an earlier one that I've posted (but I must admit, that I was very unspecific in this thread, so I am making an effort to be more explicit here). I have a dataset that ...

1
2 3 4 5
9