make_NIW_belief_from_data: Make NIW belief from data.

View source: R/make-objects.R

make_NIW_belief_from_dataR Documentation

Make NIW belief from data.

Description

Constructs an NIW_belief or NIW_ideal_adaptor object, representing Normal-Inverse Wishart (NIW) parameters for all categories found in the data. This object can be used as a prior for functions like update_NIW_beliefs_incrementally.

Usage

make_NIW_belief_from_data(
  data,
  group = NULL,
  category = "category",
  cues,
  kappa = nu,
  nu = length(cues) + 2,
  verbose = F
)

make_NIW_prior_from_data(
  data,
  group = NULL,
  category = "category",
  cues,
  kappa = nu,
  nu = length(cues) + 2,
  verbose = F
)

make_NIW_ideal_adaptor_from_data(
  data,
  group = NULL,
  category = "category",
  cues,
  kappa = nu,
  nu = length(cues) + 2,
  ...,
  verbose = F
)

Arguments

data

The tibble or data.frame from which to construct the prior.

group

Optionally, one or more grouping variables can be specified. If group is not NULL, one NIW_belief or ideal adaptor will be derived for each level of group. (default: NULL)

category

Name of variable in data that contains the category information. (default: "category")

cues

Name(s) of variables in data that contain the cue information.

kappa

The strength of the beliefs over the category mean (pseudocounts). (default: same as nu)

nu

The strength of the beliefs over the category covariance matrix (pseudocounts). (default: number of cues + 2)

verbose

If true provides more information. (default: FALSE)

prior

Optionally specify a prior probability for each category (in each group). (default: a uniform prior over all categories).

lapse_rate

Optionally specify a lapse rate. (default: NA)

lapse_bias

Optionally specify a lapse bias. (default: NA)

Sigma_noise

Optionally specify a (multivariate Gaussian) covariance matrix of perceptual noise. This argument will be ignored if NULL. (default: NULL)

Details

Currently, make_NIW_prior_from_data() does not infer kappa or nu, nor does it fit hierarchical data. Rather the function simply estimates the category mean and covariance matrix from the sample (data), assumes them to be the expected category mean (mu) and covariance (Sigma), and derives the m and S parameters of the NIW from mu and Sigma based on the user-provided kappa and nu. That means m = mu and S = Sigma * (nu - D -1), where D is the dimensionality of the data.

Value

A tibble that is an NIW_belief or NIW_ideal_adaptor object.

See Also

TBD


hlplab/MVBeliefUpdatr documentation built on March 29, 2025, 10:42 p.m.