View source: R/trendline_summary.R
trendline_summary | R Documentation |
Summarizing the results of each regression model which built in the 'trendline()' function. The function includes the following models in the latest version: "line2P" (formula as: y=a*x+b), "line3P" (y=a*x^2+b*x+c), "log2P" (y=a*ln(x)+b), "exp2P" (y=a*exp(b*x)),"exp3P" (y=a*exp(b*x)+c), "power2P" (y=a*x^b), and "power3P" (y=a*x^b+c).
trendline_summary( x, y, model = "line2P", Pvalue.corrected = TRUE, summary = TRUE, eDigit = 5 )
x, y |
the x and y arguments provide the x and y coordinates for the plot. Any reasonable way of defining the coordinates is acceptable. |
model |
select which model to fit. Default is "line2P". The "model" should be one of c("line2P", "line3P", "log2P", "exp2P", "exp3P", "power2P", "power3P"), their formulas are as follows: |
Pvalue.corrected |
if P-value corrected or not, the vlaue is one of c("TRUE", "FALSE"). |
summary |
summarizing the model fits. Default is TRUE. |
eDigit |
the numbers of digits for summarized results. Default is 5. |
The linear models (line2P, line3P, log2P) in this package are estimated by lm
function,
while the nonlinear models (exp2P, exp3P, power2P, power3P) are estimated by nls
function (i.e., least-squares method).
The argument 'Pvalue.corrected' is workful for non-linear regression only.
If "Pvalue.corrected = TRUE", the P-vlaue is calculated by using "Residual Sum of Squares" and "Corrected Total Sum of Squares (i.e. sum((y-mean(y))^2))".
If "Pvalue.corrected = TRUE", the P-vlaue is calculated by using "Residual Sum of Squares" and "Uncorrected Total Sum of Squares (i.e. sum(y^2))".
R^2, indicates the R-Squared value of each regression model.
p, indicates the p-value of each regression model.
N, indicates the sample size.
AIC, AICc, or BIC, indicate the Akaike's Information Criterion (AIC), the second-order AIC (AICc) for small samples, or Bayesian Information Criterion (BIC) for fitted model. Click AIC
for details. The smaller the AIC, AICc or BIC, the better the model.
RSS, indicate the value of "Residual Sum of Squares".
If the output of 'AICc' is 'Inf', not an exact number, please try to expand the sample size of your dataset to >=6.
Weiping Mei, Guangchuang Yu
trendline
, SSexp3P
, SSpower3P
, nls
, selfStart
, AICc
library(basicTrendline) x1<-1:6 x2<- -2:3 x3<- c(101,105,140,200,660,1000) x4<- -6:-1 x5<- c(1,30,90,180,360,800) y1<-c(2,14,18,19,20,36) # increasing convex trend y2<- c(-2,-14,-18,-19,-20,-21) # decreasing concave trend y3<-c(2,4,16,38,89,160) # increasing concave trend y4<-c(-2,-4,-16,-38,-89,-160) # decreasing convex trend y5<- c(600002,600014,600018,600019,600020,600022) # high y values with low range. trendline_summary(x1,y1,model="line2P",summary=TRUE,eDigit=10) trendline_summary(x2,y2,model="line3P",summary=FALSE) trendline_summary(x3,y3,model="log2P") trendline_summary(x4,y4,model="exp3P") trendline_summary(x5,y5,model="power3P")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.