{smcl}
{.-}
help for {cmd:normalrir} {right:(Roger Newson)}
{.-}
{title:Calculate ridits of inverse ridits between Normal populations}
{p 8 27}
{cmd:normalrir} {it:newvarname} [{cmd:if} {it:exp}] [{cmd:in} {it:range}] ,
{cmdab:un:iform}{cmd:(}{it:expression_1}{cmd:)} [
{cmdab:mu:}{cmd:(}{it:expression_2}{cmd:)}
{cmdab:sd:}{cmd:(}{it:expression_3}{cmd:)}
{cmdab:muz:ero}{cmd:(}{it:expression_4}{cmd:)}
{cmdab:sdz:ero}{cmd:(}{it:expression_5}{cmd:)}
{cmd:float}
]
{pstd}
where {it:expression_i} (for {it:i} an integer} is a numeric expression.
The numeric expression for each
option must be in the form required by the {cmd:generate} command. That is to say,
each expression must be specified so that the command
{pstd}
{cmd:gene double }{it:newvarname}{cmd:=(}{it:expression}{cmd:)}
{pstd}
will work.
{title:Description}
{pstd}
{cmd:normalrir} inputs expressions to deliver, respectively, a uniform deviate variable,
2 means for 2 Normal populations (Population 1 and Population 0),
and 2 standard deviations for the same 2 Normal populations.
It outputs a new variable, containing, in each observation,
the ridit with respect to Population 0
of a value sampled from Population 1,
whose Normal cumulative distribution function for Population 1 has the value of the uniform deviate variable
in the same observation.
{cmd:normalrir} can be used with the {help ssc:SSC} packages {helpb expgen} and {helpb powercal}
to perform multi-scenario power and sample size calculations for the 2-sample rank statistics
Somers' {it:D} and Harrell's {it:c},
assuming that there exists an unspecified transformation that transforms the outcome variable
to a variable with a Normal distribution in each of the 2 populations
from which the 2 samples are sampled.
{title:Options}
{p 0 4}
{cmd:uniform(}{it:expression_1}{cmd:)} gives an expression,
whose value is interpreted as a uniform deviate from the continuous uniform distribution from 0 to 1.
This option is required.
The output variable will have a nonmissing value in and only in observations
in which the {cmd:uniform()} expression evaluates to a value in the closed interval
from 0 to 1 inclusive.
{p 0 4}
{cmd:mu(}{it:expression_2}{cmd:)} gives an expression, whose value is the mean of Population 1.
If absent, it is set to 0.
Note that the expression may contain variables and/or scalars and/or constants,
but defines a variable whose values are different in different observations,
because we may be comparing multiple pairs of populations in different observations,
as in a multi-scenario power calculation..
{p 0 4}
{cmd:sd(}{it:expression_3}{cmd:)} gives an expression,
whose value is the standard deviation of Population 1.
If absent, it is set to 1.
{p 0 4}
{cmd:muzero(}{it:expression_4}{cmd:)} gives an expression,
whose value is the mean of Population 0.
If absent, it is set to 0.
{p 0 4}
{cmd:sdzero(}{it:expression_5}{cmd:)} gives an expression,
whose value is the standard deviation of Population 0.
If absent, it is set to 1.
{p 0 4}
{cmd:float} specifies that the output variable will have a {help datatypes:storage type} no higher than {hi:float}.
If {cmd:float} is not specified, then {cmd:normalrir} creates the output variable with storage type {hi:double}.
Whether or not {cmd:float} is specified, {cmd:normalrir} compresses the output variable as much as possible
without loss of precision. (See help for {helpb compress}.)
{title:Methods and formulas}
{pstd}
{cmd:normalrir} computes the ridits, with respect to Population 0,
of the inverse ridits, with respect to Population 1,
of the uniform deviates supplied by the {cmd:uniform()} option.
Ridits were introduced in {help normalrir##normalrir_references:Bross (1958)},
and are equal, for a continuously-distributed variable,
to the cumulative distribution function (CDF)
of the population with respect to which the ridits are defined.
More precisely, the ridit with respect to Population 0
of the inverse ridit with respect to Population 1
of a value {cmd:U} in the closed interval from 0 to 1 inclusive
is denoted as {hi:RIR_01(U)}, and is defined as 0 for {hi:U=0}, 1 for {hi:U=1},
and
{pstd}
{hi:RIR_01(U) = F_0(invF_1(U))}
{pstd}
if {hi:0