Skip to contents

This function preprocesses data for use in Bayesian Aldrich-McKelvey (BAM) scaling. It handles missing values, centers the data, and separates the self-placement from the stimuli placements.

Usage

bamPrep(x, nmin = 1, missing = NULL, self = 1, midpt = NULL)

Arguments

x

A numeric matrix or dataframe containing the data to be preprocessed.

nmin

Integer, the minimum number of non-missing values required per row (default is 1).

missing

A vector of values that should be treated as missing (e.g., c(77, 88, 99)).

self

Integer, the column number representing self-placement (default is 1).

midpt

Numeric, the midpoint used for centering the data. If NULL, the midpoint is calculated as the mean of the minimum and maximum values.

Value

A list with two components: stims (a matrix of stimuli placements) and self (a vector of self-placements).

Examples

if (FALSE) { # \dontrun{
# Aldrich-Mckelvey scaling, with cutoff of 5 or more
data(franceEES2009)
bamdata <- bamPrep(franceEES2009, missing=c(77,88,89), self=1)
} # }