Questions tagged [statmodels]

29 questions
0
votes
0 answers

Why do we need to add_constant in statmodel linear regression

I have read other similar questions, but all the answers seem to be something along the lines that without an intercept, you are ensuring that when the predictor is zero, the target variable is also zero, or how we need to add b to the equation y=…
Who_amI
  • 11
  • 4
0
votes
0 answers

llr_pvalue extract from OrderedResults statsmodels

I tried to follow the tutorial on ordinal regression using stats models from (https://www.statsmodels.org/dev/examples/notebooks/generated/ordinal_regression.html). import numpy as np import pandas as pd import scipy.stats as stats from…
pranav nerurkar
  • 596
  • 7
  • 19
0
votes
0 answers

Linear Mixed Model (LMM) with statsmodels library (syntax suggestion)

I have a dataset that I tried that I want to analyised with Linear Mixed Effect (LMM). The Fixed effect is a binary classification (H and L), and the Block effect is Region (A, B and C). In other words, I wanted so see if Test1 and Test2 predict…
jsmgl
  • 1
  • 1
0
votes
0 answers

Statsmodels: How to add numbers in the formula

How can I add numbers in the formula? ex: sm.ols(formula = 'weight ~ 2.30 + mpg*2 + horsepower', data=mpg).fit()
ferrelwill
  • 771
  • 2
  • 8
  • 20
0
votes
0 answers

How can I apply the model that I built against the different data using stat models?

How can I apply the model that I built against different data using stat models? For example here I use OLS to model the data in file1. I want to use the modelX against on file2 data. Is that possible? modelX = sm.OLS(y~ a+b+c,…
ferrelwill
  • 771
  • 2
  • 8
  • 20
0
votes
0 answers

How to detect seasonality without plotting ? true/false

I have 2 years of data for multiple variables (month data). My goal is to identify which ones have seasonality and which ones don't. How can you test for seasonality without plotting? i used seasonal decompose month 2016-01-01 204.0 2016-02-01 …
Irina
  • 1
0
votes
1 answer

statmodels predict train data: shapes not aligned

import numpy as np import statsmodels.api as sm duncan_prestige = sm.datasets.get_rdataset("Duncan", "carData") Y = duncan_prestige.data['income'] print(Y.shape) X = duncan_prestige.data['education'] print(X.shape) X =…
Jedi Knight
  • 367
  • 2
  • 10
0
votes
0 answers

How often can I use detrending and differencing to make a timeseries stationary?

So I have a lot of timeseries that I check for stationarity by using ADF and KPSS tests. Depending on the results of each test, I can find out if it is stationary, non-stationary, trend stationary or difference stationary. Accordingly I would…
LGR
  • 402
  • 3
  • 18
0
votes
1 answer

I need the values of the ranges that are in the ACF graph

From the ACF graph, you can see the ranges in blue. I need the value of the range in the ACF graph. Can this be retrieved?
Beginner
  • 25
  • 5
0
votes
1 answer

How can I print the ndarray compelete information?

I have been trying to match the output but I'm not getting the column names I got from df which I put into the statmodels. import pandas import statsmodels.api as statmodel df = pandas.read_csv('fastfood.csv') df = df[['total_fat', 'sat_fat',…
0
votes
0 answers

collect2: error: ld returned 1 exit status" on R to install statmod package

I'm new on R version 3.6.3 (2020-02-29). I'm working on a Linux Mint 19.3 Tricia. I tried to install the package statmod with this code line: install.package("statmod") When I compiled this line R return this error: error: gcc -std=gnu99 -shared…
l_g_stat
  • 1
  • 4
0
votes
0 answers

ARIMA predict constant values, What should I do?

I am new in modelling time series data using arima I have a timeseries of similarity score calculated using Ademic Adar index. However when I use ARIMA it gives constant prediction to some data, what should I do? This is what I…
TinaTz
  • 311
  • 3
  • 16
0
votes
0 answers

Aggregating confidence intervals statsmodel OLS

I am using statsmodels to create an OLS. I need to estimate confidence intervals (mean confidence interval) for the mean of the predicted value in a certain cohort. I came across this question : Linear regression with `lm()`: prediction interval for…
Amine
  • 11
  • 1
-1
votes
1 answer

can only concatenate str (not "tuple") to str

def chek_stationary(x): result=adfuller(x) label=['ADF statestic test','p value','num of legs','num of observation'] for value,label in zip(result,label): print(label + ":" + result) if result[1] <= 0.05 : print…
arminius
  • 3
  • 1
  • 2
1
2