• No results found

Adaptive Rank Scores Tests

---Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Multiple R-squared (Robust): 0.128132

Reduction in Dispersion Test: 4.11495 p-value: 0.05211 The estimate of tau for the bentscores is

> fit$tauhat [1] 19.79027

while the estimate of tau for the Wilcoxon scores is

> rfit(z~xmat)$tauhat [1] 21.64925

In summary, using these bent scores, the rank-based estimate of shift is

∆ = −16 with standard error 7.66, which is significant at the 5% level forb a two-sided test. Note that the estimate of shift is closer to the estimate of shift based on the boxplots than the estimate based on the Wilcoxon score; see Example 3.2.3. From the code segment, the estimate of the rela-tive precision (3.46) of the bent scores analysis versus the Wilcoxon analysis is (19.790/21.649)2= 0.836. Hence, the Wilcoxon analysis is about 16% less precise than the bentscore analysis for this dataset.

The use of Winsorized Wilcoxon scores for the quail data was based on an extensive investigation of many datasets. Estimation of the score function based on the rank-based residuals is discussed in Naranjo and McKean (1987).

Similar to density estimation, though, large sample sizes are needed for these score function estimators. Adaptive procedures for score selection are discussed in the next section.

As we discussed above, if no assumptions about the distribution can be reasonably made, then we recommend using Wilcoxon scores. The resulting rank-based inference is robust and is highly efficient relative to least squares based inference. Wilcoxon scores are the default in Rfit and are used for most of the examples in this book.

3.6 Adaptive Rank Scores Tests

As discussed in Section 3.5.1, the optimal choice for score function depends on the underlying error distribution. However, in practice, the true

distribu-tion is not known and we advise against making any strong distribudistribu-tional assumptions about its exact form. That said, there are times, after working with prior similar data perhaps, that we are able to choose a score function which is appropriate for the data at hand. More often, though, the analyst has a single dataset with no prior knowledge. In such cases, if hypothesis testing is the main inference desired, then the adaptive procedure introduced by Hogg (1974) allows the analyst to first look at the (combined) data to choose an appropriate score function and then allows him to use the same data to test a statistical hypothesis, without inflating the type I error rate.

In this section, we present the version of Hogg adaptive scheme for the two-sample location problem that is discussed in Section 10.6 of Hogg, McKean, and Craig (2013). Consider a situation where the error distributions are either symmetric or right-skewed with tail weights that vary from light-tailed to heavy-tailed. For this situation, we have chosen a scheme that is based on selecting one of the four score functions in Figure 3.8. In applying the adaptive scheme to a particular application, other more appropriate score functions can be selected for the scheme. The number of score functions can also vary.

0.0 0.2 0.4 0.6 0.8 1.0

−1.5−0.50.51.5

u

φ

Wilcoxon Scores

0.0 0.2 0.4 0.6 0.8 1.0

−1.00.00.51.0

u

φ

Sign Scores

0.0 0.2 0.4 0.6 0.8 1.0

−2−1012

u

vert

Light Tailed Scores

0.0 0.2 0.4 0.6 0.8 1.0

−2.0−1.00.0

u

φ

Bent Scores for Right Skewed Errors

FIGURE 3.8

Score functions used in Hogg’s adaptive scheme.

The choice of the score function is made by selector statistics which are

based on the order statistics of the combined data. For our scheme, we have chosen two which we label Q1 and Q2, which are

Q1=U¯0.05− ¯M0.5

0.5− ¯L0.05

and Q2= U¯0.05− ¯L0.05

0.5− ¯L0.5

, (3.47)

where U0.05is the mean of the Upper 5%, M0.5is the mean of the Middle 50%, and L0.05 is the mean of the Lower 5% of the combined sample. Note Q1 is a measure of skewness and Q2 is a measure of tail heaviness. Benchmarks for the selectors must also be chosen. The following table shows the benchmarks that we used for our scheme.

Benchmark Score Selected Q2> 7 Sign Scores

Q1> 1 & Q2< 7 Bent Score for Right Skewed Data Q1≤ 1 & Q2≤ 2 Light Tailed Scores

else Wilcoxon

The R function hogg.test is available in npsm which implements this adaptive method. This function selects the score as discussed above then ob-tains the test of H0 : ∆ = 0. It returns the test statistic, p-value, and the score selected (boldface names in the above table). We illustrate it on several generated datasets.

