rank.wald | R Documentation |

Rank responses of a single response question or a multiple response question by the wald test procedure.

rank.wald(data, alpha = 0.05, ranktype = 1)

`data` |
A m by n matrix |

`alpha` |
The significance level is used to control the type I error rate. The default is 0.05. |

`ranktype` |
A numerical value specifies which type of ranking method is used. The default is 1 (see 'Details'). |

Suppose that the question has k responses.
Let *π_{j}* denote the probability that the jth response is selected.
Using the survey data, *π_{j}* can be estimated.

If `ranktype`

is 1, the ranking rule is the following steps.
Let *π_{(j)}* denote the order statistic.
If the hypothesis *π_{(k)}* = *π_{(k-1)}* is rejected,
we rank the response corresponding to *π_{(k)}* first.
If it is not rejected, we compare *π_{(k)}* with *π_{(j)}*
, *j ≤ k-2* sequentially.

If `ranktype`

is 2, the rank of the ith response can be defined as

*
R_{i} = k - ∑_{j=1, j\ne i}^{k} I(π_{i} > π_{j})
*

rank.wald returns a table contains the estimated probabilities of the responses being selected in the first line and the ranks of the responses in the second line.

Hsiuying Wang wang@stat.nycu.edu.tw , Wan-Ting Huang wthuang.sc09@nycu.edu.tw , Yu-Chun Lin restart79610@hotmail.com

Wang, H. (2008). Ranking Responses in Multiple-Choice Questions. Journal of Applied Statistics, 35, 465-474.

Wang, H. and Huang, W. H. (2014). Bayesian Ranking Responses in Multiple Response Questions. Journal of the Royal Statistical Society: Series A (Statistics in Society), 177, 191-208.

`rankL2R`

, `rankLN`

, `rank.gs`

set.seed(12345) # This is an example to rank k responses in a multiple response question # when the number of respondents is 1000. # In this example, we do not use a real data, but generate data in the first six lines. k <- 5 data <- matrix(NA, nrow = 1000, ncol = k) for(i in 1:k){ p <- runif(1) data[, i] <- sample(c(0, 1), 1000, p = c(p, 1-p), replace = TRUE) } ## or upload the true data rank.wald(data)

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.