PsychModels: Fit Multiple Psychometric Functions with Generalized Linear...

View source: R/psych_utils_multi.R

PsychModelsR Documentation

Fit Multiple Psychometric Functions with Generalized Linear Models (GLM)

Description

The function fits psychometric functions to data using glm for multiple groups. It supports the use of a binomial error distribution.

Usage

PsychModels(data, group_factors = NULL, formula, link = "probit")

Arguments

data

a data frame containing the variables to be used in the model.

group_factors

a character vector specifying the grouping variables in the dataset. If NULL, the model will be fit to the entire dataset without grouping.

formula

the formula of the glm model. The response should consist of a binomial outcome (e.g., cbind(yes, no)).

link

the link function. A character string specifying the link function to be used. By default, "probit" is used. See glm for available link functions.

Details

This function allows the fitting of psychometric functions to grouped data. If grouping variables are provided through group_factors, separate models are fit to each group. The function returns a list of models, one for each group, where the model for each group is fitted using the specified formula and link.

The models are returned as a named list, with each list element containing the fitted GLM model and the associated group-level information.

See Also

glm, PsychParameters

Examples

model_list <- PsychModels(formula = cbind(Longer, Total - Longer) ~ X,
data = simul_data,
group_factors = "Subject")

model_list_vibro <- PsychModels(vibro_exp3,
group_factors = c("subject", "vibration"),
formula = cbind(faster, slower) ~ speed)


moskante/MixedPsy documentation built on Feb. 19, 2025, 12:15 a.m.