Fits a logistic regression assuming a linear effect of time on the log-odds of the outcome and plots fitted and observed proportions over time. Observed values are shown with Wilson 95% confidence intervals (without Yates continuity correction), and fitted values with model-based pointwise 95% confidence intervals.
Usage
ggproptrend(
y,
t,
col.fitted = "#C40233",
col.obs = "#0087BD",
legend.pos = "bottom",
x.labels,
x.title = "Time",
y.breaks,
y.title = "Proportion"
)Arguments
- y
Binary outcome vector.
- t
Numeric vector representing time.
- col.fitted
Color for the fitted curve and its confidence limits. Default =
"#C40233".- col.obs
Color for observed proportions and their confidence intervals. Default =
"#0087BD".- legend.pos
Legend position. Default =
"bottom".- x.labels
Labels for the x-axis ticks.
- x.title
Title for the x-axis. Default =
"Time".- y.breaks
Numeric vector specifying y-axis tick locations.
- y.title
Title for the y-axis. Default =
"Proportion".
Value
A ggplot2::ggplot object displaying fitted and observed proportions
over time, with pointwise 95% confidence intervals.