Example 3.6.1. The following code generates four datasets and for each the results of the call to function hogg.test is displayed.

> m<-50

> n<-55

> # Exponential

> hogg.test(rexp(m),rexp(n)) Hogg’s Adaptive Test

Statistic p.value 4.32075 0.21434 Scores Selected: bent

> # Cauchy

> hogg.test(rcauchy(m),rcauchy(n)) Hogg’s Adaptive Test

Statistic p.value 3.56604 0.31145 Scores Selected: bent

> # Normal

> hogg.test(rnorm(m),rnorm(n))

Hogg’s Adaptive Test Statistic p.value

2.84318 0.57671

Scores Selected: Wilcoxon

> # Uniform

> hogg.test(runif(m,-1,1),runif(n,-1,1)) Hogg’s Adaptive Test

Statistic p.value -2.1321 0.2982 Scores Selected: light

Remark 3.6.1. In an investigation of microarray data Kloke et al. (2010) successfully used Hogg’s adaptive scheme. The idea is that each gene may have a different underlying error distribution. Using the same score function, for example the Wilcoxon, for each of the genes may result in low power for any number of genes, perhaps ones which would have a much higher power with a more appropriately chosen score function. As it is impossible to examine the distribution of each of the genes in a microarray experiment an automated adaptive approach seems appropriate.

Shomrani (2003) extended Hogg’s adaptive scheme to estimation and test-ing in a linear model. It is based on an initial set of residuals and, hence, its tests are not exact level α. However, for the situations covered in Al-Shomrani’s extensive Monte Carlo investigation, the overall liberalness of the adaptive tests was slight. We discuss Al-Shomrani’s scheme in Chapter 7.

Hogg’s adaptive strategy was recently extended to mixed linear models by Okyere (2011).

3.7 Exercises

3.7.1. For the baseball data available in Rfit, test the hypothesis of equal heights for pitchers and fielders.

3.7.2. Verify the estimates in Table 3.1.

3.7.3. Verify equivalence of the Mann–Whitney (3.6) and Wilcoxon (3.5) tests for the data in Example 3.2.3.

3.7.4. Let T = log S, where S has an F -distribution with degrees of freedom ν1 and ν2. It can be shown, that the distribution of T is left-skewed, right-skewed, or symmetric if ν1< ν2, ν1> ν2, or ν1= ν2, respectively.

(a) Generate two samples of size n = 20 from a log F (1, 0.25) distribu-tion, to one of the two samples add a shift of size ∆ = 7. Below is the code to generate the samples.

x <- log(rf(20,1,.25)) y <- log(rf(20,1,.25)) + 7.0 (b) Obtain comparison dotplots of the samples.

(c) Obtain the LS, Wilcoxon, and bentscores1 estimates of ∆ along with their standard errors.

3.7.5. Write R code which generates data as in Exercise 3.7.4. Then run a simulation study to estimate the ARE’s among the three estimators: LS, Wilcoxon, and rank-based estimate using the scores bentscores1; where, the empirical ARE between two estimators is their ratio of mean square errors.

Use a simulation size of 10,000. Which estimator is best? Which is worst?

3.7.6. Using the function hogg.test, run Hogg’s adaptive scheme of Sec-tion 3.6 on the data of Exercise 3.7.4.

3.7.7. The truncated normal distribution is implemented in the R package truncnorm(Trautmann et al. 2014). Simulate two independent samples from a truncated normal distribution with parameters σ = 1, a = −0.5, b = 0.5;

the last two parameters are the min and max respectively. Set the mean for one of the populations to be 5 and the other to be 8.

(a) Obtain comparison boxplots of these two samples.

(b) Using the R function hogg.test provided in the package npsm run the adaptive scheme discussed in Section 3.6 to test for a location difference using these two samples.

3.7.8. Consider the logistic distribution given in expression (3.45). For this exercise, consider the standard pdf with parameters a = 0 and b = 1.

(a) Show that the cdf is given by F (x) = 1

1 + e−x, −∞ < x < ∞.

(b) Show that the inverse of the cdf is F−1(u) = log

 u 1 − u



, 0 < u < 1.

