.- help for ^xriqtest^ (STB-47: sbe25) .- Cross-sectional reference intervals: "Q-Tests" for goodness-of-fit ------------------------------------------------------------------ ^xriqtest^ zvar xvar [^if^ exp] [^in^ range]^,^ ^par^ams^(^[^m:^#1]^,^[^s:^#2]^,^[^g:^#3]^)^ [ ^g^roups^(^# | groupvar^)^ ^m^ingroup^(^#^)^ ^gen^erate ] Description ----------- ^xriqtest^ performs Q-tests for assessing goodness of fit of models used to estimate age-specific reference centiles. zvar contains Z-scores from the model and xvar contains the ages. Options ------- ^params(^[^m:^#1]^,^[^s:^#2]^,^[^g:^#3]^)^ is NOT optional and specifies the dimensions (numbers of parameters) of different parts of the model. The regression constant for each curve counts as one parameter. The minimal requirement is to specify ^params(m:^#1^, s:^#2^)^ which indicates that the model is Normal with a mean curve with #1 parameters and a standard deviation curve with #2 parameters. The values of #1, #2 and #3 are important because they are used by ^xriqtest^ to determine the degrees of freedom for the Q tests. If, for example, a Normal model has been fitted with a quadratic polynomial (or a two-term fractional polynomial) for the mean curve and a straight line for the standard deviation curve, one would specify ^params(m:3,s:2)^ (or ^params(m:3,s:2,g:0)^ which is equivalent). Note that it is your responsibility to specify #1, #2 and #3 correctly since ^xriqtest^ has no way of checking them; incorrect values may result in misleading test results. ^groups(^#|groupvar^)^ specifies either #, the number of equal-sized groups to be created according to the values of xvar, or groupvar, an existing variable used to define the groups. If the ^groups()^ option is omitted, a default choice for # is made as follows. Let n be the sample size and let k be the smallest acceptable group size: # = 1 if n < 2*k # = [n/k] if 2*k <= n <= 10*k (where [] means integer part) # = 10 if n>10*k This choice of # ensures each group is never smaller than k. The default value of k is set by using the ^mingroup()^ option. If specified, # must be at least 1 and no more than 50. ^mingroup(^#^)^ determines the smallest acceptable group size (see the ^groups()^ option). Default # is 50. ^generate^ creates 6 new variables as follows: Variable name Contents --------------------------------------------------------- ^_group^ values of grouping variable (1, 2, ...) ^_mean^ means of grouped Z-scores ^_sd^ standard devations of grouped Z-scores ^_pskew^ P-values for skewness coefficients ^_pkurt^ P-values for kurtosis coefficients ^_pswilk^ P-values for Shapiro-Wilk W statistics --------------------------------------------------------- Variables with the above names are automatically replaced when the ^generate^ option is used. Remarks ------- ^xriqtest^ performs five "Q-tests" which assess the first four moments of G groups of Z-scores against the values expected from a standard Normal distribution, and the Normality of the Z-scores according to the Shapiro-Wilk W test. The tests are extensions of those for the standard (one-group) case. Each Q statistic is assumed to have a chi-square distribution with degrees of freedom (DF) derived in a simulation study by Royston and Wright (1998). Q_1 equals the sum of squares of the group means, weighted by group size. Deviation from the null hypothesis of zero means will inflate Q_1. Q_2 equals the sum of squares of the Wilson-Hilferty transformed, standardized group variances. Heteroscedasticity and/or variances not equal to 1 will inflate Q_2. Q_3 equals the sum of squares of u(Pi/2), where Pi represents the two-sided P-value for the skewness coefficient in the ith group and u(Pi) represents the Normal equivalent deviate of Pi. Skewness in the Z-scores will inflate Q_3. Q_4 equals the sum of squares of u(Pi/2), where Pi represents the two-sided P-value for the kurtosis coefficient in the ith group and u(Pi) represents the Normal equivalent deviate of Pi. Kurtosis in the Z-scores will inflate Q_4. Q_5 equals the sum of -2*ln(Pi), where Pi represents the P-value from a Shapiro-Wilk W test for the ith group (i.e. Q_5 uses Fisher's method of combining P-values). Non-Normality in any/all the groups will inflate Q_5. (Note: the group means and SDs are NOT assumed to be 0 and 1 respectively for this test.) Stored ------ ^xriqtest^ stores in the $^S_^# macros: ^$S_1^ number of observations ^$S_2^ number of xvar groups ^$S_3^ 0+/-^$S_3^ is approx. $S_level% confidence interval for means ^$S_4^ 1+/-^$S_4^ is approx. $S_level% confidence interval for SDs ^$S_5^ P-value for Q test on means ^$S_6^ " " " " standard deviations ^$S_7^ " " " " skewness coefficients ^$S_8^ " " " " kurtosis coefficients ^$S_9^ " " " " overall Normality (Shapiro-Wilk tests) Example ------- . ^use auto^ . ^xrigls mpg price, fp(m:df 4,s:df 2)^ . ^xriqtest Z_gls price, params(m:3,s:2)^ . ^xriqtest Z_gls price, params(m:3,s:2) mingroup(30)^ . ^xriqtest Z_gls price, params(m:3,s:2) groups(3) generate^ Reference --------- P. Royston and E.M. Wright. 1998. Goodness-of-fit statistics for age-specific reference intervals. Statistics in Medicine, submitted. Authors ------- Eileen M. Wright, Imperial College School of Medicine, UK ewright@@rpms.ac.uk Patrick Royston, Imperial College School of Medicine, UK proyston@@rpms.ac.uk Also see -------- STB: STB-47 sbe25 On-line: ^help^ for @xriml@, @xrigls@, @xripl@, @swilk@, @sktest@