How to make a figure plotting p-values by range of different adjustment values?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to make a figure plotting p-values by range of different adjustment values?

kmore
Hi all,

Thank you for taking the time to read my message. I'm trying to make a
figure that plots p-values by a range of different adjustment values.

(Using the **logit** function in package **car**)

My Statistical analyses were conducted on probability estimates ranging
from 0% to 100%. As it's not ideal to run linear models on percentages that
are bounded between 0 and 1, these estimates were logit transformed.

However, this introduces a researcher degree of freedom. In Package
**Car**, the logit transformation code is

        logit(p = doc$value, adjust = 0.025)

    logit definition/Description

    Compute the logit transformation of proportions or percentages.

    Usage

         logit(p, percents=range.p[2] > 1, adjust)

    Arguments

    p  a numeric vector or array of proportions or percentages.
    percents TRUE for percentages.
    adjust   adjustment factor to avoid proportions of 0 or 1; defaults to
0 if there are no such proportions in the data, and to .025 if there are.)

I chose the default adjustment factor of .025, but I need to determine at
what point my values are greater than .05 to show I did not choose an
ajustment value that makes my results significant.

Ultimately, I want to find the range of adjustment factors do we get P <
0.05?And at what point do we get P > 0.05?

    ## The final product I'm looking for is a figure with the following
features:
      ## 1) Adjustment factor on the x-axis
      ## 2) P value on the y-axis

    Does anyone know how to do this? Thank you so much in advance.

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make a figure plotting p-values by range of different adjustment values?

Jim Lemon-4
Hi Kirsten,
Perhaps this will help:

set.seed(3)
kmdf<-data.frame(group=rep(1:4,each=20),
 prop=c(runif(20,0.25,1),runif(20,0.2,0.92),
 runif(20,0.15,0.84),runif(20,0.1,0.77)))
km.glm<-glm(prop~group,kmdf,family=quasibinomial(link="logit"))
summary(km.glm)
pval<-0.00845
padjs<-NA
npadj<-1
# assume you have five comparisons in this family
for(method in p.adjust.methods) {
 padjs[npadj]<-p.adjust(pval,method=method,n=5)
 npadj<-npadj+1
}
plot(padjs,xaxt="n",main="P plot",xlab="Method",ylab="adjusted p values")
abline(h=0.05,col="lightgray")
library(plotrix)
staxlab(1,at=1:8,labels=p.adjust.methods)

Jim


On Thu, Jul 13, 2017 at 12:53 AM, Kirsten Morehouse
<[hidden email]> wrote:

> Hi all,
>
> Thank you for taking the time to read my message. I'm trying to make a
> figure that plots p-values by a range of different adjustment values.
>
> (Using the **logit** function in package **car**)
>
> My Statistical analyses were conducted on probability estimates ranging
> from 0% to 100%. As it's not ideal to run linear models on percentages that
> are bounded between 0 and 1, these estimates were logit transformed.
>
> However, this introduces a researcher degree of freedom. In Package
> **Car**, the logit transformation code is
>
>         logit(p = doc$value, adjust = 0.025)
>
>     logit definition/Description
>
>     Compute the logit transformation of proportions or percentages.
>
>     Usage
>
>          logit(p, percents=range.p[2] > 1, adjust)
>
>     Arguments
>
>     p  a numeric vector or array of proportions or percentages.
>     percents TRUE for percentages.
>     adjust   adjustment factor to avoid proportions of 0 or 1; defaults to
> 0 if there are no such proportions in the data, and to .025 if there are.)
>
> I chose the default adjustment factor of .025, but I need to determine at
> what point my values are greater than .05 to show I did not choose an
> ajustment value that makes my results significant.
>
> Ultimately, I want to find the range of adjustment factors do we get P <
> 0.05?And at what point do we get P > 0.05?
>
>     ## The final product I'm looking for is a figure with the following
> features:
>       ## 1) Adjustment factor on the x-axis
>       ## 2) P value on the y-axis
>
>     Does anyone know how to do this? Thank you so much in advance.
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make a figure plotting p-values by range of different adjustment values?

kmore
Hi Jim,

Thanks for your help, I really appreciate it.

Perhaps I'm misunderstanding, but does this formula run different ajustment
values for this function?

  logit(p = doc$value, adjust = 0.025)

I'm looking to plot the p-values of different adjustment values.

Thanks so much,

Kirsten

On Wed, Jul 12, 2017 at 8:49 PM, Jim Lemon <[hidden email]> wrote:

