[R] how to create density plot in R with p value

John Kane jrkr|de@u @end|ng |rom gm@||@com
Tue Feb 11 22:11:49 CET 2020


Please supply sample data in dput() format See ?dput.

You might find these links helpful.

 http://adv-r.had.co.nz/Reproducibility.html

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example



On Tue, 11 Feb 2020 at 15:07, Ana Marija <sokovic.anamarija using gmail.com>
wrote:

> so I transformed my data from the previous email to look like this:
>
> > head(tot)
>      dat                      type
> 1 -3.962 inter.individual.variance
> 2 -4.301 inter.individual.variance
> 3 -1.690 inter.individual.variance
> 4 -0.375 inter.individual.variance
> 5  1.816 inter.individual.variance
> 6  0.138 inter.individual.variance
> > tail(tot)
>         dat                      type
> 31177 -4.09 intra.individual.variance
> 31178 -4.64 intra.individual.variance
> 31179 -5.57 intra.individual.variance
> 31180 -2.96 intra.individual.variance
> 31181 -4.43 intra.individual.variance
> 31182 -3.60 intra.individual.variance
>
> then I can make plot using this:
>
> densityplot(~dat,data=tot,
>        groups=type,
>        par.settings = list(superpose.line = list(col = c("blue","red"))),
>        xlab="log2 (variance)",
>        plot.points=FALSE,
>        auto.key=TRUE)
>
> and calculate my p value with t test, say it is 0.005
>
> But how to add that p value in between distribution of the curves?
>
> Thanks
> Ana
>
> On Tue, Feb 11, 2020 at 12:54 PM Ana Marija <sokovic.anamarija using gmail.com>
> wrote:
> >
> > Hi,
> >
> > I have data like this:
> >
> > > head(a)
> >                    X   geneID inter.individual.variance
> > intra.individual.variance F.value  p.value     CV
> > 1 3iUZ.47hLFki49VR4o   MLLT10                    0.0642
> >    0.01395    4.60 1.00e-05 0.0222
> > 2 fEn1QlU0MCVe9GeR64 C1orf123                    0.0507
> >    0.00671    7.57 1.00e-08 0.0172
> > 3 ud_tTlU5LtB478JxIk    FSD1L                    0.3100
> >    0.02682   11.56 1.00e-11 0.0639
> > 4 3KV3OJIIRuJ5KJ6VkI  TXNDC11                    0.7710
> >    0.02813   27.41 9.99e-19 0.0688
> > 5 o_rupcEAKnQqnoh6ec   CYB5R2                    3.5209
> >    0.03391  103.83 9.99e-31 0.1357
> > 6 Nk_t6ULcQ7VDNChBRU     GBP1                    1.1005
> >    0.09522   11.56 9.98e-12 0.0773
> >
> > I would like to create density plot, like the attached between
> > "inter.individual.variance" and "intra.individual.variance" and have p
> > value between those two curves.
> >
> > Please advise,
> > Ana
>
> ______________________________________________
> R-help using r-project.org 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.
>


-- 
John Kane
Kingston ON Canada

	[[alternative HTML version deleted]]



More information about the R-help mailing list