How to run python post hoc test? - python

I would like to know how post hoc tests are performed with Python
(I have estimated a parameter by different independent experiments, obtaining a value with uncertainty from each fit).
Thanks in advance

Have you looking into the statsmodels package? Something like statsmodels.stats.multicomp.pairwise_tukeyhsd (https://www.statsmodels.org/dev/generated/statsmodels.stats.multicomp.pairwise_tukeyhsd.html) might be what you need

Related

Detect Seasonality in Time Series with Python

I've been trying to identify some seasonal customers in a dataset. As a first approach, I used the seasonal_decompose() function of the statsmodel package - this is useful for visualizing specific customers, but won't work for the whole dataset as I have almost 8000 different time series, one for each client.
Then, I decided trying the ADF test - the problem here was that it only detects
if my series is stationary or not, and because of the trend it won't work in my case.
I also tried combining this with the KPSS test (that tests for trend-stationarity),
but the results still bad.
Now, I have thought about four alternatives:
Find a way to evaluate it manually using a mean/variance approach
Try using CHTest
Try using the Darts package
Detrend my data and apply those tests (or others) again
The thing is that I couldn't find good examples of any of this in Python... most of the
solutions I found for my problem are developed in R. Is there a suitable way of
doing this in Python or should I give up, export my series and try using R?
Could you help me with some tips? I would really appreciate reading suggestions too. Thanks!

How to include a (matrix) constraint using statsmodels DynamicFactor? python

I am using tsa.DynamicFactor of statsmodels with multiple Factors. I would like to include some contraints that impose that some factors can affect only some series. How can I do that?
I couldn't find anything online.
thanks a lot!
Best
Instead of DynamicFactor you need to use DynamicFactorMQ which allows to specify which observed variables load on which factors via a combination of factors, factor_orders and factor_multiplicities arguments. The docs have some usage examples.

Running CHAID on continuous predictors

Please, did anyone try to run CHAID algorithm on continuous predictors ??
At first, I used SPSS Modeler and it worked fine.
but when I tried it on Python 3.6, it didn't work for me.
Thanks :)
P.S. CHAID package could be found here :
https://github.com/Rambatino/CHAID
I'm the author of that library.
It's usually better to post on the issues tab on the github repo as questions have more visibility there.
Unfortunately, with regards to continuous predictors, they need to be binned first before they can be run using CHAID. We haven't implemented a binning strategy as it's very subjective (SPSS makes a lot of decisions under the hood).

Least significant difference (LSD) post hoc-test in ANOVA using Python

Recently I've been learning to use Python to do ANOVA analysis. I have already found an example of using Tukey's test to do ANOVA but I want to use the least significant difference (LSD) method. Does anyone know how to do it or is there an example?
Thanks.

Implementing GARCH on Python for Index Hedging

I am trying to use GARCH(1,1) to find the hedge ratio as described in this paper http://search.livjm.ac.uk/AFE/AFE_docs/cibef0402.pdf. However, Python does not offer packages for GARCH(1,1), thus I think I have to implement it myself.
The data I have for the Index and the Futures are their daily returns. I would like to write a function that takes in the daily returns and output the beta of GARCH as the hedging ratio. However, I am at loss where to start writing the GARCH function. Could anyone outline step-by-step the algorithm for GARCH(1,1) in this case?
There is an implementation of this in the Python statsmodels library. The source code is available here.
There is also ARCH models in Python

Categories

Resources