statsmodels Questions

2

Running a MixedLM and want to push the output to Excel or a CSV, see model code and output below: model = smf.mixedlm('y_var ~ gas_prices', dfModel, groups = dfModel['region']) mdf = model.fit()...
Origan asked 19/5, 2018 at 12:2

3

Solved

I am trying to do out of sample forecasting using python statsmodels. I do not want to just forecast the next x number of values from the end of the training set but I want to forecast one value at...
Cinelli asked 11/11, 2015 at 23:25

5

I have pandas dataframe with some categorical predictors (i.e. variables) as 0 & 1, and some numeric variables. When I fit that to a stasmodel like: est = sm.OLS(y, X).fit() It throws: Pand...
Alphabetize asked 20/11, 2015 at 18:42

7

How to fit a locally weighted regression in python so that it can be used to predict on new data? There is statsmodels.nonparametric.smoothers_lowess.lowess, but it returns the estimates only for ...
Lasala asked 27/3, 2016 at 20:42

3

I am using Anaconda and I am trying logistic regression. After loading training data set and performed the regression. Then I got the following warning message. train_cols = data.columns[1:] logi...
Dishonorable asked 3/10, 2015 at 18:58

1

I am using statsmodels OLS to run some linear regression on my data. My problem is that I would like the coefficients to add up to 1 (I plan to not use constant parameter). Is it possible to specif...
Electroencephalograph asked 21/4, 2016 at 18:44

2

I have a statsmodels.discrete.discrete_model.BinaryResultsWrapper that was the output of running statsmodels.api.Logit(...).fit(). I can call the .summary() method which prints a table of results w...
Subserve asked 25/4, 2015 at 18:19

2

I need linearmodels for 2 way clustering, that's not properly implemented in statsmodels. I was wondering if it was possible to use the stargazer python library with the linearmodels package, rathe...
Predict asked 10/3, 2020 at 14:53

2

Solved

Could anyone please help in providing an example showing how ANCOVA (analysis of covariance) can be done in scipy/statsmodel, with python? I am not sure if I am asking too much, but a quick searc...
Tertias asked 21/10, 2013 at 4:55

11

Solved

It seems scipy once provided a function mad to calculate the mean absolute deviation for a set of numbers: http://projects.scipy.org/scipy/browser/trunk/scipy/stats/models/utils.py?rev=3473 Howev...
Kayceekaye asked 19/1, 2012 at 17:18

3

Solved

Is there an existing function to estimate fixed effect (one-way or two-way) from Pandas or Statsmodels. There used to be a function in Statsmodels but it seems discontinued. And in Pandas, there i...
Ceceliacecil asked 12/6, 2014 at 23:23

3

Solved

Please forgive my ignorance. All I'm trying to do is add a squared term to my regression without going through the trouble of defining a new column in my dataframe. I'm using statsmodels.formula.ap...
Coverup asked 19/5, 2020 at 19:45

4

We can create the ECDF with import numpy as np from statsmodels.distributions.empirical_distribution import ECDF ecdf = ECDF([3, 3, 1, 4]) and obtain then ECDF at point with ecdf(x) However...
Serrano asked 23/5, 2017 at 10:42

2

Solved

Have been working with time series in Python, and using sm.tsa.seasonal_decompose. In the docs they introduce the function like this: We added a naive seasonal decomposition tool in the same vei...
Vinnie asked 2/11, 2017 at 13:39

4

I am trying to use the Python statsmodels linear mixed effects model to fit a model that has two random intercepts, e.g. two groups. I cannot figure out how to initialize the model so that I can do...
Sheree asked 25/8, 2016 at 18:50

1

I use ExponentialSmoothing from statsmodels (Version: 0.10.1) to fit and perform forecast on some data. For ease of use when setting the configurations, I write a function exp_smoothing_forecast th...
Toxicogenic asked 21/5, 2020 at 1:17

0

I have the following Python code where I've already try to perform a VCA analysis using REML: import pandas as pd import statsmodels.api as sm from statsmodels.formula.api import ols data = {'Part'...
Wharfinger asked 4/9, 2023 at 17:41

6

Solved

I want to build a Ordered Probit model using statsmodel package in python. Used the following code to import: from statsmodels.miscmodels.ordinal_model import OrderedModel but getting a following e...
Zora asked 10/12, 2020 at 6:4

2

The usual way to fit an ARIMA model with the statsmodels python package is: model = statsmodels.tsa.ARMA(series, order=(2,2)) result = model.fit(trend='nc', disp=1) however, i have multiple time...
Ursal asked 24/2, 2018 at 12:39

3

Solved

I am trying to get the F-statistic and p-value for each of the covariates in GLM. In Python I am using the stats mode.formula.api to conduct the GLM. formula = 'PropNo_Pred ~ Geography + log10BMI ...
Sundaysundberg asked 6/12, 2014 at 5:28

2

Solved

I have a dataframe where I am trying to run the statsmodel.api OLS regression. It is printing out the summary. But when I am using the predict() function, it is giving me an error - shapes (75,...
Paella asked 10/12, 2018 at 9:45

2

I'd like to model a data set using Latent Class Analysis (LCA) using Python. I've found the Factor Analysis class in sklearn, but I'm not confident that this class is equivalent to LCA. Does a pa...
Tatia asked 5/1, 2017 at 15:31

2

Solved

Problem Statement: I have some nice data in a pandas dataframe. I'd like to run simple linear regression on it: Using statsmodels, I perform my regression. Now, how do I get my plot? I've tried st...
Eucharis asked 15/2, 2017 at 23:20

10

Solved

I am trying to predict weekly sales using ARMA ARIMA models. I could not find a function for tuning the order(p,d,q) in statsmodels. Currently R has a function forecast::auto.arima() which will tun...
Airspeed asked 31/3, 2014 at 19:22

1

As statsmodels.tseries models require indexes with a given frequency to make forecasts and I need my data to have a non-standard frequency. Therefore, I want to create a new frequency to assign to ...
Leavenworth asked 2/9, 2021 at 12:15

© 2022 - 2024 — McMap. All rights reserved.