Description Usage Arguments Examples
View source: R/07-radial-plot-function.r
This function produces a modified Galbraith's radial plot showing the treatment effect size of subgroups defined by the categories of covariates. The x-axis represents the reciprocal of the standard error of the difference between the subgroup treatment effect estimates and the overall treatment effect estimate. The y-axis is the standardized effect size difference (the difference between subgroup effect the full popultion effect is divided by its standard error). Points here are for subgroups. The grey region indicates whether subgroup effects are homogeneous to the full population effect or not. The two arcs on the right side show subgroup treatment effects in the original scale, where the red spots are the projection of points from the origin on the left side. Note that the vertical range of display can be changed by setting different values on the associated input argument. In addition, the function uses log odd ratio and log hazard ratio for displaying subgroup effect sizes in binary and survival data, respectively.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
dat |
a data set |
covari.sel |
a vector of indices of the two covariates |
trt.sel |
a covariate index specifying the treatment code |
resp.sel |
a covariate index specifying the response variable |
outcome.type |
a string specifying the type of the response variable, it can be "continuous", or "binary" or "survival". |
range.v |
a vector specifying the vertical range of graphical display. |
adj.ann.subgrp |
a parameter adjusting the distance between a point and its corresponding subgroup label. The smaller the value is, the larger the distance is. |
font.size |
a vector specifying the size of labels and text; the first element is for the main title, the second is for for x-axis and y-axis labels; the thrid is for the legend text of subgroups; the fourth is for the subgroup labels near points; the fifth is for the unit labels on all the axes. |
title |
a string specifying the main title. |
lab.xy |
a list of two strings specifying the labels of the x and y axes. |
plot.full |
a logical indicating whether to show the overall treatment effect |
legend.position |
where to place the legend? either "inside" or "outside" |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | library(dplyr)
# Load the data to be used
data(prca)
dat <- prca
dat %>%
mutate(bm = factor(ifelse(bm == 0 , "No", "Yes")),
hx = factor(ifelse(hx == 0 , "No", "Yes")))-> dat
lab.x = expression(1/sqrt(hat(Var)(hat(delta)[i]-hat(delta)[F])))
lab.y = expression((hat(delta)[i]-hat(delta)[F])/sqrt(hat(Var)(hat(delta)[i]-hat(delta)[F])))
lab.xy = label.xy = list(lab.x, lab.y)
plot_radial2(dat,
covari.sel = c(4, 5, 6, 7),
trt.sel = 3,
resp.sel = c(1, 2),
outcome.type = "survival",
range.v = c(-11, 8),
adj.ann.subgrp = 4,
font.size = c(1, 1, .6, .6, .6),
lab.xy = label.xy)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.