mfs_scatter_from_models: A Lined Scatterplot Function

Description Usage Arguments Examples

Description

This function uses ggplot2 to create a multi-scatterplot with a line of best fit and a loess smoother overlaid, based on two existing linear models. It is often discouraged in strong terms to do this, so this library requires that the x axes in both models are identical before proceeding. With identical x axes, I don't see the problem in viewing two dependent variables together.

Usage

1
2
mfs_scatter_from_models(model1, model2, xlab = "", y1lab = "", y2lab = "",
  title = "", color_scheme_1 = "bluish", color_scheme_2 = "reddish")

Arguments

model1

A generalized linear model, returned from glm()

model2

A generalized linear model, returned from glm()

xlab

Optionally, provide a label for the x axis

y1lab

Optionally, provide a label for the first y axis

y2lab

Optionally, provide a label for the second y axis

title

Optionally, provide a title to override the default

scheme1

override the default "bluish" colors for plotting model1

scheme2

override the default "reddish" colors for plotting model2

Examples

1
2
3
mfs_scatter_from_models(glm(y~x,data=d), glm(z~x,data=d))
mfs_scatter_from_models(glm(y~x,data=d), glm(z~x,data=d), title="A great plot")
mfs_scatter_from_models(glm(y~x,data=d), glm(z~x,data=d), xlab="Independent variable")

mfschmidt/mfs.r.utils documentation built on May 29, 2019, 4:44 a.m.