3.7.9. The logistic distribution is implemented in base R (*logis). Using rlogisobtain a random sample of size 1000 from a logistic distribution with location 0 and scale 1. Use the R function density to obtain a density estimate based on this sample and plot it (e.g. plot(density(rlogis(1000))). On the graph of the estimated density overlay the graph of the true density (3.45) with parameters a = 0 and b = 1. Comment on the closeness of the fit.

3.7.10. Write an R function which obtains two independent samples from the logistic distribution, and then runs Hogg’s adaptive scheme of Section 3.6 on these data. Have the input to the function be the sample sizes: n and m.

(a) Write R code to simulate Hogg’s adaptive scheme for testing for a shift in location when sampling from a logistic. Use sample sizes of n = 20 and m = 25.

(b) Run your simulation in Part (a) 1000 times. Check the p-value for a 5% test. How many times did the scheme select the Wilcoxon scores? Obtain a 95% confidence interval for the probability of cor-rect selection.

3.7.11. Consider the following two samples. The first was generated from a N (50, 64) distribution while the second was generated from a N (50, 144) distribution. Thus the ratio of scales is 2.0.

Sample from N (50, 64) distribution.

43.72 58.06 55.57 57.49 64.16 43.49 49.94 49.94 52.58 49.40 38.93 42.65 42.91 46.59 47.88

Sample from N (50, 256) distribution.

77.10 42.94 42.32 53.51 66.79 18.26 38.72 29.04 33.54 61.19 32.87 60.98 59.02 60.68 45.11 43.52 35.44 34.31 (a) Obtain comparison boxplots.

(b) Obtain the analysis based on the Fligner–Killeen procedure to test for difference in scales for this data. Was the confidence interval successful in trapping the true ratio of scales given by η = 2.0?

3.7.12. In Remark 3.3.1, we cited the study by Conover et al. (1983) which shows rather dramatically that the traditional F -test for differences in vari-ances is generally not valid for nonnormal distributions. The double exponen-tial (Laplace) was one of the many distributions over which it was invalid.

The pdf of double exponential is given by f (x) = 1

2e−|x|, −∞ < x < ∞.

(a) Show that the following code generates a sample from this double exponential distribution.

rlaplace<-function(n){

x<-rexp(n)

ind<-sample(c(-1,1),n,replace=TRUE) ind*x

}

(b) By running a small simulation study, verify that the Fligner–Killeen procedure is valid for testing for scale differences when sampling

from the double exponential distribution. Use sample sizes of n1= 30 and n2= 35, and sample under H0; i.e., draw the samples using the R function rlaplace. Collect the p-values for a two-sided test for 1000 simulations and verify that the test with level 0.05 is valid.

3.7.13. Consider the data of Exercise 3.7.11. The samples were generated from the N (50, 64) and N (50, 144) distributions, respectively. Use the Fligner–

Policello test described in Section 3.4 to test for a difference in locations. Recall by Example 3.4.1 that the npsm function fp.test can be used to perform this analysis.

4

Regression I

4.1 Introduction

In this chapter, a nonparametric, rank-based (R) approach to regression mod-eling is presented. Our primary goal is the estimation of parameters in a linear regression model and associated inferences. As with the previous chapters, we generally discuss Wilcoxon analyses, while general scores are discussed in Sec-tion 4.4. These analyses generalize the rank-based approach for the two-sample location problem discussed in the previous chapter. Focus is on the use of the R package Rfit (Kloke and McKean 2012). We illustrate the estimation, diag-nostics, and inference including confidence intervals and test for general linear hypotheses. We assume that the reader is familiar with the general concepts of regression analysis.

Rank-based (R) estimates for linear regression models were first consid-ered by Jureˇckov´a (1971) and Jaeckel (1972). The geometry of the rank-based approach is similar to that of least squares as shown by McKean and Schrader (1980). In this chapter, the Rfit implementation for simple and multiple linear regression is discussed. The first two sections of this chapter present illustra-tive examples. We present a short introduction to the more technical aspects of rank-based regression in Section 4.4. The reader interested in a more de-tailed introduction is referred to Chapter 3 of Hettmansperger and McKean (2011).

We also discuss aligned rank tests in Section 4.5. Using the bootstrap for rank regression is conceptually the same as other types of regression and Section 4.6 demonstrates the Rfit implementation. Nonparametric Smoothers for regression models are considered in Section 4.7. In Section 4.8 correlation is presented, including the two commonly used nonparametric measures of association of Kendall and Spearman. In succeeding chapters we present rank-based ANOVA analyses and extend rank-rank-based fitting to more general models.

83