plot.xy.ab.p: An x/y scatterplot with a linear regression line and p-value

View source: R/plot.xy.ap.p.R

plot.xy.ab.pR Documentation

An x/y scatterplot with a linear regression line and p-value

Description

This function performs a simple scatter plot but also superimposses a linear regression trend (abline) and optionally also the p-value of this line

Usage

## S3 method for class 'xy.ab.p'
plot(x, x.var, y.var, 
fit.line=TRUE, p.value=TRUE, slope=TRUE, p.col=c('red','gray','green'), 
               plot.labels=TRUE, verbose=TRUE, xlab=x.var, ylab=y.var, ...)

Arguments

x

a data frame

x.var

the name of the x variable in df

y.var

the name of the y variable in df

fit.line

should a fit (ab) line be drawn?

p.value

should the p-value be printed on the plot?

slope

should the slope be printed on the plot?

p.col

should the plot be labeled?

plot.labels

should all of thie model fit information be printed out?

verbose

should all other information be printed out too?

xlab

label for x-axis

ylab

label for y-axis

...

other parameters passed to 'plot'

Value

An x/y scatterplot with regression line

Examples



par(mfrow=c(6,5), mar=c(2,2,0,0), mgp=c(-1,.5,0))

eg.df <- expand.grid(names(swiss), names(swiss))
for(i in 1:nrow(eg.df)){
  print(i)
  xv <- as.character(eg.df[i,1]); print(xv)
  yv <- as.character(eg.df[i,2]); print(yv)
  if(yv != xv)
    plot.xy.ab.p(x=swiss, x.var=xv, y.var=yv, p.value=FALSE, slope=FALSE) 
}


caroline documentation built on Oct. 21, 2024, 9:06 a.m.