piecewise_model {seedreg} | R Documentation |
Analysis: Piecewise regression
Description
Fit a degree 1 spline with 1 knot point where the location of the knot point is unknown.
Usage
piecewise_model(
trat,
resp,
middle = 1,
CI = FALSE,
bootstrap.samples = 1000,
sig.level = 0.05,
error = "SE",
ylab = "Germination (%)",
xlab = expression("Temperature ("^"o" * "C)"),
theme = theme_classic(),
cardinal = 0,
width.bar = NA,
legend.position = "top",
textsize = 12,
pointsize = 4.5,
linesize = 0.8,
pointshape = 21,
font.family = "sans"
)
Arguments
trat |
Numerical or complex vector with treatments |
resp |
Numerical vector containing the response of the experiment. |
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()) |
cardinal |
defines the value of y considered extreme (default considers 0 germination) |
width.bar |
bar width |
legend.position |
legend position (default is c(0.3,0.8)) |
textsize |
Font size |
pointsize |
shape size |
linesize |
line size |
pointshape |
format point (default is 21) |
font.family |
Font family (default is sans) |
Value
Coefficients
Coefficients and their p values
Optimum temperature
Optimum temperature (equivalent to the maximum point)
Optimum temperature response
Response at the optimal temperature (equivalent to the maximum point)
Minimal temperature
Temperature that has the lowest response
Minimal temperature response
Lowest predicted response
Predicted maximum basal value
Lower basal limit temperature based on the value set by the user (default is 0)
Predicted minimum basal value
Upper basal limit temperature based on the value set by the user (default is 0)
AIC
Akaike information criterion
BIC
Bayesian Inference Criterion
r-squared
Determination coefficient
RMSE
Root mean square error
grafico
Graph in ggplot2 with equation
Note
if the maximum predicted value is equal to the maximum x, the curve does not have a maximum point within the studied range. If the minimum value is less than the lowest point studied, disregard the value.
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.
Examples
library(seedreg)
data("aristolochia")
attach(aristolochia)
#================================
# Germination
#================================
piecewise_model(trat,germ)
#================================
# Germination speed
#================================
piecewise_model(trat, vel, ylab=expression("v"~(dias^-1)))