TEfitAll: Fit several time-evolving regression models

View source: R/TEfitAll.R

TEfitAllR Documentation

Fit several time-evolving regression models

Description

A wrapper for fitting a TEfit model to the data for every unique value of groupingVar. Defaults to returning a list including two summaries and all models; returning only a summary is also an option. Most arguments (except, e.g., groupingVar, a grouping vector) are identical to, and are passed directly to, TEfit.

Usage

TEfitAll(
  varIn,
  groupingVar,
  groupingVarName = "grouping_var",
  returnAll = T,
  progressDot = T,
  linkFun = list(link = "identity"),
  errFun = "ols",
  changeFun = "expo",
  bootPars = tef_bootList(),
  blockTimeVar = NULL,
  covarTerms = list(),
  control = tef_control()
)

Arguments

varIn

Data frame or vector. First column [or vector] must be the time-dependent response variable (left hand side of regression). If available, second column must be the time variable. All other columns are covariates, possibly involved in a link function.

groupingVar

Variable (e.g., participant ID) with which to separate TEfit models. Length must be nrows(varIn)

groupingVarName

Name of grouping variable

returnAll

Logical. Return only a summary (when T), or that summary plus every model, in a list (when F)

progressDot

If TRUE, prints a dot after each group fit

linkFun

A list defining a link function (i.e., 'identity', 'd_prime', 'weibull', or 'logistic')

errFun

A string defining an error function (e.g., 'ols', 'logcosh', 'bernoulli').

changeFun

A string defining the functional form of change (e.g., 'expo', 'power', 'weibull')

bootPars

A list defining the details for bootstrapped fits. Defaults to no bootstrapping. Necessary for estimates of uncertainty around fits and for covariance between parameters.

blockTimeVar

A string identifying which covariate is the time points of sub-scales (e.g., "blocks" of times within the overall timescale of data collection)

covarTerms

An optional list of logical vectors indicating whether parameters should vary by covariates. See examples.

control

A list of model parameters. Use of tef_control() is highly recommended.

See Also

TEfit for fitting a single model; tef_fitAll2brms to re-fit the TEfitAll output using brms-package

Examples

## Not run: 
m <- TEfitAll(anstrain[,c('acc','trialNum')],groupingVar = anstrain$subID,groupingVarName = 'subID',bootPars = tef_bootList(resamples = 20))
summary(m)

## End(Not run)


akcochrane/TEfits documentation built on June 12, 2025, 11:10 a.m.