check.data {fechner}R Documentation

Check for Required Data Format

Description

check.data is used to check whether the data are of required format.

Usage

check.data(X, format = c("probability.different", "percent.same",
                         "general"))

Arguments

X a required square matrix or data frame of numeric data. No NA, NaN, Inf, or -Inf values are allowed.
format an optional character string giving the data format to be checked. This must be one of "probability.different", "percent.same", or "general", with default "probability.different", and may be abbreviated to a unique prefix.

Details

The data must be a matrix or data frame, have the same number of rows and columns, and be numeric consisting of real numbers. In particular, no infinite, undefined, or missing values are allowed. This is the general data format. The probability-different and percent-same formats, in addition, require that the data lie in the intervals [0, 1] and [0, 100], respectively. If all of the requirements for a data format are satisfied, the data are returned as a matrix with rows and columns labeled; otherwise the function stops with respective error messages.

The labeling is as follows.

  1. The data are presented without any labeling of the rows and columns: The function does the labeling automatically, as a1, b1, ..., z1, a2, b2, ..., z2, ..., etc., up to a9, b9, ..., z9 if the data are as large as 234x234, or if the data are larger than 234x234, the labeling is v1, v2, ..., vN, where NxN is the dimension of the data (and N > 234).
  2. The data are presented with either row or column labeling: In that case, the row or column labels are assigned to the columns or rows, respectively.
  3. The data are presented with row and column labeling: Since the labeling of both the rows and columns is now provided by the user manually, the same labeling must be used. If that is the case, the initial labeling is adopted. Otherwise the function stops with an error message.

Value

If the data are of required format, check.data returns a matrix of the data with rows and columns labeled.

Author(s)

Thomas Kiefer thomas.kiefer@student.uni-augsburg.de, Ali Uenlue ali.uenlue@math.uni-augsburg.de. Based on original MATLAB source by Ehtibar N. Dzhafarov.

References

Dzhafarov, E. N. and Colonius, H. (2006) Reconstructing distances among objects from their discriminability. Psychometrika, 71, 365–386.

Dzhafarov, E. N. and Colonius, H. (2007) Dissimilarity cumulation theory and subjective metrics. Journal of Mathematical Psychology, 51, 290–304.

Kiefer, T. and Uenlue, A. and Dzhafarov, E. N. (2009) Fechnerian scaling in R: The package fechner. Manuscript submitted for publication. http://www.math.uni-augsburg.de/~uenlueal/

See Also

check.regular for checking regular minimality/maximality; fechner, the main function for Fechnerian scaling. See also fechner-package for general information about this package.

Examples

## dataset wish is of probability-different format
check.data(wish)

## dataset morse is of percent-same format
check.data(morse, format = "percent.same")

## a matrix without any labeling of rows and columns, of general format
## check.data does the labeling automatically
(X <- ((-1) * matrix(1:16, nrow = 4)))
check.data(X, format = "general")

## Not run: 
## examples of data that are not of any of the three formats

## error message: data must be matrix or data frame
check.data(as.character(matrix(1:16, nrow = 4)))

## error message: data must have same number of rows and columns
check.data(matrix(1:12, nrow = 4))

## error message: data must be numbers
check.data(matrix(LETTERS[1:16], nrow = 4))
## End(Not run)

[Package fechner version 1.0-0 Index]