pbreheny / visreg

Visualization of regression functions
http://pbreheny.github.io/visreg/
62 stars 18 forks source link

2.5% confidence limit for the X2 distribution #45

Closed xphab closed 6 years ago

xphab commented 6 years ago

Dear Prof. Patrick Breheny

I'm sorry that my question may not be the issues of 'visreg'. I have a matrix data:

> head(a_order)
          ID persistence      rate
5456 OTU_999       3 16.112676
5455 OTU_998      32  1.493214
5454 OTU_997      21  2.814085
5453 OTU_996      20 13.659007
5452 OTU_995      34  1.630889
5451 OTU_994      30  1.724810

The 'persistence: 3' means 'OTU_999' exists in 3 samples. The 'rate: 16.112676' means 'variance(OTU_999)/average(OTU_999)', variance of OTU_999 in the 3 samples and average number of OTU_999 in the 3 samples. I used glm() to get a possion linear model of "rate~persistence", and I try to use visreg to plot a "2.5% confidence limit line for the x2 distribution“. I found the visreg2d could load 2 data sets, but I didn't know how to get the 2.5% confidence line. I'm going to classify the 'core' and 'satellite' OTUs based on the matrix data following the paper: https://www.nature.com/articles/ismej2010175 (Fig 1b): image

Could you please help me to find a way to get the 2.5% confidence line? I am looking for solutions for one week, and still get nothing. I'm so sorry to disturb you. I will very much appreciate your kindly help.

Best, Peng

pbreheny commented 6 years ago

Hi Peng,

I'm sorry, but I have no idea what the authors are talking about in the figure/caption you posted. I would have to go back and read their paper, but out of context, what they describe means nothing to me. Certainly, you can extract lower/upper confidence interval limits from a visreg plot:

v <- visreg(fit, "persistence")

and they will be in v$fit. But that doesn't sound like what this paper is doing, since a chi-squared distribution is involved somehow. Sorry I couldn't be of more help, but from what I understand, I don't think this has anything to do with visreg.

xphab commented 6 years ago

Thanks very much for your kindly help! I will check it again. Thanks