addSLR | R Documentation |
Adds a simple linear regression line to a scatter plot.
addSLR(x, y, Plot = list(name = "", what = "lines", type = "solid", width = "standard", color = "black"), Model = list(x = "", y = "", form = "exp", where = "none"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE), ...) ## Default S3 method: addSLR(x, y, Plot = list(name = "", what = "lines", type = "solid", width = "standard", color = "black"), Model = list(x = "", y = "", form = "exp", where = "none"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE), ...) ## S3 method for class 'list' addSLR(x, y, Plot = list(name = "", what = "lines", type = "solid", width = "standard", color = "black"), Model = list(x = "", y = "", form = "exp", where = "none"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE), ...)
x |
the x-axis data. For method |
y |
the y-axis data. Missing values are permitted but omitted. |
Plot |
parameters defining the characteristics of the plot. See
|
Model |
parameters for displaying the simple linear regression model. See Details. |
current |
the current plot information. Typically, this would be the
output from one of the graph creation functions like |
... |
not used, required for other methods. |
The Model
argument sets up the information to include the regression
model equation on the graphs. Within Model
, x
is the name to use for the
explanatory variable, y
is the name to use for the response variable, form
indicates the form that the regression model should take if the variable are log
transformed; "exp" indicates that the model equation should be expressed as an exponent,
any other string indicates thet the model should be expressed using the transformation
functions; and where
indicates where to place the equation. The value for
where
is a two letter code based on "upper," "center," or "lower" and "right,"
"center," or "left"—for example "ul" would place the model equaiton in the upper left
corner.
The current plot information, the x and y components are the data, not the line. The regression model is included as the lm component.
addXY
, xyPlot
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) setGD() AA.pl <- xyPlot(X, Y) addSLR(AA.pl) # For more details of addSLR see vignette(topic="GraphAdditions", package="smwrGraphs") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.