{smcl} {hline} help for {cmd:wridit} and {cmd:fridit}{right:(Roger Newson)} {hline} {title:Generate weighted ridits} {p 8 21 2} {cmd:wridit} {varname} {ifin} {weight} , {cmdab:g:enerate}{cmd:(}{help varname:{it:newvarname}}{cmd:)} {break} [ {cmd:by(}{varlist}{cmd:)} {cmdab:ha:ndedness}{cmd:(}{it:handedness}{cmd:)} {cmdab:fol:ded} {cmdab:rev:erse} {cmdab:perc:ent} {cmd:float} ] {p 8 21 2} {cmd:fridit} {varname} {ifin} , {cmdab:g:enerate}{cmd:(}{help varname:{it:newvarname}}{cmd:)} {break} {cmdab:ffr:ame}{cmd:(}{it:framename} [, {cmdab:w:eightvar}{cmd:(}{varname}{cmd:)} {cmdab:x:var}{cmd:(}{varname}{cmd:)}] {cmd:)} {break} [ {cmd:by(}{varlist}{cmd:)} {cmdab:ha:ndedness}{cmd:(}{it:handedness}{cmd:)} {cmdab:fol:ded} {cmdab:rev:erse} {cmdab:perc:ent} {cmd:float} ] {pstd} where {it:handedness} is {pstd} {cmdab:c:enter} | {cmdab:l:eft} | {cmdab:r:ight} {pstd} {cmd:fweight}s, {cmd:pweight}s, {cmd:aweight}s, and {cmd:iweight}s are allowed for {cmd:wridit}; see {help weight}. {title:Description} {pstd} {cmd: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. Zero weights are allowed, and imply that the ridits calculated for the observations with zero weights will refer to the distribution of weights in the observations with nonzero weights. {cmd:fridit} inputs a variable and generates its weighted foreign ridits, with respect to a distribution identified by the data in a {help frame:data frame}. {title:Options for {cmd:wridit} and {cmd:fridit}} {p 4 8 2} {cmd:generate(}{help varname:{it:newvarname}}{cmd:)} must be specified. It specifies the name of the generated output variable, containing the weighted ridits. {p 4 8 2} {cmd:by(}{varlist}{cmd:)} specifies a list of by-variables. If {cmd:by()} is specified, then the weighted ridits are computed within by-groups. {p 4 8 2} {cmd:handedness(}{it:handedness}{cmd:)} specifies the handedness of the ridits to be generated. It may be {cmd:center} (the default), {cmd:left}, or {cmd:right}. If {cmd:left} is specified, then the left-continuous ridit is generated. If {cmd:right} is specified, then the right-continuous ridit is generated. If {cmd:center} is specified (or the {cmd:handedness()} option is absent), then the standard center ridits (equal in each observation to the mean of the left ridit and the right ridit) are generated. {p 4 8 2} {cmd:folded} specifies that the weighted ridits generated will be folded ridits. A folded ridit, on a proportion scale from -1 to 1, is defined as {cmd:2*R-1}, where {cmd:R} is the corresponding unfolded ridit (on a proportion scale from 0 to 1). {p 4 8 2} {cmd:reverse} specifies that the weighted ridits will be reverse ridits, based on reverse cumulative probabilities. {p 4 8 2} {cmd:percent} specifies that the weighted ridits will be generated on a percentage scale from 0 to 100, or from -100 to 100 if {cmd:folded} is specified. If {cmd:percent} is not specified, then the weighted ridits will be generated on a proportion scale from 0 to 1, or from -1 to 1 if {cmd:folded} is specified. {p 4 8 2} {cmd:float} specifies that the weighted ridits will be generated with {help data types:storage type} {cmd:float}. If {cmd:float} is not specified, then the weighted ridits will be generated with {help data types:storage type} {cmd:double}. The generated variable will then be compressed, if that can be done without loss of information. {title:Options for {cmd:fridit} only} {p 4 8 2} {cmd:fframe(}{it:framename} [, {cmd:weightvar(}{varname} {cmd:xvar(}{varname}{cmd:)}] {cmd:)} must be specified. It specifies an existing {help frame:data frame}, knowwn as the foreign frame, and specifying a distribution with respect to which the ridits will be generated. This data frame must contain a variable with the same mode (numeric or string) as the input variable, with the name specified by the {cmd:xvar()} option if present and the same name as the input variable otherwise, plus variables with the same names and modes as the {cmd:by()} variables (if a {cmd:by()} option is specified). It may also contain a weight variable, specified by the {cmd:weightvar()} suboption, containing weights to specify a frequency distribution for the variable with the same name as th input variable. If a {cmd:weightvar()} option is not specified, then all weights are assumed to be 1. The generated variable will contain foreign ridits, which are ridits with respect to the distribution specified by the variable of the same name in the foreign frame, and by the weight variable in the foreign frame (if specified). {title:Methods and formulas} {pstd} Ridits were introduced by Bross (1958). Given a variable {it:X}, the unfolded ridit for a value {it:x} is equal to the probability that {it:Xx}. These ridits are classed as center ridits. The unfolded left ridit is the probability that {it:X=x}. The unfolded right ridit is the probability that {it:X<=x}, and the folded right ridit is the probability that {it:X<=x} minus the probability that {it:X>x}. Note that the center ridit is the mean of the left ridit and the right ridit, whether unfolded or folded ridits are generated. Note, also, that the unfolded right ridit is also known as the sample cumulative distribution function. {pstd} Foreign ridits (computed by {cmd:fridit}) are defined in the same way as the native ridits generated by {cmd:wridit}, except that they are defined with respect to the distribution of a variable {it:Y}, possibly in another population, instead of with respect to the distribution of {it:X}. For instance, the unfolded ridit for a value {it:x} is equal to the probability that {it:Y