Title: | Ranking Responses in a Single Response Question or a Multiple Response Question |
---|---|
Description: | Methods for ranking responses of a single response question or a multiple response question are described in the two papers: 1. Wang, H. (2008). Ranking Responses in Multiple-Choice Questions. Journal of Applied Statistics, 35, 465-474. <DOI:10.1080/02664760801924533> 2. 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. <DOI:10.1111/rssa.12009>. |
Authors: | Hsiuying Wang, Yu-Chun Lin, Wan-Ting Huang |
Maintainer: | Hsiuying Wang <[email protected]> |
License: | GPL (>= 2) |
Version: | 4.0.0 |
Built: | 2024-12-31 07:57:40 UTC |
Source: | CRAN |
Rank responses of a single response question or a multiple response question by the generalized score test procedure.
rank.gs(data, alpha = 0.05, ranktype = 1)
rank.gs(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 denote the probability that the jth response is selected.
Using the survey data,
can be estimated.
If ranktype
is 1, the ranking rule is the following steps.
Let denote the order statistic.
If the hypothesis
=
is rejected,
we rank the response corresponding to
first.
If it is not rejected, we compare
with
,
sequentially.
If ranktype
is 2, the rank of the ith response can be defined as
rank.gs 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 [email protected] , Wan-Ting Huang [email protected] , Yu-Chun Lin [email protected]
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.
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.gs(data)
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.gs(data)
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)
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 denote the probability that the jth response is selected.
Using the survey data,
can be estimated.
If ranktype
is 1, the ranking rule is the following steps.
Let denote the order statistic.
If the hypothesis
=
is rejected,
we rank the response corresponding to
first.
If it is not rejected, we compare
with
,
sequentially.
If ranktype
is 2, the rank of the ith response can be defined as
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 [email protected] , Wan-Ting Huang [email protected] , Yu-Chun Lin [email protected]
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.
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)
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)
Rank responses of a single response question or a multiple response question under the Bayesian framework according to the loss function in Method 3 of Wang and Huang (2004).
rankL2R(data, response.number, prior.parameter, e)
rankL2R(data, response.number, prior.parameter, e)
data |
A m by n matrix |
response.number |
The number of the responses. |
prior.parameter |
The parameter vector of the Dirichlet prior distribution, where the vector dimension is 2^response.number. |
e |
A cut point used in the loss function which depends on the economic costs. |
The rankL2R returns the estimated probabilities of the responses being selected in the first line and the ranks of the responses in the second line.
Hsiuying Wang [email protected] , Yu-Chun Lin [email protected]
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.
set.seed(12345) # This is an example to rank k responses in a multiple response question # when the number of respondents is 1000 and the value e is 0.15. # In this example, we do not use a real data, but generate data in the first six lines. k <- 3 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 response.number <- 3 prior.parameter <- c(5, 98, 63, 7, 42, 7, 7, 7) e <- 0.15 rankL2R(data, response.number, prior.parameter, e)
set.seed(12345) # This is an example to rank k responses in a multiple response question # when the number of respondents is 1000 and the value e is 0.15. # In this example, we do not use a real data, but generate data in the first six lines. k <- 3 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 response.number <- 3 prior.parameter <- c(5, 98, 63, 7, 42, 7, 7, 7) e <- 0.15 rankL2R(data, response.number, prior.parameter, e)
Rank responses of a single response question or a multiple response question under the Bayesian framework according to the loss function in Method 1 of Wang and Huang (2004).
rankLN(data, response.number, prior.parameter, c)
rankLN(data, response.number, prior.parameter, c)
data |
A m by n matrix |
response.number |
The number of the responses. |
prior.parameter |
The parameter vector of the Dirichlet prior distribution , where the vector dimension is 2^response.number. |
c |
The value of c in the loss function |
The rankLN returns the estimated probabilities of the responses being selected in the first line and the ranks of the responses in the second line.
Hsiuying Wang [email protected] , Yu-Chun Lin [email protected]
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.
set.seed(12345) # This is an example to rank k responses in a multiple response question # when the number of respondents is 1000 and the value e2R is 0.15. # In this example, we do not use a real data, but generate data in the first six lines. k <- 3 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 response.number <- 3 prior.parameter <- c(5, 98, 63, 7, 42, 7, 7, 7) c <- 0.05 rankLN(data, response.number, prior.parameter, c)
set.seed(12345) # This is an example to rank k responses in a multiple response question # when the number of respondents is 1000 and the value e2R is 0.15. # In this example, we do not use a real data, but generate data in the first six lines. k <- 3 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 response.number <- 3 prior.parameter <- c(5, 98, 63, 7, 42, 7, 7, 7) c <- 0.05 rankLN(data, response.number, prior.parameter, c)