Step3: Estimating the transition model (with or without covariates)

step3R Documentation

Estimating the transition model (with or without covariates)

Description

step3 conducts step 3 from the three-step estimation of LMFA and thus the estimation of the transition model. To this end, the function uses the classification information from the step2 output. Makes use of msm from the msm package.

Usage

step3(
  data,
  identifier,
  n_state,
  postprobs,
  timeintervals = NULL,
  initialCovariates = NULL,
  transitionCovariates = NULL,
  n_starts = 25,
  n_initial_ite = 10,
  method = "BFGS",
  max_iterations = 10000,
  tolerance = 1e-10,
  scaling = "proxi"
)

Arguments

data

The dataset (must be a dataframe).

identifier

The name of the column containing the subject identifiers (must be a single character).

n_state

The number of states that should be estimated (must be a single scalar).

postprobs

The posterior state-membership probabilities (must be a dataframe with n_state columns and of same length as the data).

timeintervals

The name of the column containing the intervals (must be a single character).

initialCovariates

The covariate(s) for the initial state probabilities (must be a (vector of) character(s)).

transitionCovariates

The covariate(s) for the transition intensities (must be a (vector of) character(s)).

n_starts

The number of start values for the transition intensity parameters that should be used (must be a single scalar).

n_initial_ite

The number of initial iterations for the different start sets that should be used (must be a single scalar).

method

The type of optimization method that should be used (must be "BFGS" or "CG")

max_iterations

The maximum number of iterations that should be used (must be a single scalar and larger than n_initial_ite).

tolerance

The tolerance to evaluate convergence that should be used (must be a single scalar).

scaling

An overall scaling to be applied to the value of fn (a function to be minimized) and gr (a function to return the gradient for the "BFGS" and "CG" methods) during optimization (see optim() documentation for details). In this package it has to be a positive integer.

Value

Returns the transition model parameters.

Examples

## Not run: 
step3_results <- step3(data,
                      identifier,
                      n_state,
                      postprobs,
                      timeintervals = NULL,
                      initialCovariates = NULL,
                      transitionCovariates = NULL,
                      n_starts = 25,
                      n_initial_ite = 10,
                      method = "BFGS",
                      max_iterations = 10000,
                      tolerance = 1e-10,
                      scaling = "proxi"
                      )

## End(Not run)

LeonieVm/lmfa documentation built on Dec. 5, 2023, 1:38 p.m.