View source: R/FunRegressionPlot.R
FunRegressionPlot | R Documentation |
Computes a linear model (lm), plots the regression line, the linear equation and the adj R square value.
FunRegressionPlot(
x = rnorm(10, 10, 2),
y = rnorm(10, 10, 2),
edge = c(0.1, 0.9),
col = "black",
regression_line = T,
x_log_transformed = F,
y_log_transformed = F
)
x |
independent variable |
y |
dependent variable |
edge |
vector in the form c(x,y), defines the position of the linear equation and the adj R square value. The coordinates are given as normalized device coordinates. |
col |
color of regression line and text |
regression_line |
logical, should a regression line be plotted |
x_log_transformed |
logical, indicate a log transformation of the x axis The formula would be lm(log(x), y). Possible in combination with y_log_transformed. |
y_log_transformed |
logical, indicate a log transformation of the y axis The formula would be lm(x, log(y)). Possible in combination with x_log_transformed. |
invisible output of lm()
df <- data.frame(x = 1:10, y = c(1:9, 11))
plot(df$x, df$y)
FunRegressionPlot(x = df$x, y = df$y)
plot(df$x, log(df$y))
FunRegressionPlot(x = df$x, y = log(df$y), y_log_transformed = T)
plot(df$x, log(df$y))
FunRegressionPlot(x = df$x, y = log(df$y), y_log_transformed = T)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.