expReg {berryFunctions}  R Documentation 
uses lm
; plots data if add=FALSE, draws the regression line
with abline
and confidence interval with polygon
and writes the formula with legend
expReg(
x,
y = NULL,
data = NULL,
logy = TRUE,
predictnew = NULL,
interval = "confidence",
plot = TRUE,
digits = 2,
inset = 0,
xpd = par("xpd"),
pos1 = "top",
pos2 = NULL,
add = FALSE,
pch = 16,
col = rgb(0, 0, 0, 0.5),
modcol = 2,
lwd = 1,
xlab = deparse(substitute(x)),
ylab = deparse(substitute(y)),
main = "exponential regression",
xlim = range(x),
ylim = range(y),
...
)
x 
Numeric or formula (see examples). Vector with values of explanatory variable 
y 
Numeric. Vector with values of dependent variable. DEFAULT: NULL 
data 
Dataframe. If x is a formula, the according columns from data are used as x and y. DEFAULT: NULL 
logy 
Plot with a logarithmic y axis? Calls 
predictnew 
Vector with values to predict outcome for. Passed as 
interval 
Interval for prediction. DEFAULT: "confidence" 
plot 
Plot things at all? If FALSE, predictnew will still be returned. DEFAULT: TRUE 
digits 
Numeric vector of length 
inset 
Numeric vector of length 
xpd 
Logical, specifying whether formula can be written only inside the plot region (when FALSE) or inside the figure region including mar (when TRUE) or in the entire device region including oma (when NA). DEFAULT: par("xpd") 
pos1 

pos2 
For numerical coordinates, this is the yposition. DEFAULT: NULL, as in 
add 
Logical. If TRUE, line and text are added to the existing graphic. DEFAULT: FALSE (plots datapoints first and then the line.) 
pch 
Point Character, see 
col 
Color of points, see 
modcol 
color of model line. DEFAULT: 2 
lwd 
Numeric. Linewidth, see 
xlab , ylab , main 
Character / Expression. axis label and graph title if add=FALSE. DEFAULT: internal from names 
xlim , ylim 
graphic range. DEFAULT: range(x) 
... 
predict.lm
result.
Berry Boessenkool, berryb@gmx.de, Dec. 2014
x < runif(100, 1, 10)
y < 10^(0.3*x+rnorm(100, sd=0.3)+4)
plot(x,y)
expReg(x,y)
expReg(x,y, logy=FALSE)
expReg(x,y, predictnew=6, plot=FALSE)
expReg(x,y, predictnew=3:6, interval="none", plot=FALSE)