stRoke/man/ci_plot.Rd

55 lines
1.3 KiB
Plaintext
Raw Normal View History

2022-10-11 08:25:39 +02:00
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ci_plot.R
\name{ci_plot}
\alias{ci_plot}
\title{Confidence interval plot with point estimate}
\usage{
2023-01-12 13:44:29 +01:00
ci_plot(
ds,
x = NULL,
y = NULL,
vars = NULL,
dec = 3,
lbls = NULL,
title = NULL,
method = "auto"
)
2022-10-11 08:25:39 +02:00
}
\arguments{
2023-01-12 13:44:29 +01:00
\item{ds}{main input, either data set or logistic model}
2022-10-11 08:25:39 +02:00
\item{x}{text string of main exposure variable}
\item{y}{text string of outcome variable}
\item{vars}{variables for multivariate analysis.}
\item{dec}{Decimals in labels}
\item{lbls}{Labels for variable names}
\item{title}{Plot title. Can be specified later.}
2023-01-12 13:44:29 +01:00
\item{method}{Character vector. The method for the regression.
Can be c("auto", "model").}
2022-10-11 08:25:39 +02:00
}
\value{
ggplot element
}
\description{
2023-01-11 12:54:08 +01:00
Horizontal forest plot of point estimate with confidence intervals.
Includes dichotomous or olr, depending on number of levels in "x".
2022-10-11 08:25:39 +02:00
Title and axis labels can be added to the ggplot afterwards.
}
\examples{
2023-01-12 13:44:29 +01:00
# Auto plot
2022-10-11 08:25:39 +02:00
data(talos)
talos[,"mrs_1"]<-factor(talos[,"mrs_1"],ordered=TRUE)
2023-01-12 13:44:29 +01:00
ci_plot(ds = talos, x = "rtreat", y = "mrs_1",
vars = c("hypertension","diabetes"))
2023-04-13 07:57:37 +02:00
## Model plot
# iris$ord<-factor(sample(1:3,size=nrow(iris),replace=TRUE),ordered=TRUE)
# lm <- MASS::polr(ord~., data=iris, Hess=TRUE, method="logistic")
# ci_plot(ds = lm, method="model")
2022-10-11 08:25:39 +02:00
}