estSeqMarkovOrd | R Documentation |

Simulate Comparisons For Use in Sequential Markov Longitudinal Clinical Trial Simulations

```
estSeqMarkovOrd(
y,
times,
initial,
absorb = NULL,
intercepts,
parameter,
looks,
g,
formula,
ppo = NULL,
yprevfactor = TRUE,
groupContrast = NULL,
cscov = FALSE,
timecriterion = NULL,
coxzph = FALSE,
sstat = NULL,
rdsample = NULL,
maxest = NULL,
maxvest = NULL,
nsim = 1,
progress = FALSE,
pfile = ""
)
```

`y` |
vector of possible y values in order (numeric, character, factor) |

`times` |
vector of measurement times |

`initial` |
a vector of probabilities summing to 1.0 that specifies the frequency distribution of initial values to be sampled from. The vector must have names that correspond to values of |

`absorb` |
vector of absorbing states, a subset of |

`intercepts` |
vector of intercepts in the proportional odds model. There must be one fewer of these than the length of |

`parameter` |
vector of true parameter (effects; group differences) values. These are group 2:1 log odds ratios in the transition model, conditioning on the previous |

`looks` |
integer vector of ID numbers at which maximum likelihood estimates and their estimated variances are computed. For a single look specify a scalar value for |

`g` |
a user-specified function of three or more arguments which in order are |

`formula` |
a formula object given to the |

`ppo` |
a formula specifying the part of |

`yprevfactor` |
see |

`groupContrast` |
omit this argument if |

`cscov` |
applies if |

`timecriterion` |
a function of a time-ordered vector of simulated ordinal responses |

`coxzph` |
set to |

`sstat` |
set to a function of the time vector and the corresponding vector of ordinal responses for a single group if you want to compute a Wilcoxon test on a derived quantity such as the number of days in a given state. |

`rdsample` |
an optional function to do response-dependent sampling. It is a function of these arguments, which are vectors that stop at any absorbing state: |

`maxest` |
maximum acceptable absolute value of the contrast estimate, ignored if |

`maxvest` |
like |

`nsim` |
number of simulations (default is 1) |

`progress` |
set to |

`pfile` |
file to which to write progress information. Defaults to |

Simulates sequential clinical trials of longitudinal ordinal outcomes using a first-order Markov model. Looks are done sequentially after subject ID numbers given in the vector `looks`

with the earliest possible look being after subject 2. At each look, a subject's repeated records are either all used or all ignored depending on the sequent ID number. For each true effect parameter value, simulation, and at each look, runs a function to compute the estimate of the parameter of interest along with its variance. For each simulation, data are first simulated for the last look, and these data are sequentially revealed for earlier looks. The user provides a function `g`

that has extra arguments specifying the true effect of `parameter`

the treatment `group`

expecting treatments to be coded 1 and 2. `parameter`

is usually on the scale of a regression coefficient, e.g., a log odds ratio. Fitting is done using the `rms::lrm()`

function, unless non-proportional odds is allowed in which case `VGAM::vglm()`

is used. If `timecriterion`

is specified, the function also, for the last data look only, computes the first time at which the criterion is satisfied for the subject or use the event time and event/censoring indicator computed by `timecriterion`

. The Cox/logrank chi-square statistic for comparing groups on the derived time variable is saved. If `coxzph=TRUE`

, the `survival`

package correlation coefficient `rho`

from the scaled partial residuals is also saved so that the user can later determine to what extent the Markov model resulted in the proportional hazards assumption being violated when analyzing on the time scale. `vglm`

is accelerated by saving the first successful fit for the largest sample size and using its coefficients as starting value for further `vglm`

fits for any sample size for the same setting of `parameter`

.

a data frame with number of rows equal to the product of `nsim`

, the length of `looks`

, and the length of `parameter`

, with variables `sim`

, `parameter`

, `look`

, `est`

(log odds ratio for group), and `vest`

(the variance of the latter). If `timecriterion`

is specified the data frame also contains `loghr`

(Cox log hazard ratio for group), `lrchisq`

(chi-square from Cox test for group), and if `coxph=TRUE`

, `phchisq`

, the chi-square for testing proportional hazards. The attribute `etimefreq`

is also present if `timecriterion`

is present, and it probvides the frequency distribution of derived event times by group and censoring/event indicator. If `sstat`

is given, the attribute `sstat`

is also present, and it contains an array with dimensions corresponding to simulations, parameter values within simulations, `id`

, and a two-column subarray with columns `group`

and `y`

, the latter being the summary measure computed by the `sstat`

function. The returned data frame also has attribute `lrmcoef`

which are the last-look logistic regression coefficient estimates over the `nsim`

simulations and the parameter settings, and an attribute `failures`

which is a data frame containing the variables `reason`

and `frequency`

cataloging the reasons for unsuccessful model fits.

Frank Harrell

`gbayesSeqSim()`

, `simMarkovOrd()`

, https://hbiostat.org/R/Hmisc/markov/

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.