> Hi Kirsten,
> Perhaps this will help:
>
> set.seed(3)
> kmdf<-data.frame(group=rep(1:4,each=20),
>  prop=c(runif(20,0.25,1),runif(20,0.2,0.92),
>  runif(20,0.15,0.84),runif(20,0.1,0.77)))
> km.glm<-glm(prop~group,kmdf,family=quasibinomial(link="logit"))
> summary(km.glm)
> pval<-0.00845
> padjs<-NA
> npadj<-1
> # assume you have five comparisons in this family
> for(method in p.adjust.methods) {
>  padjs[npadj]<-p.adjust(pval,method=method,n=5)
>  npadj<-npadj+1
> }
> plot(padjs,xaxt="n",main="P plot",xlab="Method",ylab="adjusted p values")
> abline(h=0.05,col="lightgray")
> library(plotrix)
> staxlab(1,at=1:8,labels=p.adjust.methods)
>
> Jim
>
>
> On Thu, Jul 13, 2017 at 12:53 AM, Kirsten Morehouse
> <[hidden email]> wrote:
> > Hi all,
> >
> > Thank you for taking the time to read my message. I'm trying to make a
> > figure that plots p-values by a range of different adjustment values.
> >
> > (Using the **logit** function in package **car**)
> >
> > My Statistical analyses were conducted on probability estimates ranging
> > from 0% to 100%. As it's not ideal to run linear models on percentages
> that
> > are bounded between 0 and 1, these estimates were logit transformed.
> >
> > However, this introduces a researcher degree of freedom. In Package
> > **Car**, the logit transformation code is
> >
> >         logit(p = doc$value, adjust = 0.025)
> >
> >     logit definition/Description
> >
> >     Compute the logit transformation of proportions or percentages.
> >
> >     Usage
> >
> >          logit(p, percents=range.p[2] > 1, adjust)
> >
> >     Arguments
> >
> >     p  a numeric vector or array of proportions or percentages.
> >     percents TRUE for percentages.
> >     adjust   adjustment factor to avoid proportions of 0 or 1; defaults
> to
> > 0 if there are no such proportions in the data, and to .025 if there
> are.)
> >
> > I chose the default adjustment factor of .025, but I need to determine at
> > what point my values are greater than .05 to show I did not choose an
> > ajustment value that makes my results significant.
> >
> > Ultimately, I want to find the range of adjustment factors do we get P <
> > 0.05?And at what point do we get P > 0.05?
> >
> >     ## The final product I'm looking for is a figure with the following
> > features:
> >       ## 1) Adjustment factor on the x-axis
> >       ## 2) P value on the y-axis
> >
> >     Does anyone know how to do this? Thank you so much in advance.
> >
> >         [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make a figure plotting p-values by range of different adjustment values?

Jim Lemon-4
Hi Kirsten,
Yes, the adjustment in the "car" package is different from the
p.adjust function in the "stats" package. I used the latter as I
thought you only needed a way to plot different p-values against the
various adjustment methods. Just create a vector of method names that
you have used and pass that to "staxlab" to label each p-value along
the x-axis.

Jim


On Fri, Jul 14, 2017 at 12:52 AM, Kirsten Morehouse
<[hidden email]> wrote:

> Hi Jim,
>
> Thanks for your help, I really appreciate it.
>
> Perhaps I'm misunderstanding, but does this formula run different ajustment
> values for this function?
>
>   logit(p = doc$value, adjust = 0.025)
>
> I'm looking to plot the p-values of different adjustment values.
>
> Thanks so much,
>
> Kirsten
>
> On Wed, Jul 12, 2017 at 8:49 PM, Jim Lemon <[hidden email]> wrote:
>>
>> Hi Kirsten,
>> Perhaps this will help:
>>
>> set.seed(3)
>> kmdf<-data.frame(group=rep(1:4,each=20),
>>  prop=c(runif(20,0.25,1),runif(20,0.2,0.92),
>>  runif(20,0.15,0.84),runif(20,0.1,0.77)))
>> km.glm<-glm(prop~group,kmdf,family=quasibinomial(link="logit"))
>> summary(km.glm)
>> pval<-0.00845
>> padjs<-NA
>> npadj<-1
>> # assume you have five comparisons in this family
>> for(method in p.adjust.methods) {
>>  padjs[npadj]<-p.adjust(pval,method=method,n=5)
>>  npadj<-npadj+1
>> }
>> plot(padjs,xaxt="n",main="P plot",xlab="Method",ylab="adjusted p values")
>> abline(h=0.05,col="lightgray")
>> library(plotrix)
>> staxlab(1,at=1:8,labels=p.adjust.methods)
>>
>> Jim
>>
>>
>> On Thu, Jul 13, 2017 at 12:53 AM, Kirsten Morehouse
>> <[hidden email]> wrote:
>> > Hi all,
>> >
>> > Thank you for taking the time to read my message. I'm trying to make a
>> > figure that plots p-values by a range of different adjustment values.
>> >
>> > (Using the **logit** function in package **car**)
>> >
>> > My Statistical analyses were conducted on probability estimates ranging
>> > from 0% to 100%. As it's not ideal to run linear models on percentages
>> > that
>> > are bounded between 0 and 1, these estimates were logit transformed.
>> >
>> > However, this introduces a researcher degree of freedom. In Package
>> > **Car**, the logit transformation code is
>> >
>> >         logit(p = doc$value, adjust = 0.025)
>> >
>> >     logit definition/Description
>> >
>> >     Compute the logit transformation of proportions or percentages.
>> >
>> >     Usage
>> >
>> >          logit(p, percents=range.p[2] > 1, adjust)
>> >
>> >     Arguments
>> >
>> >     p  a numeric vector or array of proportions or percentages.
>> >     percents TRUE for percentages.
>> >     adjust   adjustment factor to avoid proportions of 0 or 1; defaults
>> > to
>> > 0 if there are no such proportions in the data, and to .025 if there
>> > are.)
>> >
>> > I chose the default adjustment factor of .025, but I need to determine
>> > at
>> > what point my values are greater than .05 to show I did not choose an
>> > ajustment value that makes my results significant.
>> >
>> > Ultimately, I want to find the range of adjustment factors do we get P <
>> > 0.05?And at what point do we get P > 0.05?
>> >
>> >     ## The final product I'm looking for is a figure with the following
>> > features:
>> >       ## 1) Adjustment factor on the x-axis
>> >       ## 2) P value on the y-axis
>> >
>> >     Does anyone know how to do this? Thank you so much in advance.
>> >
>> >         [[alternative HTML version deleted]]
>> >
>> > ______________________________________________
>> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> > https://stat.ethz.ch/mailman/listinfo/r-help
>> > PLEASE do read the posting guide
>> > http://www.R-project.org/posting-guide.html
>> > and provide commented, minimal, self-contained, reproducible code.
>
>

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Loading...