@bdelab/jscat - v5.3.2
    Preparing search index...

    Class Clowder

    The Clowder class is responsible for managing a collection of Cat instances along with a corpus of stimuli. It maintains a list of named Cat instances and a corpus where each item in the coprpus may have IRT parameters corresponding to each named Cat. Clowder provides methods for updating the ability estimates of each of its Cats, and selecting the next item to present to the participant.

    Index

    Constructors

    • Create a Clowder object.

      Parameters

      • input: ClowderInput

        An object containing arrays of Cat configurations and corpora.

        • cats: CatMap<CatInput>

          An object containing Cat configurations for each Cat instance. Keys correspond to Cat names, while values correspond to Cat configurations.

        • corpus: MultiZetaStimulus[]

          An object containing arrays of stimuli for each corpus.

        • OptionalearlyStopping?: EarlyStopping

          An optional EarlyStopping instance to use for early stopping.

        • OptionalrandomSeed?: string | null

          A random seed for reproducibility. If not provided, a random seed will be generated.

      Returns Clowder

      • Throws an error if any item in the corpus has duplicated IRT parameters for any Cat name.

    Accessors

    • get cats(): Omit<CatMap<Cat>, "unvalidated">

      The named Cat instances that this Clowder manages.

      Returns Omit<CatMap<Cat>, "unvalidated">

    • get nItems(): { [key: string]: number; [key: number]: number }

      The number of items presented to each Cat instance.

      Returns { [key: string]: number; [key: number]: number }

    • get resps(): { [key: string]: (0 | 1)[]; [key: number]: (0 | 1)[] }

      The responses received by each Cat instance.

      Returns { [key: string]: (0 | 1)[]; [key: number]: (0 | 1)[] }

    • get seMeasurement(): { [key: string]: number; [key: number]: number }

      The standard error of measurement estimates for each Cat instance.

      Returns { [key: string]: number; [key: number]: number }

    • get stoppingReason(): string | null

      The stopping reason in the Clowder configuration.

      Returns string | null

    • get theta(): { [key: string]: number; [key: number]: number }

      The theta estimates for each Cat instance.

      Returns { [key: string]: number; [key: number]: number }

    • get zetas(): { [key: string]: Zeta[]; [key: number]: Zeta[] }

      The zeta (item parameters) received by each Cat instance.

      Returns { [key: string]: Zeta[]; [key: number]: Zeta[] }

    Methods

    • Updates the ability estimates for the specified Cat instances.

      Parameters

      • catNames: string[]

        The names of the Cat instances to update.

      • zeta: Zeta | Zeta[]

        The item parameter(s) (zeta) for the given stimuli.

      • answer: 0 | 1 | (0 | 1)[]

        The corresponding answer(s) (0 or 1) for the given stimuli.

      • Optionalmethod: string

        Optional method for updating ability estimates. If none is provided, it will use the default method for each Cat instance.

      Returns void

      If any catName is not found among the existing Cat instances.

    • Update the ability estimates for the specified catsToUpdate and select the next stimulus for the catToSelect. This function processes previous items and answers, updates internal state, and selects the next stimulus based on the remaining stimuli and corpusToSelect.

      Parameters

      • input: {
            additionalItemsToRemove?: MultiZetaStimulus[];
            answers?: 0 | 1 | (0 | 1)[];
            catsToUpdate?: string | string[];
            catToEvaluateEarlyStopping?: string;
            catToSelect: string;
            corpusToSelectFrom?: string;
            items?: MultiZetaStimulus | MultiZetaStimulus[];
            itemSelect?: string;
            method?: string;
            randomlySelectUnvalidated?: boolean;
            returnUndefinedOnExhaustion?: boolean;
        }

        The parameters for updating the Cat instance and selecting the next stimulus.

        • OptionaladditionalItemsToRemove?: MultiZetaStimulus[]

          Optional additional items to remove from the remainingItems.

        • Optionalanswers?: 0 | 1 | (0 | 1)[]

          An array of answers (0 or 1) corresponding to items.

        • OptionalcatsToUpdate?: string | string[]

          A single Cat or array of Cats for which to update ability estimates.

        • OptionalcatToEvaluateEarlyStopping?: string
        • catToSelect: string

          The Cat instance to use for selecting the next stimulus.

        • OptionalcorpusToSelectFrom?: string

          The corpus to use for selecting the next stimulus. If not provided, catToSelect will be used.

        • Optionalitems?: MultiZetaStimulus | MultiZetaStimulus[]

          An array of previously presented stimuli.

        • OptionalitemSelect?: string

          Optional item selection method (if applicable).

        • Optionalmethod?: string

          Optional method for updating ability estimates (if applicable).

        • OptionalrandomlySelectUnvalidated?: boolean

          Optional flag indicating whether to randomly select an unvalidated item for catToSelect.

        • OptionalreturnUndefinedOnExhaustion?: boolean

          Optional flag indicating whether to return undefined when no validated items are available.

      Returns Stimulus | undefined

      • The next stimulus to present, or undefined if no further validated stimuli are available.

      If items and answers lengths do not match.

      If any items are not found in the Clowder's corpora (validated or unvalidated).

      The function operates in several steps:

      1. Validate: a. Validates the catToSelect and catsToUpdate. b. Ensures items and answers arrays are properly formatted.
      2. Update: a. Updates the internal list of seen items. b. Updates the ability estimates for the catsToUpdate. c. Removes the provided items from the remainingItems.
      3. Select: a. Selects the next item using catToSelect, considering only remaining items that are valid for that cat. b. If desired, randomly selects an unvalidated item for catToSelect.