trendscatter: Trend and scatter plot

Description Usage Arguments Value Methods (by class) See Also Examples

View source: R/trendscatter.R

Description

Plots a scatter plot for the variables x, y along with a lowess smooth for the underlying trend. One standard deviation error bounds for the scatter about this trend are also plotted.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
trendscatter(x, ...)

## Default S3 method:
trendscatter(x, y = NULL, f = 0.5, xlab = NULL, ylab = NULL, main = NULL, ...)

## S3 method for class 'formula'
trendscatter(
  x,
  f = 0.5,
  data = NULL,
  xlab = NULL,
  ylab = NULL,
  main = NULL,
  ...
)

Arguments

x

the coordinates of the points in the scatter plot. Alternatively, a formula.

...

Optional arguments

y

the y coordinates of the points in the plot, ignored if x is a function.

f

the smoother span. This gives the proportion of points in the plot which influence the smooth at each value. Larger values give more smoothness.

xlab

a title for the x axis: see title.

ylab

a title for the y axis: see title.

main

a title for the plot: see title.

data

an optional data frame containing the variables in the model.

Value

Returns the plot.

Methods (by class)

See Also

residPlot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# A simple polynomial
x = rnorm(100)
e = rnorm(100)
y = 2 + 3 * x - 2 * x^2 + 4 * x^3 + e
trendscatter(y ~ x)

# An exponential growth curve
e = rnorm(100, 0, 0.1)
y = exp(5 + 3 * x + e)
trendscatter(log(y) ~ x)

# Peruvian Indians data
data(peru.df)
trendscatter(BP ~ weight, data = peru.df)

# Note: this usage is deprecated
with(peru.df,trendscatter(weight,BP))

s20x documentation built on Aug. 23, 2021, 9:15 a.m.

Related to trendscatter in s20x...