CALR calculation

19 views
Skip to first unread message

Barel Mishal

unread,
Mar 30, 2021, 3:05:44 PMMar 30
to pystatsmodels
Hi my name is Barel, I am looking for some answers about statsmodels. 

I want to know if the library has some calculations and how to implement them with the library. I am working in the lab for metabolism. my data is on calorimetry experiments. 
And I want to do a couple of calculation that to clone app providing  https://calrapp.org/ 
All the calculation approach explained in this article: 
"statistical approach"

I need it because my design experiment differs than does the app and I know python. I work with the library a bit but got stuck on a couple of things. Hope someone could explain and direct me:
1. the glm() is the same as the article provided, it doesn't have the F ratio or the same values when I am doing the calculation on the data that I have the answer to. 
2. there are post hoc functions in statmodles. but I saw there isn't the implementation of dunnett test just the tukyHSD. There will be soon this implementation?
3. about the glm() or other function that will help me implement the same calculation as the calr providing could you just show me one example or direct to the right place so will be sure where to look?  

thanks in advance.
Sorry about my English that not my first. 

josef...@gmail.com

unread,
Mar 30, 2021, 3:22:20 PMMar 30
to pystatsmodels
Based on a very quick look at the Cell Metabolism article
If the model is Gaussian with identity link, then it is better to use OLS, and then use `anova_lm` for the test of effects.
For GLM there are no premade hypotheses tests, so it depends on the user to specify the contrast matrix for the relevant hypotheses. 
To replicate with GLM for other models, we would need more information about the design matrix and how the hypothesis/contrast matrix is defined.

2. 
dunnet's test for multiple comparison to a reference category is not available. The main limitation is to get the p-values or critical values. The contrast matrix itself is easy to build for a specific case.

two options
- use generic multiple testing p-value corrections
- use multivariate t-distribution directly to compute p-values, I only ever tried to replicate tukeyHSD, but not Dunnet

or use a table with critical values from the literature

scikit-posthoc has some good features for multiple comparisons, but also doesn't seem to have Dunnet

Josef


 

thanks in advance.
Sorry about my English that not my first. 

--
You received this message because you are subscribed to the Google Groups "pystatsmodels" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pystatsmodel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pystatsmodels/1f1f8d8f-3888-472d-aa07-10aae4537b94n%40googlegroups.com.

josef...@gmail.com

unread,
Mar 30, 2021, 3:30:27 PMMar 30
to pystatsmodels
On Tue, Mar 30, 2021 at 3:22 PM <josef...@gmail.com> wrote:


On Tue, Mar 30, 2021 at 3:05 PM Barel Mishal <barel....@mail.huji.ac.il> wrote:
Hi my name is Barel, I am looking for some answers about statsmodels. 

I want to know if the library has some calculations and how to implement them with the library. I am working in the lab for metabolism. my data is on calorimetry experiments. 
And I want to do a couple of calculation that to clone app providing  https://calrapp.org/ 
All the calculation approach explained in this article: 
"statistical approach"

I need it because my design experiment differs than does the app and I know python. I work with the library a bit but got stuck on a couple of things. Hope someone could explain and direct me:
1. the glm() is the same as the article provided, it doesn't have the F ratio or the same values when I am doing the calculation on the data that I have the answer to. 
2. there are post hoc functions in statmodles. but I saw there isn't the implementation of dunnett test just the tukyHSD. There will be soon this implementation?
3. about the glm() or other function that will help me implement the same calculation as the calr providing could you just show me one example or direct to the right place so will be sure where to look?  

Based on a very quick look at the Cell Metabolism article
If the model is Gaussian with identity link, then it is better to use OLS, and then use `anova_lm` for the test of effects.
For GLM there are no premade hypotheses tests, so it depends on the user to specify the contrast matrix for the relevant hypotheses. 
To replicate with GLM for other models, we would need more information about the design matrix and how the hypothesis/contrast matrix is defined.

2. 
dunnet's test for multiple comparison to a reference category is not available. The main limitation is to get the p-values or critical values. The contrast matrix itself is easy to build for a specific case.

two options
- use generic multiple testing p-value corrections
- use multivariate t-distribution directly to compute p-values, I only ever tried to replicate tukeyHSD, but not Dunnet

or use a table with critical values from the literature

our issue that includes discussion about Dunnet is https://github.com/statsmodels/statsmodels/issues/852

Barel Mishal

unread,
Apr 2, 2021, 11:06:14 AMApr 2
to pystatsmodels
Thanks a lot. That looks good. The plot, I have the same type of values but still having a problem with the calculation (that not the same as the calr give).

I did try today and yesterday to do a couple of things but not yet succeeding.
As I was writing my problem, I think now way that not work, so I will check hope it works. 

Barel Mishal

unread,
Apr 3, 2021, 5:37:28 AMApr 3
to pystatsmodels
Hi, I did an R code that does 1 of the calculation I needed to check if I can use the function in the article. I could do it (with a little bit of help from someone that knows R).  And this work, the R code did the calc on 2% error. 
Python code still gives me weird results hoping some can look into my code in this repository.

EE                 WT Diet 2 KO Diet 1 KO Diet 2
WT Diet 1 0.4882 0.409 0.0062             CalR         Group effect
                0.4852 0.2138 0.0057                                  Mass:Group interaction effect
EE                WT Diet 2 KO Diet 1 KO Diet 2
WT Diet 1 0.47868 0.38569 0.00606                 R code            Group effect
                 0.47044 0.19864 0.00556                                  Mass:Group interaction effect
EE                        WT Diet 2 KO Diet 1 KO Diet 2
WT Diet 1 ???                                                  python code Group effect
                                                                                         Mass:Group interaction effect

I get the result in my code as it calculates all the columns and not each category in the column.
I hope someone will know what I do wrong.
Reply all
Reply to author
Forward
0 new messages