Description Usage Arguments Value See Also Examples

This function generates graphs of the mean simulated vs. observed values at each time point of the time-varying covariates, risk, and survival under the natural course. For categorical covariates, the observed and simulated counts of the levels of the factors are plotted at each time point.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |

`x` |
Object of class "gformula_survival". |

`covnames` |
Vector of character strings specifying the names of the time-varying covariates to be plotted. The ordering of covariates given here is used in the plot grid. Time-varying covariates of type |

`risk` |
Logical scalar indicating whether to include a plot for the risk. The default is |

`survival` |
Logical scalar indicating whether to include a plot for the survival. The default is |

`ncol` |
Number of columns in the plot grid. By default, two columns are used when there is at least two plots. |

`nrow` |
Number of rows in the plot grid. By default, a maximum of six rows is used and additional plots are included in subsequent pages. |

`common.legend` |
Logical scalar indicating whether to include a legend. The default is |

`legend` |
Character string specifying the legend position. Valid values are |

`xlab` |
Character string for the x axes of all plots. By default, this argument is set to the |

`ylab_cov` |
Vector of character strings for the y axes of the plots for the covariates. This argument must be the same length as |

`ylab_risk` |
Character string for the y axis of the plot for the risk (if applicable). The default is |

`ylab_surv` |
Character string for the y axis of the plot for the survival (if applicable). The default is |

`pos_risk` |
Integer specifying the position at which to order the risk plot (if applicable). By default, this argument is set to the number of plots in the grid minus one (i.e., orders the risk plot second last). |

`pos_surv` |
Integer specifying the position at which to order the survival plot (if applicable). By default, this argument is set to the number of plots in the grid (i.e., orders the survival plot last). |

`ci_risk` |
Logical scalar specifying whether to include error bars for the 95% confidence intervals of the estimated risk under the natural course. This argument is only effective if the argument |

`...` |
Other arguments, which are passed to |

An object of class "ggarrange". See documentation of `ggarrange`

.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | ```
## Estimating the effect of static treatment strategies on risk of a
## failure event
id <- 'id'
time_points <- 7
time_name <- 't0'
covnames <- c('L1', 'L2', 'A')
outcome_name <- 'Y'
covtypes <- c('binary', 'bounded normal', 'binary')
histories <- c(lagged, lagavg)
histvars <- list(c('A', 'L1', 'L2'), c('L1', 'L2'))
covparams <- list(covmodels = c(L1 ~ lag1_A + lag_cumavg1_L1 + lag_cumavg1_L2 +
L3 + t0,
L2 ~ lag1_A + L1 + lag_cumavg1_L1 +
lag_cumavg1_L2 + L3 + t0,
A ~ lag1_A + L1 + L2 + lag_cumavg1_L1 +
lag_cumavg1_L2 + L3 + t0))
ymodel <- Y ~ A + L1 + L2 + L3 + lag1_A + lag1_L1 + lag1_L2 + t0
intvars <- list('A', 'A')
interventions <- list(list(c(static, rep(0, time_points))),
list(c(static, rep(1, time_points))))
int_descript <- c('Never treat', 'Always treat')
nsimul <- 10000
gform_basic <- gformula_survival(obs_data = basicdata_nocomp, id = id,
time_points = time_points,
time_name = time_name, covnames = covnames,
outcome_name = outcome_name,
covtypes = covtypes,
covparams = covparams, ymodel = ymodel,
intvars = intvars,
interventions = interventions,
int_descript = int_descript,
histories = histories, histvars = histvars,
basecovs = c('L3'), nsimul = nsimul,
seed = 1234)
plot(gform_basic)
``` |

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.