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
1answer
27 views

Can you explain how OLS for non-linear data is working in statsmodels OLS implementation?

reference: https://www.statsmodels.org/stable/examples/notebooks/generated/ols.html#OLS-non-linear-curve-but-linear-in-parameters How is OLS in this implementation working? Is it finding the best ...
1
vote
0answers
14 views

Confidence intervals for bootstrapped multinomial proportions: Sison-Glaz?

I read the rules and looked for similar posts, but couldn't find any. New to the platform, so if I missed anything, pardon me. I have started looking into uncertainty quantification and I want to ...
0
votes
0answers
9 views

Statsmodels multinomial logit returning nan for sparse features

I have a travel survey and wish to compare a discrete choice model with some machine learning approaches. For the former, I am using statsmodels MNLogit to calculate the coefficents and p-values of my ...
0
votes
2answers
57 views

Including random effects in prediction with Linear Mixed Model

I have a question regarding Linear Mixed Modeling using statsmodels. The first picture below shows the mixed model I fitted. My dummy dataset only contains one variable, and multiple groups. I would ...
0
votes
0answers
18 views

SARIMAX giving predictions which doesn't match the data inputs

I am building a SARIMAX model on the data which is monthly aggregated. To select the best params, applied a grid search to select the best parameters. Once I get the best parameters for the data I am ...
0
votes
1answer
63 views

Logistic Regression with continuous exogenous variable

So I'm trying to understand how a logistic regression can work with a continuous exogenous variable. I'm trying out this code with Python and statsmodels ...
1
vote
3answers
57 views

Logistic Regression Failed in statsmodel but works in sklearn; Breast Cancer dataset

I am learning about both the statsmodel library and sklearn. I am trying to construct a logistic model for both libraries trained on the same dataset. In sklearn, the following works: ...
0
votes
1answer
46 views

ARIMA Stock Price Prediction is very bad

I'm learning about time series forecasting and I decided to try to model the Google stock price using Python and Statsmodel, I collected data from 1st of January 2010 upto this month. Then I tried to ...
0
votes
0answers
21 views

Obtaining distribution parameters from GLM

My question is part statistical and part coding. Say I have fitted a gamma log-link GLM. doc example ...
1
vote
1answer
75 views

Python statsmodels OLS vs t-test

I am trying to do some significnce testing using Python statsmodels. I have compiled two tests using OLS and weightstats.ttest_ind on the same data. My dataset contains one independent variable with ...
0
votes
0answers
44 views

Effect size in OLS Python statsmodels

I have fitted an OLS model in Python statsmodels and have the following output: How can I calculate the effect size for each of the independent variables using Python statsmodels?
0
votes
0answers
11 views

Estimation of beta and sigma for a model truncated from above and below

The following model is truncated from above and below Y = x′β + e ,if L < Y* < U not observed if otherwise How do we show the estimation of β and σ2 using MLE by deriving the Log-...
0
votes
0answers
25 views

statsmodels ARMA.fit wrong constant

I have just started using statsmodels.tsa.arima_model.ARMA.fit and I am trying to fit a simple AR1 process, i.e. $$X_t = c + a_1 X_{t-1} + e_t,$$ but the value for ...
0
votes
1answer
51 views

“scale” in logistic regression

I am working on translating some R code into Python's statsmodels package, chiefly some logistic regression work that I've done, when I came across the following in ...
0
votes
0answers
20 views

Markov Regression returns nan for some statisics

I am running a 3 regime states markov model with no trend on data that has been differenced (1st order derivative). I am returned with a summary: ...
1
vote
0answers
29 views

GLS models: how to interpret results and how to run predictions [closed]

I have data that is quite heteroscedastic, and therefore decided to try fitting a GLS model in python with the statsmodels package in python. The data has two continuous feature variables with skewed ...
0
votes
0answers
11 views

importance of regression MSE & variance of residuals

I have some code to create an OLS regression model, and the data is electrical demand interval data recorded on 1 hour increments along with outside air temperature. All other variables are dummy ...
0
votes
0answers
25 views
0
votes
1answer
75 views

