yarrr icon indicating copy to clipboard operation
yarrr copied to clipboard

inference method “withinci”

Open HeymanTom opened this issue 6 years ago • 4 comments

When using the inference method "withinci", I seem to be getting odd results. When I run the code below, the width of the intervals seems to differ considerably, even though both plots use the same dataframe, just sorted differently. Is that a bug or am I missing something? Thanks.

library(yarrr) #version 0.1.5
data(sleep)
sleep$ID=as.numeric(sleep$ID) #if I keep it as a factor, the function throws an error 
sleep=sleep[order(sleep$extra),]
pirateplot(extra~group, data=sleep, inf.method="withinci", inf.within="ID")
sleep=sleep[order(sleep$ID),]
pirateplot(extra~group, data=sleep, inf.method="withinci", inf.within="ID")

HeymanTom avatar May 02 '18 10:05 HeymanTom

Hi @HeymanTom ,

Unfortunately I can't be of much help here. The 'withinci' inference method option was programmed by @pat-s. @pat-s Can you look into this?

ndphillips avatar May 09 '18 11:05 ndphillips

What does the "withinci" method stand for? I added quantile and IQR support when looking through the commit history. Is that referring to that method?

Also I cannot see any problem in the code as it just picks up some stats from the given data. So not sure what should ever break there. Additionally, I do not really have time for this right now. I think you might need to dig into this yourself @HeymanTom, sorry!

pat-s avatar May 09 '18 12:05 pat-s

Ah ok thanks @pat-s , I thought you added the withinci functionality but clearly someone else did :) I'll look into it, thanks for the fast response!

ndphillips avatar May 09 '18 13:05 ndphillips

Hi

I happen to have a similar issue. The results I get with the "withinci" method are really odd. Moreover, they too are affected but irrelevant factors (such as sorting of a within subject variable). Are there any new solutions on this?

To illustrate, here are confidence intervals for my dataset:

inf.lb inf.ub
7.757920 10.068167
6.455555 9.153140
5.576044 8.068401
8.409315 10.568463
6.496222 9.317732
8.525732 10.451012
6.811634 9.872576
7.246191 9.964335

And here are confidence intervals for the exact same data set after running:

data_s1_long <- data_s1_long[order(data_s1_long$pseudo), ] # pseudo is a within-subject identifier (participant pseudonim)

inf.lb inf.ub
7.793733 10.032354
6.517098 9.091597
5.398604 8.245841
8.513767 10.464010
6.615473 9.198480
8.528187 10.448557
6.766998 9.917212
7.260705 9.949821

These confidence intervals are also different from what I get when running ANOVA. Is the fact that I have both within and between subject factors causing the issue?

Or perhaps there is a way I could create a pirateplot with confidence intervals added manually?

Thanks!

ewaszum avatar Jun 22 '21 08:06 ewaszum