bws.count: Calculating count-based BW scores

View source: R/bws.count.R

bws.countR Documentation

Calculating count-based BW scores

Description

This function calculates various BW scores on the basis of a counting approach.

Usage

bws.count(data, cl = 1)

## S3 method for class 'bws.count'
print(x, digits = max(3, getOption("digits") - 3), scientific = FALSE, ...)

## S3 method for class 'bws.count2'
plot(x, score = c("bw", "b", "w"), pos = 1, xlab = NULL, ylab = NULL, subset, ...)

## S3 method for class 'bws.count2'
barplot(height, score = c("bw", "b", "w", "sbw"), mfrow = NULL, mean = FALSE, 
error.bar = NULL, conf.level = 0.95, subset, sort = FALSE, ...)

## S3 method for class 'bws.count2'
sum(x, ...)

## S3 method for class 'bws.count2'
mean(x, ...)

## S3 method for class 'bws.count2'
summary(object, sort = FALSE, subset, ...)

## S3 method for class 'summary.bws.count2'
print(x, digits = max(3, getOption("digits") - 3), scientific = FALSE, ...)

Arguments

data

A data frame containing the output from bws.dataset().

cl

A value describing the S3 class of the object created by this function: 1 for the S3 class "bws.count", and 2 for the S3 class "bws.count2".

x, height, object

An object of the S3 class "bws.count" or "bws.count2".

digits

The number of significant digits. See the format function.

scientific

Scores are encoded in scientific format. See the format function.

score

A character showing a type of the output from this function: "b" is assigned to this argument when the output is based on best scores, "w" is assigned when it is based on worst scores, "bw" is assigned when it is based on best-minus-worst scores, or "sbw" is assigned when it is based on standardized best-minus-worst scores.

pos

A value showing a position of labels for points in the plot. See the argument pos of the text function.

xlab

A character showing a label for the x axis.

ylab

A character showing a label for the y axis.

mfrow

A two-element vector c(nr, nc): bar plots will be drawn in an nr-by-nc array on the device by row.

mean

A logical value denoted by TRUE when drawing a bar plot of the aggregated standardized BW scores or FALSE (default) when drawing bar plots of B, W, or BW scores.

error.bar

A character shoiwng a type of error bar adding on the bar plot of the aggregated standardized BW scores: "sd" for the standard deviation; "se" for the standard error; "ci" for the confidence interval; and NULL (default) for none.

conf.level

A value showing the confidence level when adding the confidence interval on the bar plot using error.bar.

subset

A logical expression indicating a subset of observations to be used.

sort

A logical value denoted by TRUE when sorting barplots or items according to mean scores or FALSE (default).

...

Arguments passed to a function used internally.

Details

This function calculates various BW scores on the basis of the counting approach. For details on the scores, refer to support.BWS-package.

When using this function with the argument cl = 1, it returns an object of the S3 class "bws.count", containing disaggregated scores and aggregated scores in list format. The first category includes disaggregated best (B), worst (W), best-minus-worst (BW), and standardized BW scoers. The second category includes aggregated B, W, BW, and standardized BW scores as well as the square root of the ratio of the aggregated B to the aggregated W and its standardized scores. The generic function print() is available for the S3 class "bws.count". The print() shows a summary of disaggregated scores and a table of aggregated scores.

When using this function with the argument cl = 2, it returns an object of the S3 class "bws.count2", which inherits from the S3 class "data.frame", including disaggregated B, W, BW, and standardized BW scores, respondent identification number variable, and respondent characteristic variables. The generic functions such as plot(), barplot(), sum(), mean(), and summary() are available for the S3 class "bws.count2". The plot() draws the relationship between means and standard deviations of B, W, or BW scores. The barplot() draws the bar plot of the aggregated standardized BW scores or the bar plots of B, W, or BW scores. The sum() returns the aggregated B, W, and BW scores in data frame format. The mean() returns means of B, W, BW, and standardized BW scores in data frame format. The summary() calculates (1) aggregated B, W, BW, and standardized BW scores, (2) item ranks based on the BW score, (3) means of B, W, BW, and standardized BW scores, and (4) the square root of the aggregated B to the aggregated W and its standardized scores.

Value

The output from bws.count() with the argument cl = 1 is an object of the S3 class "bws.count", containing three components:

A list disaggregate contains five objects related to disaggregated scores.

ID

A vector showing the respondent's identification number.

B

A matrix showing the number of times item i is selected as the best by each respondent.

W

A matrix showing the number of times item i is selected as the worst by each respondent.

BW

A matrix showing the difference between B and W for item i per respondent.

stdBW

A matrix showing standardized BW.

A data frame aggregate contains aggregated scores across all respondents.

B

A variable showing the number of times item i is selected as the best across all respondents.

W

A variable showing the number of times item i is selected as the worst across all respondents.

BW

A variable showing the difference between B and W for item i across all respondents.

stdBW

A variable showing standardized BW.

sqrtBW

A variable showing the square root of the ratio of B to W for item i across all respondents.

std.sqrtBW

A variable showing the standardized sqrtBW.

A list information contains basic information related to the BWS questions.

nrespondents

A variable showing the number of respondents.

nitems

A variable showing the number of items.

fitem

A variable showing the frequency of each item in the choice sets.

vnames

A variable showing the names of each item.

The output from bws.count() with the argument cl = 2, which is an object of the S3 class "bws.count2", is a data frame containing respondent identification number variable, B score variables, W score variables, BW score variables, standardized BW score variables, and respondent characteristic variables. These scores are calculated by each respondent.

Note that the S3 class "bws.count" would be replaced by the S3 class "bws.count2" in future.

Author(s)

Hideo Aizaki

See Also

support.BWS-package, bws.dataset

Examples

## See examples in bws.dataset()

support.BWS documentation built on March 31, 2023, 8:12 p.m.