What is the exact defenition of ARMA model in statsmodels and how to predict the next value using the summary of the fitted model manually?

I've fitted a time series (Y) on the ARMA(2,1) model using statsmodels in python. let's leave alone that the selected order is ...
0
votes
1answer
35 views

regression model output stand error

Apologize in advance for there being not a lot of wisdom here.. I am using stats models in Python to create an OLS type model. The data is a years worth of hourly electrical demand (response/...
0
votes
0answers
33 views

Multiple Testing in A Logistic Regression Model?

We want to test if an exam is particularly hard for students in certain racial group(s) to pass (pass = 1, fail = 0). The independent variables include (per row per student using student ID as a ...
1
vote
2answers
150 views

Standard Error of prediction for Logistic Sigmoid function

Standard Error of prediction for Logistic Sigmoid function (previously: Finding the prediction interval for logistic regression) Update 2: This paper describes what I am looking to implement. ...
2
votes
1answer
69 views

Why are p-values for python's Statsmodels so different from those reported by Stata?

I'm running a OLS regression in Stata and the same one in python's Statsmodels. Note that I adjust for clusters (for id and year). All the outcomes are very similar if not the same. But,the ...
0
votes
1answer
25 views

What is the Q distribution in expectation maximization in the following explanation?

I am reading a blog on expectation maximization - http://krasserm.github.io/2019/11/21/latent-variable-models-part-1/ Here, I encounter the following expression: When you look at the above ...
0
votes
2answers
49 views

R lme4 getting vastly different results than Python statsmodels for same(?) model

I'm trying to do a mixed model in python. I have some experience in R but am fairly new to doing these analyses in python I'm running what I think are the same models in python and R, using the same ...
0
votes
1answer
80 views

predicted counts for Zero-Inflated Poisson model differ from original samples

While experimenting with statsmodels' Zero-Inflated Poisson count model using artificially generated data, I noticed that although the parameters used to generate the data for fitting were ...
0
votes
0answers
21 views

Features backward elimination statsmodels OLS when considering interactions

I have a multi linear regression problem, $Y$ is my target and $X_1, X_2, X_3$ are my features. In my regression, I consider the interaction between $X_1, X_2, X_3$ and I add a bias. So my problem ...
0
votes
1answer
63 views

Is there a way to ask for “what changed between experiments”?

I have performed an experiment in which participants perform a task multiple times, the outcome being a binary "has succeeded or not". Two cohorts have performed the same experiment in two conditions ...
0
votes
1answer
79 views

Why AutoRegression(AR) model in python is giving inaccurate negative prediction

I have time series data with 8 points. I used AR model from statsmodels.tsa.ar_model library. I trained data using 8 points and predicted next 3 points. Though all values in the series are in ...
0
votes
1answer
74 views

How to specify a time-varying matrix in a state space model via statsmodels in Python

As far as I see, the parameters of state space models will be automatically treated as time-invariant and I don't know how to specify a time-varying matrix in a state space model via statsmodels in ...
1
vote
1answer
132 views

Why does the proportions_ztest function in statsmodels produce different values than the formula for a 1-proportion Z test?

If I run the following code in Python: from statsmodels.stats.proportion import proportions_ztest proportions_ztest(10, 50, 0.5) the result is ...
0
votes
0answers
16 views

How to use patsy for categorical variables in production?

I've used statsmodels to build a QuantReg model that uses patsy to describe the fitted model ...
0
votes
2answers
119 views

Why is the p-value so low here?

I have the following code using statsmodels ...
5
votes
2answers
112 views

Specifying Mixed Effects Model Formulas

I have a dataset of experiment groups, different tests, schools, and students (note students are in the dataset multiple times due to multiple tests so they're not iid either) and want to specify a ...
0
votes
1answer
19 views

How to correctly interpret a categorical by numeric interaction coefficient in a GLM

After moving from a proprietary GUI-based software to python for GLM development, I find I'm confused on interpreting the output of an interaction. Using the ...
0
votes
0answers
22 views

Compare sale to start inventory with simple normal proportions test

I have a dataset where I know how many units of each product I have in starting inventory. Then I know how many units of a given product were sold during a sale. I also know how many units of all ...
0
votes
0answers
72 views

How to perform multi-step forecasting in holt-winter modeling in python

I am trying to implement demand forecast of a produt for a month ahead and then convert it to week wise. I have received 7 years of week wise sales data,did all necesary data preprocessing,train(up to ...
0
votes
1answer
36 views

Statsmodel Ljung-Box test for non-zero mean

I have few time series, which I would like to model using ARIMA. But plotting ACF and PACF indicates these series are probably white noise. I am using Ljung-Box test to confirm it. I am implementing ...
0
votes
0answers
25 views

How to make StatsModels ARIMA more accurate?

I'm working on a big data project for my school project. My dataset looks like this: https://www.kaggle.com/umar47/usd-try I've translated column names to English to work smoothly. New column names ...
0
votes
0answers
64 views

Exogenous Values for stasmodels.forecast()

I am trying to forecast sales values using a SARIMAX model within the statsmodels package. As an endogenous input I am using a weekly history of values and I am leveraging the week-over-week percent, ...
0
votes
1answer
67 views

Exporting the UCM Model Prediction in CSV [closed]

My problem is extremely simple. But due to lack of proper documentation, I'm getting stuck. I'm using UCM from statsmodel of python. I'm trying this example. I want to create a dataset that has ...
1
vote
1answer
191 views

Recursive or direct forecasting used in forecast/predict() in stats models [closed]

I am working on a time series project. I have an hourly series and I have to forecast the 24 next hours. I am facing a problem with understanding how both the stats models forecast() and predict() ...
1
vote
1answer
36 views

How can I randomly draw a set of parameters from a regression given a model fit and covariance matrix?

I have built a GLM and have the fitted parameters and covariance matrix. I'd like to generate a set of random beta-parameters using the covariance matrix to estimate what the confidence bounds and ...
2
votes
1answer
1k views

Statsmodels Logistic Regression: Adding Intercept?

I'm relatively new to regression analysis in Python. I'm running a logistic regression on a dataset in a dataframe using the Statsmodels package. I've seen several examples, including the one ...
1
vote
0answers
49 views

Factor Analysis Cumulative Explained Variance Exceeding 100% when k-factors < p-variables [closed]

I'm new to Factor Analysis and having a rather frustrating result. I'm using the Factor Analysis implementation from statsmodels in Python with 119 variables and would like to reduce down to k-factors....
0
votes
0answers
23 views

Correlogram With Points Beyond -1 and +1?

I made a partial correlation plot of the residual of a dataset using python. I got the pacf graph below with some correlation points going to 2 and -1.5. Everyone finds this strange, does someone have ...
0
votes
1answer
109 views

How do I interpret the coefficients of a statsmodels multiple regression model with 2 dichotomous variables?

I have a continuous dependent variable Y and 2 dichotomous, crossed grouping factors forming 4 groups: A1, A2, B1, and B2. I am looking for the main effects of either factor, so I fit a linear model ...
0
votes
0answers
71 views

Time series Exponential smoothing by Holt winters method

I have basic questions with respect to exponential smoothing techniques, from statsmodels.tsa.holtwinters import ExponentialSmoothing add_model = ExponentialSmoothing(traindata,seasonal_periods=12 ,...
2
votes
1answer
141 views

I cannot understand formula for exogenous options in statsmodels' ARIMA

I need to use exogenous variables for my time series forecasting. And I found that I can include my exogenous variables into my ARIMA model using exogenous option. I want to know how this option ...
1
vote
0answers
74 views

Can I use ARIMA with hour data for two year prediction? [closed]

I am trying to use ARIMA model for time series forecasting. My data consists of hour by hour energy consumption. I have data for one year. So I have total 24*365 observations for energy consumption. ...

1
2 3 4 5