linear.linear {AgroReg} | R Documentation |
Analysis: Linear-Linear
Description
This function performs linear linear regression analysis.
Usage
linear.linear(
trat,
resp,
middle = 1,
CI = FALSE,
bootstrap.samples = 1000,
sig.level = 0.05,
error = "SE",
ylab = "Dependent",
xlab = "Independent",
theme = theme_classic(),
point = "all",
width.bar = NA,
legend.position = "top",
textsize = 12,
pointsize = 4.5,
linesize = 0.8,
linetype = 1,
pointshape = 21,
fillshape = "gray",
colorline = "black",
round = NA,
xname.formula = "x",
yname.formula = "y",
comment = NA,
fontfamily = "sans"
)
Arguments
trat |
Numeric vector with dependent variable. |
resp |
Numeric vector with independent variable. |
middle |
A scalar in [0,1]. This represents the range that the change-point can occur in. 0 means the change-point must occur at the middle of the range of x-values. 1 means that the change-point can occur anywhere along the range of the x-values. |
CI |
Whether or not a bootstrap confidence interval should be calculated. Defaults to FALSE because the interval takes a non-trivial amount of time to calculate |
bootstrap.samples |
The number of bootstrap samples to take when calculating the CI. |
sig.level |
What significance level to use for the confidence intervals. |
error |
Error bar (It can be SE - default, SD or FALSE) |
ylab |
Variable response name (Accepts the expression() function) |
xlab |
treatments name (Accepts the expression() function) |
theme |
ggplot2 theme (default is theme_classic()) |
point |
defines whether you want to plot all points ("all") or only the mean ("mean") |
width.bar |
Bar width |
legend.position |
legend position (default is "top") |
textsize |
Font size |
pointsize |
shape size |
linesize |
line size |
linetype |
line type |
pointshape |
format point (default is 21) |
fillshape |
Fill shape |
colorline |
Color lines |
round |
round equation |
xname.formula |
Name of x in the equation |
yname.formula |
Name of y in the equation |
comment |
Add text after equation |
fontfamily |
Font family |
Details
The linear-linear model is defined by: First curve:
y = \beta_0 + \beta_1 \times x (x < breakpoint)
Second curve:
y = \beta_0 + \beta_1 \times breakpoint + w \times x (x > breakpoint)
Value
The function returns a list containing the coefficients and their respective values of p; statistical parameters such as AIC, BIC, pseudo-R2, RMSE (root mean square error); breakpoint and the graph using ggplot2 with the equation automatically.
Author(s)
Model imported from the SiZer package
Gabriel Danilo Shimizu
Leandro Simoes Azeredo Goncalves
References
Chiu, G. S., R. Lockhart, and R. Routledge. 2006. Bent-cable regression theory and applications. Journal of the American Statistical Association 101:542-553.
Toms, J. D., and M. L. Lesperance. 2003. Piecewise regression: a tool for identifying ecological thresholds. Ecology 84:2034-2041.
See Also
quadratic.plateau, linear.plateau
Examples
library(AgroReg)
data("granada")
attach(granada)
linear.linear(time,WL)