Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: RE: New package -wridit- on SSC
From
"Roger B. Newson" <[email protected]>
To
[email protected]
Subject
Re: st: RE: New package -wridit- on SSC
Date
Tue, 28 Feb 2012 18:14:58 +0000
As it happens, there is an alternative fudge. You can contatenate the
reference-population dataset (with its values and weights) to the end of
your sample dataset using -append-, and then assign zero weights to the
observations from your original sample dataset. If you then use
-wridit-, then the ridits generated, in observations from the original
sample dataset, will all be relative to the identified distribution
defined by the weights in the reference-population dataset. You can then
discard the observations from the reference-population dataset.
Best wishes
Roger
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
UNITED KINGDOM
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: [email protected]
Web page: http://www.imperial.ac.uk/nhli/r.newson/
Departmental Web page:
http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/popgenetics/reph/
Opinions expressed are those of the author, not of the institution.
On 28/02/2012 16:41, Seed, Paul wrote:
Thanks as ever to Roger& Nick for their work on this.
I went back to the original article by Bross to try to understand what ridits were:
Bross, I. D. J. 1958. How to use ridit analysis. Biometrics 14: 38-58.
http://www.jstor.org/stable/2527727
The name ridit actually derives by analogy from probit and logit,
and is in part "Relative to an Identified Distribution".
Neither -wridit- not -egen , ridit()- have options to specify the identified distribution,
as Bross intended.
However, it is possible to fudge it:
Assume I want ridits for rep78 in the auto dataset, and want to use the US subsample
as my Identified Distribution (or reference distribution).
**************************
* Begin example analysis *
**************************
sysuse auto, clear
egen ridit_rep78_usa = ridit( rep78) if foreign == 0
bys rep78 (foreign) : replace ridit_rep78_usa = ridit_rep78_usa[1] if foreign[1] == 0
bys foreign : summ ridit_rep78_usa
* Contrast this with using all the data as the reference group:
egen ridit_rep78 = ridit( rep78)
bys foreign : summ ridit_rep78
* The means have shifted by a fixed amount, and the SD have changed slightly.
**************************
* End example analysis *
**************************
Roger B. Newson
Thanks as always to Kit Baum, a new package -wridit- is now available
for download from SSC. In Stata, use the -ssc- command to do this.
The -wridit- package is described as below on my website, and calculayes
weighted ridits for a variable. Zero weights are allowed, in which case
the ridits for the observations with zero weights are relative to the
weight distribution in the observations with non-zero weights. Ridits,
and the left, right and central inverse ridits, are important in rank
statistics, which, strictly speaking, are really ridit statistics. They
are also potentially useful in spline statistics, where the user might
want to define a spline in the ridit of an X-variable, instead of in the
X-variable itself.
I would like to thank Nick Cox for writing the -ridit()- function of the
-egenmore- package, which generates unweighted ridits, and from which I
borrowed a few ideas for -wridit-. I slightly revised the algorithm for
-wridit-, in order to avoid the small numerical accuracy issues
associated with adding a small probability to a large probability.
---------------------------------------------------------------------------
package wridit from http://www.imperial.ac.uk/nhli/r.newson/stata10
---------------------------------------------------------------------------
TITLE
wridit: Generate weighted ridits
DESCRIPTION/AUTHOR(S)
wridit inputs a variable and generates its weighted ridits.
If no weights are provided, then all weights are assumed
equal to 1, so unweighted ridits are generated.
Author: Roger Newson
Distribution-Date: 22february2012
Stata-Version: 10
INSTALLATION FILES (click here to install)
wridit.ado
wridit.sthlp
---------------------------------------------------------------------------
(click here to return to the previous screen)
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/