2,852 questions
-2
votes
0
answers
21
views
How Calculate PostHoc Power and Effect Size for all Numeric Columns in Python
I generated a random dataset that has 1 categorical column and 30 numeric columns. The categorical variable has 3 classes X, Y and Z. See data generation code below
I need help with Steps 2,3 and 4:
...
2
votes
1
answer
257
views
Multinomial regression with statsmodels.formula.api is not working for me
Whenever I try to build a multinomial regression using the R-style formula approach in statsmodels in Python, I get ValueError: endog has evaluated to an array with multiple columns...
Here's a ...
3
votes
2
answers
124
views
In "statsmodels" Python library, why does z-test not require Population standard deviation?
So to execute a z-test in python, I have seen people doing:
from statsmodels.stats.weightstats import ztest as ztest
# IQ levels of 20 patients post medication
data = [88, 92, 94, 94, 96, 97, 97, 97, ...
0
votes
0
answers
30
views
why does `qqplot` from `statsmodels.api` produce two plots?
Using statsmodels.api to produce a qqplot leads to doubling the expected plot, with a strange positioning of the titles, and 2 different plot sizes...
The following small code is an example I made to ...
1
vote
0
answers
14
views
VARMA runtime issues: fixed window rolling forecasting
I'm currently exploring a couple of statistical forecasting methods. My problem rose when using VARMA(2,1) fixed window rolling forecast. The example code that I'm using is the following:
Here I only ...
0
votes
1
answer
44
views
Python running probit model: len() of unsized object
I am trying to run a super simple python script where I pull data from a sql query and then extract the appropriate variables to run a probit on. nl and the variable names listed in cols are all long ...
1
vote
1
answer
85
views
saving statsmodel to adls blob storage
i currently have a model fit using statsmodel OLS formula and I am trying to save this model to ADLS blob storage. '/mnt/outputs/' is a mount point I have created and I am able to read and write other ...
1
vote
0
answers
60
views
How to replicate statmodels' ARIMA fittedvalues for a MA(1)? (Python package)
Let's simulate a MA(1) process using numpy
import numpy as np
# Simulation parameters
n = 20 # Number of observations
theta_1 = 0.7 # MA(1) coefficient
sigma = 1.0 # Standard deviation of white ...
0
votes
0
answers
37
views
How can I extract absolute beta coefficients for all levels of multiple categorical variables in statsmodels?
I’m performing linear regression in Python with statsmodels. I have two categorical predictors:
sample: a factor with 8 levels
distractor: a factor with 2 levels
My goal is to determine the “...
1
vote
1
answer
50
views
How to get static ARIMA forecasts with statsmodels
I'm trying to replicate a Stata ARIMA analysis in statsmodels. This analysis used static predictions from its ARIMA (1,0,4) model with four exogenous regressors. I've replicated the model – both Stata ...
0
votes
1
answer
43
views
AttributeError: 'SVARResults' object has no attribute 'k_exog_user'
I am using the following code to conduct a SVAR estimation:
data_q = pd.DataFrame({'GDP': GDP,
'CPI': CPI_q,
'Interest_rate': Interest_rate_q,
...
1
vote
0
answers
43
views
SVAR from statsmodel.tsa: if len(A_guess) != n_masked_a: TypeError: object of type 'int' has no len()
I am using the following code to conduct a SVAR estimation but it keeps crashing, always the same kind of error:
len(A_guess) != n_masked_a: TypeError: object of type 'int' has no len().
CAN ANYONE ...
1
vote
0
answers
73
views
Can statsmodels be used to obtain clustered standard errors in a fixed effects regression model? (Python)
I have a cross-sectional dataset and am doing some simple econometric exercises with it using the statsmodels package in Python. At a certain point I tried to run a fixed effects regression model ...
0
votes
0
answers
51
views
Setting parameters of Exponential Smoothing?
I'm trying to get the same results from my Exponential Smoothing function and the built-in one. Here is my implementation.
def exponential_smoothing(series, alpha):
smoothed = [series[0]]
...
0
votes
0
answers
27
views
SARIMAX Model In-Sample Predictions for different Exog Variable
I am working with a SARIMAX model trained on a given dataset. I am trying to get an in-sample forecast but using different values for exog variables. This is to test how the forecast changes with ...
0
votes
1
answer
354
views
statsmodel glm and generalized linear model formula have inversed coefficient results
I am new to using statsmodel in python (and a lot of more generalized statistics in general), but I have a question regarding the difference between how sm.GLM and smf.glm calculate their results. ...
-1
votes
1
answer
63
views
How can we calculate mean absolute error (MAE) for zero-inflated Poisson regression and zero-inflated negative binomial regression?
I am trying to use Python to calculate mean absolute error (MAE) while doing zero-inflated Poisson regression and zero-inflated negative binomial regression.
I separated data into training data and ...
1
vote
0
answers
97
views
Issue with calculating confidence intervals for odds ratios
I'm working on a statistical analysis to calculate odds ratios and their 95% confidence intervals for several variables over specific time points. While the odds ratios are being calculated correctly, ...
0
votes
1
answer
62
views
NaN in output when trying to use an ARIMA model
Construct a graph of the value of the Russian ruble against the Egyptian pound based on data at the end of trading. Select the best ARIMA model, predict further exchange rate values based on it, ...
1
vote
1
answer
113
views
Export statsmodels summary() to .png
I have trained a glm as follows:
fitGlm = smf.glm( listOfInModelFeatures,
family=sm.families.Binomial(),data=train, freq_weights = train['sampleWeight']).fit()
The results looks good:
...
0
votes
1
answer
970
views
Compile, install X-13ARIMA-SEAT on macOS Apple Silicon (ARM64) and use it in sm.tsa.x13_arima_analysis()
I am struggling to compile and use X-13ARIMA-SEAT on a Mac with an m3 chip, and called it using sm.tsa.x13_arima_analysis(s, x12path='/usr/local/bin/x13as') in statsmodels. Finally, I succeeded and ...
1
vote
0
answers
31
views
Why does statsmodels include interaction with reference?
I'm trying to create a Tweedie Regression in statsmodels. The regression basically has three categorical predictors which have four levels each. To ilustrate, here is an example:
import pandas as pd
...
0
votes
1
answer
128
views
Error in predicting probabilities of conditional logit using statsmodels
I am trying to produce the predicted probabilities of a conditional logistic regression model that is built with a case-control dataset using statsmodels package (0.12.2) in Python. The package ...
1
vote
0
answers
237
views
Does coint from statsmodels.tsa.stattools in python consider stationarity?
At the base level I am trying to determine if two stocks are cointegrated. To that end I take the adjusted close data of two stocks and call coint on this data. However I am unsure if the coint test ...
0
votes
0
answers
148
views
Why does my forecast/prediction using a VAR in statsmodels quickly converge to zero?
Outline: I am using a vector autoregression (VAR) model from the statsmodel package https://www.statsmodels.org/stable/vector_ar.html#var.
My two time-series, let us call them time-series 1) ts1 and 2)...