Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Ologit storing p-values up to 10 decimal places

From   Roger Newson <[email protected]>
To   [email protected]
Subject   Re: st: Ologit storing p-values up to 10 decimal places
Date   Mon, 08 Aug 2011 20:05:20 +0100

If you are doing a genome-wide association scan using 500 SNOPs (or more), then this DEFINITELY looks like a -parmest- job, because you will want to process a large number of multiple P-values in a mechanized fashion. You could use the -pformat- option, but that will only give you a long list of formatted P-values for you to process manually, which I would definitely not like to do.

And, if you want to calculate frequentist Q-values corresponding to the P-values, then you can use the -qqvalue- package, downloadable from SSC, which does in Stata essentially what the -p.adjust- package does in R.

I hope this helps.

Best wishes


Roger B Newson BSc MSc DPhil
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: [email protected]
Web page:
Departmental Web page:

Opinions expressed are those of the author, not of the institution.

On 08/08/2011 19:55, Debs Majumdar wrote:
Thanks Nick. I was just trying to do a Genome Wide Association test with a trial sample of 500 SNPs. In a normal dataset, we have around 500,000 SNPs and the p-values are very small (the last one I ran in PLINK had the top hit at 5e-17). I would eventually want to modify the code so that it runs fo 500K SNPs. The reason for trying to run the GWAS in Stata and not PLINK is that PLINK doesn't have the capability of doingan ordinal logistic regression.

   I got confused with the code. Sorry for that. If I wanted to print out the sorted p-values would adding an extra line (sort e(p)) do it?

Also, I just noticed that Stata 11 has a  --pformat-- option. I was wondering if that can be used before the loop to specify that I want p-values upto certain decimal pplaces.



foreach var of var length-gratio {
     capture ologit rep78 `var'
* sort p-values
   sort e(p)

     di "`var' {col 20}" %12.10f e(p)

----- Original Message -----
From: Nick Cox<[email protected]>
To: [email protected]
Sent: Monday, August 8, 2011 11:19 AM
Subject: Re: st: Ologit storing p-values up to 10 decimal places

Your code is very confused, mixing up macros and variables and
assuming that values exist which you never assigned. However, with the
big caveat that no P-value can be trusted out to the tenth decimal
place, the technique in this may be a start at what you seek.

webuse fullauto

foreach var of var length-gratio {
     capture ologit rep78 `var'
     di "`var' {col 20}" %12.10f e(p)

For more manipulation, look at -postfile-.

If you are inspecting that many P-values, also consider building in a
penalty for chance hits.

On Mon, Aug 8, 2011 at 6:59 PM, Debs Majumdar<[email protected]>  wrote:

    I am trying to write a code which will go through around 500 ordinal logistic regressions and the output is the id for each of the rs # and the corresponding p-values, where the p-values are sorted in ascending order. i want the p-values reported up to 10 decimal places. This is my code so far. I may be wrong here. How do I make Stata report p-values up to 10 decimal places? Do I need to specify e(b) under display if I want the beta coefficients printed out for each rs #?

local list "age sex c1 c2 c3"
local pvalue = e(p)

foreach `x’ of varlist rs1-rs500 {

quietly ologit outcome `x' `list'

sort pvalue
display `x' pvalue


I am using Stata 11.1.

I want the output to show the following:


rs5       5e-7
rs493   4e-6
rs257   0.33


*   For searches and help try:

*   For searches and help try:
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index