heuristics: Generating heuristics for the use in STUART subtest...

View source: R/heuristics.R

heuristicsR Documentation

Generating heuristics for the use in STUART subtest construction

Description

Creates uninformative heuristic matrices for the use in mmas.

Usage

heuristics(
  data,
  factor.structure,
  capacity = NULL,
  repeated.measures = NULL,
  mtmm = NULL,
  grouping = NULL,
  localization = "nodes",
  ...
)

Arguments

data

A data.frame containing all relevant data.

factor.structure

A list linking factors to items. The names of the list elements correspond to the factor names. Each list element must contain a character-vector of item names that are indicators of this factor.

capacity

A list containing the number of items per subtest. This must be in the same order as the factor.structure provided. If a single number, it is applied to all subtests. If NULL all items are evenly distributed among the subtests.

repeated.measures

A list linking factors that are repeated measures of each other. Repeated factors must be in one element of the list - other sets of factors in other elements of the list. When this is NULL (the default) a cross-sectional model is estimated.

mtmm

A list linking factors that are measurements of the same construct with different methods. Measurements of the same construct must be in one element of the list - other sets of methods in other elements of the list. When this is NULL (the default) a single method model is estimated.

grouping

The name of the grouping variable. The grouping variable must be part of data provided and must be a numeric variable.

localization

Which parameterization to use when depositing pheromones. Can be either 'nodes' (the default) for depositing pheromones on selected nodes or 'arcs' for depositing on selection arcs.

...

Other arguments normally provided to mmas, which will be ignored.

Details

This function generates a list of matrices which can be used as heuristics for all STUART constructions. This is mainly intended to write the structure of the heuristic matrices to an object, change components in line with theoretically derived heuristics and feed them back into mmas via the heuristics argument. The generated heuristics will contain only 1s and 0s, making it no heuristic information. Selection probabilities can be altered by manipulating the contents of the object created by heuristics. Setting a value to 0 will result in prohibiting a certain choice to be made. Please note, that it will lead to unpredictable behavior if the diagonal elements of the matrices produced in the arcs parameterization are set to values other than 0.

Value

Returns a list of the same length as the factor.structure argument provided.

Author(s)

Martin Schultze

See Also

mmas

Examples


# heuristics for node localization
data(fairplayer)
fs <- list(si = names(fairplayer)[83:92])

(heu <- heuristics(fairplayer, fs, 4))

# Define anchor-item
heu$si[1] <- 10000
heu

# heuristics for arc localization
data(fairplayer)
fs <- list(si = names(fairplayer)[83:92])

(heu <- heuristics(fairplayer, fs, 4, localization = 'arcs'))

# Define equal selection of odd and even items
heu$si[1:10,] <- c(rep(c(0, 1), 5), rep(c(1, 0), 5))
heu


stuart documentation built on June 7, 2023, 6:12 p.m.