stRoke/man/plot_olr.Rd

48 lines
1.2 KiB
Plaintext
Raw Normal View History

2022-09-22 19:53:15 +02:00
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot_olr.R
2022-09-23 12:05:32 +02:00
\name{plot_olr}
\alias{plot_olr}
2022-09-26 13:59:05 +02:00
\title{Forest plot from ordinal logistic regression.}
2022-09-22 19:53:15 +02:00
\usage{
2022-09-23 12:05:32 +02:00
plot_olr(
2022-09-22 19:53:15 +02:00
x,
title = NULL,
dec = 3,
lbls = NULL,
hori = "OR (95 \% CI)",
vert = "Variables",
short = FALSE,
input = c("model", "df")
)
}
\arguments{
\item{x}{input data.}
\item{title}{plot title}
\item{dec}{decimals for labels}
2022-09-26 13:59:05 +02:00
\item{lbls}{labels for variable names. Careful, as the right order is not checked automatically!}
2022-09-22 19:53:15 +02:00
\item{hori}{labels the horizontal axis (this i the y axis as the plot is rotated)}
\item{vert}{labels the horizontal axis (this i the x axis as the plot is rotated)}
\item{short}{flag to half number of ticks on horizontal axis.}
2022-09-26 13:59:05 +02:00
\item{input}{can be either "model", which is a olr model (polr()), or "df", which is a data frame with three columns for OR, lower CI and upper CI.}
2022-09-22 19:53:15 +02:00
}
\value{
gg object
}
\description{
Heavily inspired by https://www.r-bloggers.com/plotting-odds-ratios-aka-a-forrestplot-with-ggplot2/
}
2022-09-23 12:05:32 +02:00
\examples{
iris$ord<-factor(sample(1:3,size=nrow(iris),replace=TRUE),ordered=TRUE)
lm <- MASS::polr(ord~., data=iris, Hess=TRUE, method="logistic")
plot_olr(lm, input="model")
}
2022-09-23 09:14:47 +02:00
\keyword{forest}
\keyword{plot}