% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/type_lm.R
\name{type_lm}
\alias{type_lm}
\title{Linear model plot type}
\usage{
type_lm(se = TRUE, level = 0.95, weights = NULL)
}
\arguments{
\item{se}{logical. If TRUE, confidence intervals are drawn.}

\item{level}{the confidence level required.}

\item{weights}{an optional numeric vector of observation weights for the model
fit, of the same length as the number of data points. Weights can also be
supplied via the top-level \code{weights} argument of \code{\link{tinyplot}} (which is
evaluated with non-standard evaluation in the formula method, and takes
precedence if both are given).}
}
\description{
Type function for plotting a linear model fit.
Arguments are passed to \code{\link[stats]{lm}}.
}
\examples{
# "lm" type convenience string
tinyplot(Sepal.Width ~ Petal.Width, data = iris, type = "lm")

# Grouped model fits (here: illustrating an example of Simpson's paradox)
tinyplot(Sepal.Width ~ Petal.Width | Species, data = iris, type = "lm")
tinyplot_add(type = "p")

# Use `type_lm()` to pass extra arguments for customization
tinyplot(Sepal.Width ~ Petal.Width, data = iris, type = type_lm(level = 0.8))

# Weighted fit example, either as a top-level argument (which supports
# non-standard evaluation in the formula method)...
s77 = as.data.frame(state.x77)
tinyplot(`Life Exp` ~ Income, data = s77, type = "lm", weights = Population)
# ...or directly via the type constructor (requires an evaluated vector)
tinyplot(`Life Exp` ~ Income, data = s77, type = type_lm(
  weights = s77$Population))
}
