Skip to content

Code to estimate soil test critical values following Correndo, A.A., Salvagiotti, F., García, F.O. and Gutiérrez-Boem, F.H., 2017. A modification of the arcsine–log calibration curve for analysing soil test value–relative yield relationships. Crop and Pasture Science, 68(3), pp.297-304. doi: 10.1071/CP16444

License

Notifications You must be signed in to change notification settings

adriancorrendo/modified-ALCC

Repository files navigation

Modified ALCC

Adrian A. Correndo 03/24/2022

This code was prepared as a tutorial for potential users of the Modified Arcsine-log Calibration Curve (modALCC) detailed in Correndo et al. (2017).

Instructions for users

  1. Load your dataframe with soil test value (STV) and relative yield (RY) data.

  2. Specify the following arguments into the function -modALCC()-:

(i). data (optional),

(ii). soil test value STV and relative yield RY,

(iii). target of relative yield (e.g. 90%),

(iv). desired confidence level (e.g. 0.95 for 1 - alpha(0.05)). Used for the estimation of critical soil test value (CSTV) lower and upper limits.

  1. Run and check results in a data.frame.

  2. Check residuals plot, and warnings related to potential leverage points.

  3. Adjust curve plots as desired.

Please, refer any question to Adrian Correndo, correndo@agro.uba.ar - correndo@ksu.edu.

Note: RY should be expressed relative to a maximum in order to obtain values bounded at %100. Otherwise, arcsine transformation doesn’t work. If RY values > 100% are found, the function will cap them up to 100% and will display a warning about this.

References

*Correndo, A.A., Salvagiotti, F., García, F.O. and Gutiérrez-Boem, F.H., 2017. A modification of the arcsine–log calibration curve for analysing soil test value–relative yield relationships. Crop and Pasture Science, 68(3), pp.297-304. https://doi.org/10.1071/CP16444 *

Last update: 03-24-2022

1. Libraries

# Install if needed 
# install.packages("easypackages")
# install.packages("devtools")
library(easypackages) # Helps to load packages and install & load them if they are not installed yet.
library(devtools)
packages("readxl") # Open xlsx files
packages("tidyverse", "ggpmisc") # Data wrangling and plots
packages("smatr") # SMA regression analysis for reference
packages("agridat") # For cotton example dataset

2. Datasets

# Example 1 dataset
data_1 = data.frame("RY" = c(65,80,85,88,90,94,93,96,97,95,98,100,99,99,100),
                   "STV" = c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15))
  

# Example 2 dataframe. Imported from csv file
# It can be easily replaced with your own csv file
data_2 = read.csv(file = "data_test.csv")

# Example 3 dataframe. Imported from xlsx file
data_3 = readxl::read_xlsx(path ="data_3.xlsx", sheet = 1)

# Create nested structure as example of multiple datasets
data.all = bind_rows(data_1, data_2, data_3, .id = "id") %>% 
  tidyr::nest(data = c("STV", "RY"))

3. modALCC() function

modALCC <- function(data=NULL, RY, STV, target, confidence){
  
  # Add a function to cap if there are RY values > 100
  ry <- rlang::eval_tidy(data = data, rlang::quo(ifelse({{RY}} > 100, 100, as.double({{RY}})) ))
  n <- length(ry) # Sample size
  df <- n - 2 # Degrees of freedom
  prob <- 1-((1-confidence)/2) # Probability for t-dist
  tvalue <- qt(p=prob, df = df) # Student-t value
  arc_RY <- asin(sqrt(ry/100)) - asin(sqrt(target/100)) # RY transformation (centered to target)
  ln_STV <- rlang::eval_tidy(data = data, rlang::quo(log({{STV}}) ) ) # STV natural log transformation
  r <- cor(ln_STV, arc_RY, method = "pearson") # Pearson correlation (r)
  p_value <- cor.test(ln_STV,arc_RY, method = "pearson")$p.value # p-value of r
  slope <- sd(ln_STV)/sd(arc_RY) # SMA slope for ln_STV ~ arc_RY
  intercept <- mean(ln_STV) - (mean(arc_RY)*slope) # Intercept
  SMA_line <- intercept + slope * arc_RY # Fitted ln_STV for observed RY
  CSTV <- exp(intercept) # Critical STV for specified RY-target and confidence (1-alpha)
  MSE <- sum((SMA_line-ln_STV)^2)/df # Mean Square Error of ln_STV
  SSx <- sum((mean(arc_RY)-arc_RY)^2)  # Sum of Squares of arc_RY
  SE_int <- sqrt(MSE*((1/n)+ ((mean(arc_RY)^2)/SSx)))  # Standard Error intercept
  CSTV_lower <- exp(intercept - (tvalue * SE_int))  # Lower limit of CSTV
  CSTV_upper <- exp(intercept + (tvalue * SE_int)) # Upper limit of CSTV
  new_RY <- seq(min(ry),100, by=0.2) # New RY vector up to %100 to fit curve
  new_arc_RY <- asin(sqrt(new_RY/100)) - asin(sqrt(target/100)) # Transforming new_RY vector
  fitted_Line <- intercept + slope * new_arc_RY # Fitted ln_STV for curve plot
  fitted_STV <- exp(fitted_Line) # Fitted ln_STV for new_RY
  residuals <- ln_STV - SMA_line # Residuals of SMA Regression
  fitted_axis <- ln_STV + slope * arc_RY # Fitted axis to check SMA residuals
  target <- target # Target RY to show on summary
  confidence <- confidence # Confidence level to show on summary
  # Critical STV for RY = 90 & 100
  arc_ry_100 <- asin(sqrt(ry/100)) - asin(sqrt(1)) 
  cstv.100 <- exp(mean(ln_STV) - (mean(arc_ry_100)*(sd(ln_STV)/sd(arc_ry_100))))
  arc_ry_90 <- asin(sqrt(ry/100)) - asin(sqrt(90/100)) 
  cstv.90 <- exp(mean(ln_STV) - (mean(arc_ry_90)*(sd(ln_STV)/sd(arc_ry_90))))
  # Count cases with STV > x2 cstv90 and STV > cstv100
  n.90x2 <- rlang::eval_tidy(data=data, rlang::quo(length(which({{STV}} > (2*cstv.90))) ) )
  n.100 <- rlang::eval_tidy(data=data, rlang::quo(length(which({{STV}} > cstv.100)) ) )
  # Outcome
  results <- as.data.frame(list("n" = n, "r" = r, "target" = target,"CSTV" = CSTV,
    "LL" = CSTV_lower,"UL" = CSTV_upper,"confidence" = confidence,"p_value" = p_value,
    "CSTV90" = cstv.90, "n.90x2" = n.90x2,"CSTV100" = cstv.100,"n.100" = n.100)) %>% 
    bind_cols(., as.data.frame(list("RY.fitted" = new_RY, "STV.fitted" = fitted_STV))%>% tidyr::nest(Curve = c("RY.fitted", "STV.fitted"))) %>%
    bind_cols(.,  as.data.frame(list("ln_STV" = ln_STV, "arc_RY" = arc_RY, "SMA_line" = SMA_line,"residuals" = residuals,"fitted_axis" = fitted_axis)) %>% tidyr::nest(SMA =  c("ln_STV", "arc_RY", "SMA_line","residuals", "fitted_axis") ) )
  
  # WARNINGS
  rlang::eval_tidy(data = data, rlang::quo(if (max({{RY}}) > 100) {
  warning("One or more original RY values exceeded 100%. All RY values greater 
          than 100% have been capped to 100%.", call. = FALSE) } ) )
  
  if (results$n.100 > 0) {warning(paste0(n.100," STV points exceeded the CSTV for 100%.
  Risk of leverage. You may consider a sensitivity analysis by removing extreme points, 
  re-run the modALCC(), and check results."), call. = FALSE) }
  
  if (results$n.90x2 > 0) {warning(paste0(n.90x2," STV points exceeded two-times (2x) 
  the CSTV for 90%. Risk of leverage. You may consider a sensitivity analysis by 
  removing extreme points, re-run the modALCC(), and check results."), call. = FALSE) }
                             
  return(results) }

4. Fit examples

4.1. Fit ALCC models individually

# RY target = 90%, confidence level = 0.95, replace with your desired values

# Data 1
# Using dataframe
fit_example_1 = modALCC(data = data_1, RY = RY, STV = STV, target=90, confidence = 0.95)
## Warning: 7 STV points exceeded two-times (2x) 
##   the CSTV for 90%. Risk of leverage. You may consider a sensitivity analysis by 
##   removing extreme points, re-run the modALCC(), and check results.
# Alternative using the vectors
#fit_example_1 = ALCC(RY = data_1$RY,STV = data_1$STV, target=90,confidence = 0.95)

fit_example_1
##    n         r target     CSTV       LL       UL confidence      p_value
## 1 15 0.9682908     90 4.478476 3.947041 5.081463       0.95 3.296044e-09
##     CSTV90 n.90x2  CSTV100 n.100
## 1 4.478476      7 19.15054     0
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Curve
## 1 65.000000, 65.200000, 65.400000, 65.600000, 65.800000, 66.000000, 66.200000, 66.400000, 66.600000, 66.800000, 67.000000, 67.200000, 67.400000, 67.600000, 67.800000, 68.000000, 68.200000, 68.400000, 68.600000, 68.800000, 69.000000, 69.200000, 69.400000, 69.600000, 69.800000, 70.000000, 70.200000, 70.400000, 70.600000, 70.800000, 71.000000, 71.200000, 71.400000, 71.600000, 71.800000, 72.000000, 72.200000, 72.400000, 72.600000, 72.800000, 73.000000, 73.200000, 73.400000, 73.600000, 73.800000, 74.000000, 74.200000, 74.400000, 74.600000, 74.800000, 75.000000, 75.200000, 75.400000, 75.600000, 75.800000, 76.000000, 76.200000, 76.400000, 76.600000, 76.800000, 77.000000, 77.200000, 77.400000, 77.600000, 77.800000, 78.000000, 78.200000, 78.400000, 78.600000, 78.800000, 79.000000, 79.200000, 79.400000, 79.600000, 79.800000, 80.000000, 80.200000, 80.400000, 80.600000, 80.800000, 81.000000, 81.200000, 81.400000, 81.600000, 81.800000, 82.000000, 82.200000, 82.400000, 82.600000, 82.800000, 83.000000, 83.200000, 83.400000, 83.600000, 83.800000, 84.000000, 84.200000, 84.400000, 84.600000, 84.800000, 85.000000, 85.200000, 85.400000, 85.600000, 85.800000, 86.000000, 86.200000, 86.400000, 86.600000, 86.800000, 87.000000, 87.200000, 87.400000, 87.600000, 87.800000, 88.000000, 88.200000, 88.400000, 88.600000, 88.800000, 89.000000, 89.200000, 89.400000, 89.600000, 89.800000, 90.000000, 90.200000, 90.400000, 90.600000, 90.800000, 91.000000, 91.200000, 91.400000, 91.600000, 91.800000, 92.000000, 92.200000, 92.400000, 92.600000, 92.800000, 93.000000, 93.200000, 93.400000, 93.600000, 93.800000, 94.000000, 94.200000, 94.400000, 94.600000, 94.800000, 95.000000, 95.200000, 95.400000, 95.600000, 95.800000, 96.000000, 96.200000, 96.400000, 96.600000, 96.800000, 97.000000, 97.200000, 97.400000, 97.600000, 97.800000, 98.000000, 98.200000, 98.400000, 98.600000, 98.800000, 99.000000, 99.200000, 99.400000, 99.600000, 99.800000, 100.000000, 1.097927, 1.108379, 1.118944, 1.129625, 1.140423, 1.151339, 1.162376, 1.173535, 1.184817, 1.196225, 1.207760, 1.219425, 1.231221, 1.243150, 1.255214, 1.267415, 1.279755, 1.292236, 1.304860, 1.317630, 1.330548, 1.343616, 1.356836, 1.370210, 1.383742, 1.397433, 1.411286, 1.425303, 1.439488, 1.453842, 1.468369, 1.483071, 1.497951, 1.513012, 1.528257, 1.543689, 1.559311, 1.575127, 1.591138, 1.607350, 1.623765, 1.640386, 1.657217, 1.674262, 1.691525, 1.709008, 1.726717, 1.744655, 1.762826, 1.781234, 1.799883, 1.818779, 1.837924, 1.857325, 1.876985, 1.896910, 1.917103, 1.937572, 1.958319, 1.979352, 2.000675, 2.022293, 2.044214, 2.066441, 2.088983, 2.111844, 2.135031, 2.158551, 2.182410, 2.206616, 2.231175, 2.256095, 2.281384, 2.307048, 2.333097, 2.359537, 2.386379, 2.413629, 2.441298, 2.469395, 2.497929, 2.526910, 2.556347, 2.586252, 2.616636, 2.647508, 2.678882, 2.710768, 2.743179, 2.776127, 2.809626, 2.843690, 2.878331, 2.913565, 2.949407, 2.985872, 3.022976, 3.060736, 3.099169, 3.138294, 3.178128, 3.218691, 3.260004, 3.302086, 3.344960, 3.388649, 3.433176, 3.478564, 3.524841, 3.572032, 3.620165, 3.669269, 3.719374, 3.770512, 3.822716, 3.876020, 3.930460, 3.986075, 4.042904, 4.100988, 4.160372, 4.221100, 4.283223, 4.346790, 4.411856, 4.478476, 4.546710, 4.616622, 4.688278, 4.761749, 4.837110, 4.914440, 4.993823, 5.075351, 5.159117, 5.245225, 5.333784, 5.424910, 5.518728, 5.615374, 5.714992, 5.817737, 5.923779, 6.033299, 6.146495, 6.263582, 6.384794, 6.510388, 6.640644, 6.775870, 6.916408, 7.062634, 7.214969, 7.373879, 7.539891, 7.713596, 7.895664, 8.086860, 8.288063, 8.500287, 8.724716, 8.962742, 9.216022, 9.486552, 9.776766, 10.089688, 10.429142, 10.800084, 11.209119, 11.665380, 12.182103, 12.779738, 13.492946, 14.389790, 15.647308, 19.150544
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             SMA
## 1 0.00000000, 0.69314718, 1.09861229, 1.38629436, 1.60943791, 1.79175947, 1.94591015, 2.07944154, 2.19722458, 2.30258509, 2.39789527, 2.48490665, 2.56494936, 2.63905733, 2.70805020, -0.31130128, -0.14189705, -0.07594886, -0.03199105, 0.00000000, 0.07428349, 0.05398723, 0.12039263, 0.14766754, 0.09623715, 0.17985350, 0.32175055, 0.22158313, 0.22158313, 0.32175055, 0.09342397, 0.85846552, 1.15629226, 1.35480886, 1.49928272, 1.83475226, 1.74309289, 2.04298443, 2.16615987, 1.93389654, 2.31151393, 2.95233114, 2.49996793, 2.49996793, 2.95233114, -0.09342397, -0.16531834, -0.05767997, 0.03148550, 0.11015519, -0.04299279, 0.20281726, 0.03645711, 0.03106471, 0.36868855, 0.08638134, -0.46742449, 0.06498143, 0.13908940, -0.24428093, -1.40585875, 0.05232998, 0.75562183, 1.24182049, 1.60943791, 2.12722900, 2.18972031, 2.62314325, 2.86410172, 2.73719891, 3.21012648, 3.93795506, 3.56563456, 3.63974254, 4.16109861
# Data 2
fit_example_2 = modALCC(data = data_2, RY = RY, STV = STV, target=90, confidence = 0.95)
## Warning: 9 STV points exceeded the CSTV for 100%.
##   Risk of leverage. You may consider a sensitivity analysis by removing extreme points, 
##   re-run the modALCC(), and check results.

## Warning: 22 STV points exceeded two-times (2x) 
##   the CSTV for 90%. Risk of leverage. You may consider a sensitivity analysis by 
##   removing extreme points, re-run the modALCC(), and check results.
fit_example_2
##     n         r target     CSTV       LL       UL confidence      p_value
## 1 137 0.7164928     90 23.25457 21.57156 25.06888       0.95 7.314913e-23
##     CSTV90 n.90x2  CSTV100 n.100
## 1 23.25457     22 53.10299     9
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Curve
## 1 12.000000, 12.200000, 12.400000, 12.600000, 12.800000, 13.000000, 13.200000, 13.400000, 13.600000, 13.800000, 14.000000, 14.200000, 14.400000, 14.600000, 14.800000, 15.000000, 15.200000, 15.400000, 15.600000, 15.800000, 16.000000, 16.200000, 16.400000, 16.600000, 16.800000, 17.000000, 17.200000, 17.400000, 17.600000, 17.800000, 18.000000, 18.200000, 18.400000, 18.600000, 18.800000, 19.000000, 19.200000, 19.400000, 19.600000, 19.800000, 20.000000, 20.200000, 20.400000, 20.600000, 20.800000, 21.000000, 21.200000, 21.400000, 21.600000, 21.800000, 22.000000, 22.200000, 22.400000, 22.600000, 22.800000, 23.000000, 23.200000, 23.400000, 23.600000, 23.800000, 24.000000, 24.200000, 24.400000, 24.600000, 24.800000, 25.000000, 25.200000, 25.400000, 25.600000, 25.800000, 26.000000, 26.200000, 26.400000, 26.600000, 26.800000, 27.000000, 27.200000, 27.400000, 27.600000, 27.800000, 28.000000, 28.200000, 28.400000, 28.600000, 28.800000, 29.000000, 29.200000, 29.400000, 29.600000, 29.800000, 30.000000, 30.200000, 30.400000, 30.600000, 30.800000, 31.000000, 31.200000, 31.400000, 31.600000, 31.800000, 32.000000, 32.200000, 32.400000, 32.600000, 32.800000, 33.000000, 33.200000, 33.400000, 33.600000, 33.800000, 34.000000, 34.200000, 34.400000, 34.600000, 34.800000, 35.000000, 35.200000, 35.400000, 35.600000, 35.800000, 36.000000, 36.200000, 36.400000, 36.600000, 36.800000, 37.000000, 37.200000, 37.400000, 37.600000, 37.800000, 38.000000, 38.200000, 38.400000, 38.600000, 38.800000, 39.000000, 39.200000, 39.400000, 39.600000, 39.800000, 40.000000, 40.200000, 40.400000, 40.600000, 40.800000, 41.000000, 41.200000, 41.400000, 41.600000, 41.800000, 42.000000, 42.200000, 42.400000, 42.600000, 42.800000, 43.000000, 43.200000, 43.400000, 43.600000, 43.800000, 44.000000, 44.200000, 44.400000, 44.600000, 44.800000, 45.000000, 45.200000, 45.400000, 45.600000, 45.800000, 46.000000, 46.200000, 46.400000, 46.600000, 46.800000, 47.000000, 47.200000, 47.400000, 47.600000, 47.800000, 48.000000, 48.200000, 48.400000, 48.600000, 48.800000, 49.000000, 49.200000, 49.400000, 49.600000, 49.800000, 50.000000, 50.200000, 50.400000, 50.600000, 50.800000, 51.000000, 51.200000, 51.400000, 51.600000, 51.800000, 52.000000, 52.200000, 52.400000, 52.600000, 52.800000, 53.000000, 53.200000, 53.400000, 53.600000, 53.800000, 54.000000, 54.200000, 54.400000, 54.600000, 54.800000, 55.000000, 55.200000, 55.400000, 55.600000, 55.800000, 56.000000, 56.200000, 56.400000, 56.600000, 56.800000, 57.000000, 57.200000, 57.400000, 57.600000, 57.800000, 58.000000, 58.200000, 58.400000, 58.600000, 58.800000, 59.000000, 59.200000, 59.400000, 59.600000, 59.800000, 60.000000, 60.200000, 60.400000, 60.600000, 60.800000, 61.000000, 61.200000, 61.400000, 61.600000, 61.800000, 62.000000, 62.200000, 62.400000, 62.600000, 62.800000, 63.000000, 63.200000, 63.400000, 63.600000, 63.800000, 64.000000, 64.200000, 64.400000, 64.600000, 64.800000, 65.000000, 65.200000, 65.400000, 65.600000, 65.800000, 66.000000, 66.200000, 66.400000, 66.600000, 66.800000, 67.000000, 67.200000, 67.400000, 67.600000, 67.800000, 68.000000, 68.200000, 68.400000, 68.600000, 68.800000, 69.000000, 69.200000, 69.400000, 69.600000, 69.800000, 70.000000, 70.200000, 70.400000, 70.600000, 70.800000, 71.000000, 71.200000, 71.400000, 71.600000, 71.800000, 72.000000, 72.200000, 72.400000, 72.600000, 72.800000, 73.000000, 73.200000, 73.400000, 73.600000, 73.800000, 74.000000, 74.200000, 74.400000, 74.600000, 74.800000, 75.000000, 75.200000, 75.400000, 75.600000, 75.800000, 76.000000, 76.200000, 76.400000, 76.600000, 76.800000, 77.000000, 77.200000, 77.400000, 77.600000, 77.800000, 78.000000, 78.200000, 78.400000, 78.600000, 78.800000, 79.000000, 79.200000, 79.400000, 79.600000, 79.800000, 80.000000, 80.200000, 80.400000, 80.600000, 80.800000, 81.000000, 81.200000, 81.400000, 81.600000, 81.800000, 82.000000, 82.200000, 82.400000, 82.600000, 82.800000, 83.000000, 83.200000, 83.400000, 83.600000, 83.800000, 84.000000, 84.200000, 84.400000, 84.600000, 84.800000, 85.000000, 85.200000, 85.400000, 85.600000, 85.800000, 86.000000, 86.200000, 86.400000, 86.600000, 86.800000, 87.000000, 87.200000, 87.400000, 87.600000, 87.800000, 88.000000, 88.200000, 88.400000, 88.600000, 88.800000, 89.000000, 89.200000, 89.400000, 89.600000, 89.800000, 90.000000, 90.200000, 90.400000, 90.600000, 90.800000, 91.000000, 91.200000, 91.400000, 91.600000, 91.800000, 92.000000, 92.200000, 92.400000, 92.600000, 92.800000, 93.000000, 93.200000, 93.400000, 93.600000, 93.800000, 94.000000, 94.200000, 94.400000, 94.600000, 94.800000, 95.000000, 95.200000, 95.400000, 95.600000, 95.800000, 96.000000, 96.200000, 96.400000, 96.600000, 96.800000, 97.000000, 97.200000, 97.400000, 97.600000, 97.800000, 98.000000, 98.200000, 98.400000, 98.600000, 98.800000, 99.000000, 99.200000, 99.400000, 99.600000, 99.800000, 100.000000, 2.336883, 2.355345, 2.373822, 2.392314, 2.410824, 2.429353, 2.447902, 2.466472, 2.485066, 2.503683, 2.522326, 2.540994, 2.559691, 2.578416, 2.597171, 2.615957, 2.634775, 2.653625, 2.672510, 2.691430, 2.710385, 2.729377, 2.748407, 2.767476, 2.786584, 2.805733, 2.824922, 2.844155, 2.863430, 2.882748, 2.902112, 2.921521, 2.940976, 2.960478, 2.980028, 2.999627, 3.019275, 3.038973, 3.058722, 3.078522, 3.098374, 3.118280, 3.138239, 3.158253, 3.178322, 3.198446, 3.218628, 3.238866, 3.259162, 3.279517, 3.299931, 3.320405, 3.340940, 3.361536, 3.382194, 3.402915, 3.423698, 3.444546, 3.465459, 3.486436, 3.507480, 3.528590, 3.549767, 3.571012, 3.592326, 3.613709, 3.635161, 3.656685, 3.678279, 3.699945, 3.721683, 3.743495, 3.765380, 3.787340, 3.809375, 3.831485, 3.853672, 3.875936, 3.898277, 3.920697, 3.943195, 3.965774, 3.988432, 4.011172, 4.033993, 4.056896, 4.079883, 4.102953, 4.126107, 4.149347, 4.172672, 4.196083, 4.219582, 4.243168, 4.266843, 4.290606, 4.314460, 4.338404, 4.362439, 4.386567, 4.410787, 4.435100, 4.459507, 4.484009, 4.508607, 4.533301, 4.558092, 4.582980, 4.607967, 4.633054, 4.658240, 4.683527, 4.708916, 4.734406, 4.760000, 4.785698, 4.811500, 4.837408, 4.863422, 4.889542, 4.915771, 4.942108, 4.968555, 4.995111, 5.021779, 5.048559, 5.075451, 5.102457, 5.129578, 5.156813, 5.184165, 5.211634, 5.239220, 5.266926, 5.294751, 5.322696, 5.350763, 5.378953, 5.407266, 5.435703, 5.464265, 5.492953, 5.521768, 5.550712, 5.579784, 5.608986, 5.638319, 5.667784, 5.697382, 5.727114, 5.756981, 5.786984, 5.817124, 5.847402, 5.877819, 5.908377, 5.939075, 5.969916, 6.000901, 6.032030, 6.063304, 6.094726, 6.126295, 6.158014, 6.189883, 6.221903, 6.254076, 6.286402, 6.318884, 6.351522, 6.384317, 6.417271, 6.450385, 6.483660, 6.517098, 6.550699, 6.584466, 6.618399, 6.652499, 6.686769, 6.721209, 6.755821, 6.790607, 6.825566, 6.860702, 6.896016, 6.931508, 6.967181, 7.003035, 7.039073, 7.075296, 7.111705, 7.148302, 7.185089, 7.222066, 7.259237, 7.296601, 7.334162, 7.371920, 7.409878, 7.448036, 7.486397, 7.524963, 7.563734, 7.602714, 7.641903, 7.681304, 7.720918, 7.760747, 7.800794, 7.841059, 7.881546, 7.922255, 7.963189, 8.004350, 8.045739, 8.087360, 8.129213, 8.171302, 8.213628, 8.256193, 8.298999, 8.342049, 8.385345, 8.428890, 8.472684, 8.516732, 8.561034, 8.605594, 8.650414, 8.695497, 8.740844, 8.786458, 8.832342, 8.878499, 8.924930, 8.971640, 9.018629, 9.065902, 9.113461, 9.161308, 9.209446, 9.257879, 9.306609, 9.355639, 9.404972, 9.454611, 9.504560, 9.554821, 9.605397, 9.656292, 9.707509, 9.759051, 9.810922, 9.863125, 9.915663, 9.968541, 10.021761, 10.075327, 10.129242, 10.183511, 10.238138, 10.293126, 10.348478, 10.404200, 10.460295, 10.516766, 10.573619, 10.630857, 10.688485, 10.746507, 10.804928, 10.863751, 10.922982, 10.982625, 11.042685, 11.103166, 11.164074, 11.225413, 11.287189, 11.349407, 11.412071, 11.475188, 11.538762, 11.602799, 11.667304, 11.732284, 11.797744, 11.863690, 11.930128, 11.997064, 12.064504, 12.132455, 12.200922, 12.269914, 12.339435, 12.409494, 12.480096, 12.551250, 12.622962, 12.695240, 12.768091, 12.841522, 12.915543, 12.990159, 13.065381, 13.141215, 13.217670, 13.294756, 13.372480, 13.450851, 13.529880, 13.609574, 13.689945, 13.771001, 13.852752, 13.935209, 14.018381, 14.102280, 14.186917, 14.272302, 14.358448, 14.445364, 14.533064, 14.621560, 14.710863, 14.800987, 14.891945, 14.983749, 15.076415, 15.169955, 15.264384, 15.359717, 15.455968, 15.553154, 15.651289, 15.750391, 15.850475, 15.951559, 16.053661, 16.156798, 16.260989, 16.366253, 16.472609, 16.580077, 16.688679, 16.798434, 16.909365, 17.021495, 17.134845, 17.249441, 17.365306, 17.482466, 17.600946, 17.720773, 17.841975, 17.964580, 18.088618, 18.214118, 18.341112, 18.469631, 18.599711, 18.731384, 18.864686, 18.999655, 19.136328, 19.274745, 19.414946, 19.556974, 19.700873, 19.846689, 19.994468, 20.144260, 20.296115, 20.450087, 20.606231, 20.764604, 20.925266, 21.088278, 21.253707, 21.421618, 21.592084, 21.765177, 21.940974, 22.119557, 22.301010, 22.485420, 22.672882, 22.863491, 23.057350, 23.254567, 23.455255, 23.659532, 23.867524, 24.079364, 24.295192, 24.515156, 24.739412, 24.968128, 25.201479, 25.439655, 25.682855, 25.931293, 26.185196, 26.444810, 26.710396, 26.982235, 27.260631, 27.545908, 27.838422, 28.138553, 28.446718, 28.763369, 29.089000, 29.424154, 29.769426, 30.125473, 30.493024, 30.872890, 31.265974, 31.673293, 32.095997, 32.535388, 32.992958, 33.470424, 33.969784, 34.493376, 35.043972, 35.624899, 36.240199, 36.894871, 37.595217, 38.349366, 39.168111, 40.066313, 41.065417, 42.198418, 43.520998, 45.142004, 47.343203, 53.102988
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                SMA
## 1 1.386294361, 1.609437912, 1.791759469, 1.791759469, 1.945910149, 1.945910149, 2.197224577, 2.197224577, 2.302585093, 2.302585093, 2.302585093, 2.302585093, 2.397895273, 2.397895273, 2.484906650, 2.564949357, 2.564949357, 2.564949357, 2.564949357, 2.564949357, 2.639057330, 2.639057330, 2.639057330, 2.639057330, 2.639057330, 2.708050201, 2.708050201, 2.708050201, 2.708050201, 2.708050201, 2.772588722, 2.772588722, 2.772588722, 2.772588722, 2.772588722, 2.833213344, 2.833213344, 2.833213344, 2.833213344, 2.890371758, 2.890371758, 2.890371758, 2.890371758, 2.944438979, 2.944438979, 2.944438979, 2.944438979, 2.995732274, 2.995732274, 3.044522438, 3.044522438, 3.044522438, 3.044522438, 3.044522438, 3.044522438, 3.091042453, 3.091042453, 3.091042453, 3.091042453, 3.091042453, 3.091042453, 3.135494216, 3.135494216, 3.135494216, 3.178053830, 3.178053830, 3.178053830, 3.218875825, 3.218875825, 3.218875825, 3.218875825, 3.258096538, 3.258096538, 3.295836866, 3.295836866, 3.295836866, 3.295836866, 3.332204510, 3.332204510, 3.332204510, 3.367295830, 3.401197382, 3.401197382, 3.433987204, 3.433987204, 3.526360525, 3.555348061, 3.555348061, 3.555348061, 3.583518938, 3.583518938, 3.583518938, 3.610917913, 3.610917913, 3.610917913, 3.610917913, 3.637586160, 3.637586160, 3.663561646, 3.663561646, 3.713572067, 3.713572067, 3.713572067, 3.713572067, 3.737669618, 3.737669618, 3.737669618, 3.737669618, 3.737669618, 3.761200116, 3.784189634, 3.784189634, 3.806662490, 3.806662490, 3.828641396, 3.850147602, 3.850147602, 3.871201011, 3.871201011, 3.891820298, 3.912023005, 3.912023005, 3.912023005, 3.912023005, 3.912023005, 3.931825633, 3.931825633, 3.951243719, 3.988984047, 3.988984047, 3.988984047, 3.988984047, 4.007333185, 4.007333185, 4.007333185, 4.025351691, 4.025351691, -0.895304167, -0.473648276, -0.246924949, -0.413563898, -0.061746450, -0.311301282, -0.016314700, -0.103238229, -0.154283264, -0.141897055, -0.141897055, -0.075948861, -0.383302283, -0.554140835, 0.017057900, -0.257889186, -0.235848272, -0.190222134, -0.311301282, -0.031991051, -0.047112430, -0.463647609, -0.178429054, -0.201848221, -0.075948861, -0.332136508, -0.116398476, -0.246924949, -0.213320253, -0.178429054, -0.103238229, 0.000000000, -0.089766292, -0.383302283, -0.166454709, 0.321750554, -0.213320253, -0.047112430, -0.154283264, -0.141897055, 0.017057900, -0.089766292, -0.224650010, 0.221583133, -0.075948861, -0.190222134, 0.179853500, -0.178429054, -0.342464683, 0.120392634, -0.166454709, 0.096237148, -0.352740374, -0.047112430, 0.321750554, -0.075948861, -0.129276257, -0.047112430, -0.332136508, 0.017057900, 0.321750554, 0.179853500, -0.268749461, 0.321750554, 0.321750554, 0.221583133, 0.321750554, -0.116398476, 0.000000000, 0.017057900, -0.129276257, -0.075948861, 0.147667544, 0.321750554, 0.321750554, 0.221583133, 0.053987227, 0.120392634, 0.034994002, -0.089766292, 0.147667544, 0.321750554, 0.120392634, 0.321750554, 0.074283491, 0.179853500, 0.321750554, 0.034994002, 0.120392634, 0.221583133, 0.147667544, 0.017057900, 0.221583133, 0.074283491, 0.179853500, -0.031991051, 0.074283491, 0.034994002, 0.179853500, 0.053987227, 0.179853500, 0.321750554, 0.321750554, 0.179853500, 0.321750554, 0.179853500, -0.031991051, 0.321750554, 0.074283491, 0.221583133, 0.179853500, 0.074283491, -0.031991051, 0.120392634, -0.047112430, 0.096237148, 0.096237148, 0.120392634, 0.053987227, 0.096237148, 0.321750554, 0.321750554, 0.321750554, 0.179853500, 0.321750554, 0.321750554, 0.321750554, 0.034994002, 0.321750554, 0.147667544, 0.221583133, 0.179853500, 0.321750554, 0.147667544, 0.034994002, 0.321750554, 0.179853500, 0.848817889, 1.930943814, 2.512800241, 2.085142686, 2.988037180, 2.347586614, 3.104631955, 2.881553835, 2.750553280, 2.782340901, 2.782340901, 2.951588508, 2.162805253, 1.724369955, 3.190278467, 2.484661929, 2.541227115, 2.658320765, 2.347586614, 3.064400604, 3.025593520, 1.956609247, 2.688586196, 2.628483898, 2.951588508, 2.294115672, 2.847779742, 2.512800241, 2.599042396, 2.688586196, 2.881553835, 3.146501547, 2.916127838, 2.162805253, 2.719316822, 3.972233202, 2.599042396, 3.025593520, 2.750553280, 2.782340901, 3.190278467, 2.916127838, 2.569966024, 3.715166324, 2.951588508, 2.658320765, 3.608072556, 2.688586196, 2.267609729, 3.455473846, 2.719316822, 3.393481883, 2.241238484, 3.025593520, 3.972233202, 2.951588508, 2.814730564, 3.025593520, 2.294115672, 3.190278467, 3.972233202, 3.608072556, 2.456790422, 3.972233202, 3.972233202, 3.715166324, 3.972233202, 2.847779742, 3.146501547, 3.190278467, 2.814730564, 2.951588508, 3.525471415, 3.972233202, 3.972233202, 3.715166324, 3.285052862, 3.455473846, 3.236309179, 2.916127838, 3.525471415, 3.972233202, 3.455473846, 3.972233202, 3.337140628, 3.608072556, 3.972233202, 3.236309179, 3.455473846, 3.715166324, 3.525471415, 3.190278467, 3.715166324, 3.337140628, 3.608072556, 3.064400604, 3.337140628, 3.236309179, 3.608072556, 3.285052862, 3.608072556, 3.972233202, 3.972233202, 3.608072556, 3.972233202, 3.608072556, 3.064400604, 3.972233202, 3.337140628, 3.715166324, 3.608072556, 3.337140628, 3.064400604, 3.455473846, 3.025593520, 3.393481883, 3.393481883, 3.455473846, 3.285052862, 3.393481883, 3.972233202, 3.972233202, 3.972233202, 3.608072556, 3.972233202, 3.972233202, 3.972233202, 3.236309179, 3.972233202, 3.525471415, 3.715166324, 3.608072556, 3.972233202, 3.525471415, 3.236309179, 3.972233202, 3.608072556, 0.537476472, -0.321505902, -0.721040772, -0.293383216, -1.042127031, -0.401676465, -0.907407377, -0.684329258, -0.447968187, -0.479755808, -0.479755808, -0.649003415, 0.235090020, 0.673525318, -0.705371817, 0.080287429, 0.023722242, -0.093371408, 0.217362743, -0.499451247, -0.386536191, 0.682448083, -0.049528866, 0.010573431, -0.312531178, 0.413934529, -0.139729541, 0.195249960, 0.109007805, 0.019464006, -0.108965113, -0.373912825, -0.143539116, 0.609783469, 0.053271901, -1.139019858, 0.234170948, -0.192380176, 0.082660064, 0.108030857, -0.299906709, -0.025756080, 0.320405734, -0.770727345, -0.007149529, 0.286118214, -0.663633577, 0.307146078, 0.728122544, -0.410951409, 0.325205616, -0.348959445, 0.803283954, 0.018928917, -0.927710764, 0.139453945, 0.276311890, 0.065448933, 0.796926781, -0.099236014, -0.881190748, -0.472578340, 0.678703794, -0.836738986, -0.794179371, -0.537112494, -0.794179371, 0.371096083, 0.072374278, 0.028597358, 0.404145261, 0.306508030, -0.267374877, -0.676396336, -0.676396336, -0.419329458, 0.010784004, -0.123269336, 0.095895331, 0.416076672, -0.158175585, -0.571035820, -0.054276465, -0.538245997, 0.096846576, -0.081712031, -0.416885140, 0.319038883, 0.099874215, -0.131647386, 0.058047523, 0.393240471, -0.104248411, 0.273777284, 0.002845357, 0.546517308, 0.300445531, 0.401276981, 0.055489090, 0.378508784, 0.105499511, -0.258661135, -0.258661135, 0.105499511, -0.234563583, 0.129597062, 0.673269014, -0.234563583, 0.400528990, 0.046033792, 0.176117078, 0.447049005, 0.742261885, 0.351188644, 0.803047876, 0.456665719, 0.456665719, 0.415727165, 0.586148149, 0.498338416, -0.060210196, -0.060210196, -0.060210196, 0.303950450, -0.060210196, -0.040407569, -0.040407569, 0.714934540, 0.016750845, 0.463512631, 0.273817723, 0.380911491, 0.035099984, 0.481861770, 0.771024006, 0.053118489, 0.417279135, -0.911389297, 0.393880180, 1.158058163, 0.730400608, 1.787445782, 1.146995216, 2.155354985, 1.932276865, 1.906636826, 1.938424447, 1.938424447, 2.107672054, 1.414198979, 0.975763681, 2.528683570, 1.903109739, 1.959674925, 2.076768576, 1.766034424, 2.482848415, 2.518149303, 1.449165029, 2.181141978, 2.121039681, 2.444144290, 1.855664326, 2.409328396, 2.074348895, 2.160591050, 2.250134850, 2.507641010, 2.772588722, 2.542215013, 1.788892428, 2.345403997, 3.658944999, 2.285754193, 2.712305317, 2.437265077, 2.526211112, 2.934148678, 2.659998049, 2.313836235, 3.513103756, 2.749525940, 2.456258197, 3.406009988, 2.537816922, 2.116840456, 3.353494737, 2.617337712, 3.291502773, 2.139259375, 2.923614411, 3.870254092, 2.896129414, 2.759271470, 2.970134427, 2.238656578, 3.134819373, 3.916774108, 3.597065225, 2.445783091, 3.961225870, 4.003785485, 3.746718607, 4.003785485, 2.920154020, 3.218875825, 3.262652745, 2.887104841, 3.063183499, 3.637066406, 4.121568521, 4.121568521, 3.864501643, 3.434388181, 3.641176809, 3.422012142, 3.101830801, 3.746265698, 4.226929036, 3.710169681, 4.259718859, 3.624626286, 3.987931533, 4.381079716, 3.645155693, 3.864320361, 4.152183715, 3.962488807, 3.627295859, 4.179582690, 3.801556994, 4.072488921, 3.528816970, 3.828225241, 3.727393792, 4.125132655, 3.802112961, 4.175143075, 4.539303721, 4.539303721, 4.175143075, 4.563401273, 4.199240627, 3.655568675, 4.563401273, 3.928308700, 4.329864893, 4.245760643, 3.974828715, 3.724561547, 4.115634789, 3.707733370, 4.097127937, 4.097127937, 4.180173310, 4.009752326, 4.138800634, 4.737754660, 4.737754660, 4.737754660, 4.373594014, 4.737754660, 4.757557287, 4.757557287, 4.041051350, 4.814715701, 4.367953915, 4.557648823, 4.450555055, 4.833064840, 4.386303054, 4.097140817, 4.851083345, 4.486922699
# Data 3
fit_example_3 = modALCC(data = data_3, RY = RY, STV = STV, target=90, confidence = 0.95)
## Warning: 3 STV points exceeded the CSTV for 100%.
##   Risk of leverage. You may consider a sensitivity analysis by removing extreme points, 
##   re-run the modALCC(), and check results.

## Warning: 3 STV points exceeded two-times (2x) 
##   the CSTV for 90%. Risk of leverage. You may consider a sensitivity analysis by 
##   removing extreme points, re-run the modALCC(), and check results.
fit_example_3
##     n         r target     CSTV       LL       UL confidence      p_value
## 1 107 0.3735166     90 21.76416 19.35018 24.47929       0.95 7.410056e-05
##     CSTV90 n.90x2 CSTV100 n.100
## 1 21.76416      3 38.7896     3
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Curve
## 1 25.000000, 25.200000, 25.400000, 25.600000, 25.800000, 26.000000, 26.200000, 26.400000, 26.600000, 26.800000, 27.000000, 27.200000, 27.400000, 27.600000, 27.800000, 28.000000, 28.200000, 28.400000, 28.600000, 28.800000, 29.000000, 29.200000, 29.400000, 29.600000, 29.800000, 30.000000, 30.200000, 30.400000, 30.600000, 30.800000, 31.000000, 31.200000, 31.400000, 31.600000, 31.800000, 32.000000, 32.200000, 32.400000, 32.600000, 32.800000, 33.000000, 33.200000, 33.400000, 33.600000, 33.800000, 34.000000, 34.200000, 34.400000, 34.600000, 34.800000, 35.000000, 35.200000, 35.400000, 35.600000, 35.800000, 36.000000, 36.200000, 36.400000, 36.600000, 36.800000, 37.000000, 37.200000, 37.400000, 37.600000, 37.800000, 38.000000, 38.200000, 38.400000, 38.600000, 38.800000, 39.000000, 39.200000, 39.400000, 39.600000, 39.800000, 40.000000, 40.200000, 40.400000, 40.600000, 40.800000, 41.000000, 41.200000, 41.400000, 41.600000, 41.800000, 42.000000, 42.200000, 42.400000, 42.600000, 42.800000, 43.000000, 43.200000, 43.400000, 43.600000, 43.800000, 44.000000, 44.200000, 44.400000, 44.600000, 44.800000, 45.000000, 45.200000, 45.400000, 45.600000, 45.800000, 46.000000, 46.200000, 46.400000, 46.600000, 46.800000, 47.000000, 47.200000, 47.400000, 47.600000, 47.800000, 48.000000, 48.200000, 48.400000, 48.600000, 48.800000, 49.000000, 49.200000, 49.400000, 49.600000, 49.800000, 50.000000, 50.200000, 50.400000, 50.600000, 50.800000, 51.000000, 51.200000, 51.400000, 51.600000, 51.800000, 52.000000, 52.200000, 52.400000, 52.600000, 52.800000, 53.000000, 53.200000, 53.400000, 53.600000, 53.800000, 54.000000, 54.200000, 54.400000, 54.600000, 54.800000, 55.000000, 55.200000, 55.400000, 55.600000, 55.800000, 56.000000, 56.200000, 56.400000, 56.600000, 56.800000, 57.000000, 57.200000, 57.400000, 57.600000, 57.800000, 58.000000, 58.200000, 58.400000, 58.600000, 58.800000, 59.000000, 59.200000, 59.400000, 59.600000, 59.800000, 60.000000, 60.200000, 60.400000, 60.600000, 60.800000, 61.000000, 61.200000, 61.400000, 61.600000, 61.800000, 62.000000, 62.200000, 62.400000, 62.600000, 62.800000, 63.000000, 63.200000, 63.400000, 63.600000, 63.800000, 64.000000, 64.200000, 64.400000, 64.600000, 64.800000, 65.000000, 65.200000, 65.400000, 65.600000, 65.800000, 66.000000, 66.200000, 66.400000, 66.600000, 66.800000, 67.000000, 67.200000, 67.400000, 67.600000, 67.800000, 68.000000, 68.200000, 68.400000, 68.600000, 68.800000, 69.000000, 69.200000, 69.400000, 69.600000, 69.800000, 70.000000, 70.200000, 70.400000, 70.600000, 70.800000, 71.000000, 71.200000, 71.400000, 71.600000, 71.800000, 72.000000, 72.200000, 72.400000, 72.600000, 72.800000, 73.000000, 73.200000, 73.400000, 73.600000, 73.800000, 74.000000, 74.200000, 74.400000, 74.600000, 74.800000, 75.000000, 75.200000, 75.400000, 75.600000, 75.800000, 76.000000, 76.200000, 76.400000, 76.600000, 76.800000, 77.000000, 77.200000, 77.400000, 77.600000, 77.800000, 78.000000, 78.200000, 78.400000, 78.600000, 78.800000, 79.000000, 79.200000, 79.400000, 79.600000, 79.800000, 80.000000, 80.200000, 80.400000, 80.600000, 80.800000, 81.000000, 81.200000, 81.400000, 81.600000, 81.800000, 82.000000, 82.200000, 82.400000, 82.600000, 82.800000, 83.000000, 83.200000, 83.400000, 83.600000, 83.800000, 84.000000, 84.200000, 84.400000, 84.600000, 84.800000, 85.000000, 85.200000, 85.400000, 85.600000, 85.800000, 86.000000, 86.200000, 86.400000, 86.600000, 86.800000, 87.000000, 87.200000, 87.400000, 87.600000, 87.800000, 88.000000, 88.200000, 88.400000, 88.600000, 88.800000, 89.000000, 89.200000, 89.400000, 89.600000, 89.800000, 90.000000, 90.200000, 90.400000, 90.600000, 90.800000, 91.000000, 91.200000, 91.400000, 91.600000, 91.800000, 92.000000, 92.200000, 92.400000, 92.600000, 92.800000, 93.000000, 93.200000, 93.400000, 93.600000, 93.800000, 94.000000, 94.200000, 94.400000, 94.600000, 94.800000, 95.000000, 95.200000, 95.400000, 95.600000, 95.800000, 96.000000, 96.200000, 96.400000, 96.600000, 96.800000, 97.000000, 97.200000, 97.400000, 97.600000, 97.800000, 98.000000, 98.200000, 98.400000, 98.600000, 98.800000, 99.000000, 99.200000, 99.400000, 99.600000, 99.800000, 100.000000, 5.913921, 5.938470, 5.963055, 5.987678, 6.012339, 6.037039, 6.061779, 6.086559, 6.111380, 6.136242, 6.161146, 6.186093, 6.211083, 6.236117, 6.261195, 6.286319, 6.311488, 6.336704, 6.361966, 6.387276, 6.412635, 6.438041, 6.463498, 6.489003, 6.514560, 6.540167, 6.565827, 6.591538, 6.617302, 6.643120, 6.668991, 6.694917, 6.720899, 6.746936, 6.773029, 6.799179, 6.825387, 6.851653, 6.877977, 6.904361, 6.930804, 6.957308, 6.983873, 7.010500, 7.037188, 7.063940, 7.090755, 7.117633, 7.144577, 7.171585, 7.198659, 7.225800, 7.253007, 7.280282, 7.307625, 7.335037, 7.362518, 7.390069, 7.417691, 7.445384, 7.473148, 7.500985, 7.528895, 7.556879, 7.584937, 7.613070, 7.641278, 7.669563, 7.697925, 7.726364, 7.754881, 7.783476, 7.812151, 7.840907, 7.869743, 7.898660, 7.927659, 7.956741, 7.985907, 8.015156, 8.044490, 8.073910, 8.103416, 8.133008, 8.162688, 8.192457, 8.222314, 8.252260, 8.282298, 8.312426, 8.342646, 8.372958, 8.403364, 8.433864, 8.464458, 8.495148, 8.525934, 8.556817, 8.587798, 8.618878, 8.650057, 8.681336, 8.712716, 8.744197, 8.775781, 8.807469, 8.839260, 8.871157, 8.903160, 8.935269, 8.967485, 8.999810, 9.032244, 9.064789, 9.097444, 9.130211, 9.163091, 9.196084, 9.229192, 9.262416, 9.295756, 9.329213, 9.362788, 9.396483, 9.430298, 9.464234, 9.498292, 9.532473, 9.566779, 9.601209, 9.635766, 9.670449, 9.705261, 9.740203, 9.775274, 9.810477, 9.845812, 9.881281, 9.916885, 9.952624, 9.988500, 10.024514, 10.060667, 10.096961, 10.133396, 10.169974, 10.206695, 10.243562, 10.280575, 10.317736, 10.355045, 10.392504, 10.430115, 10.467879, 10.505796, 10.543869, 10.582098, 10.620485, 10.659032, 10.697739, 10.736609, 10.775642, 10.814840, 10.854205, 10.893737, 10.933439, 10.973312, 11.013357, 11.053576, 11.093971, 11.134543, 11.175294, 11.216225, 11.257338, 11.298635, 11.340117, 11.381786, 11.423644, 11.465692, 11.507933, 11.550368, 11.592999, 11.635828, 11.678856, 11.722086, 11.765520, 11.809159, 11.853005, 11.897061, 11.941328, 11.985809, 12.030505, 12.075419, 12.120553, 12.165909, 12.211490, 12.257296, 12.303332, 12.349599, 12.396099, 12.442835, 12.489809, 12.537024, 12.584482, 12.632185, 12.680137, 12.728340, 12.776796, 12.825509, 12.874480, 12.923713, 12.973210, 13.022975, 13.073010, 13.123318, 13.173903, 13.224766, 13.275912, 13.327344, 13.379064, 13.431076, 13.483383, 13.535988, 13.588896, 13.642110, 13.695632, 13.749467, 13.803618, 13.858089, 13.912884, 13.968007, 14.023461, 14.079251, 14.135381, 14.191855, 14.248676, 14.305850, 14.363381, 14.421274, 14.479531, 14.538160, 14.597164, 14.656547, 14.716316, 14.776475, 14.837028, 14.897983, 14.959342, 15.021113, 15.083301, 15.145911, 15.208949, 15.272421, 15.336333, 15.400691, 15.465502, 15.530772, 15.596507, 15.662715, 15.729402, 15.796574, 15.864241, 15.932407, 16.001082, 16.070273, 16.139988, 16.210234, 16.281021, 16.352355, 16.424248, 16.496706, 16.569739, 16.643357, 16.717568, 16.792384, 16.867813, 16.943866, 17.020554, 17.097888, 17.175878, 17.254537, 17.333875, 17.413906, 17.494641, 17.576093, 17.658275, 17.741202, 17.824886, 17.909343, 17.994586, 18.080632, 18.167495, 18.255192, 18.343740, 18.433156, 18.523457, 18.614662, 18.706790, 18.799859, 18.893892, 18.988907, 19.084928, 19.181976, 19.280074, 19.379246, 19.479518, 19.580915, 19.683463, 19.787191, 19.892127, 19.998301, 20.105744, 20.214490, 20.324570, 20.436021, 20.548879, 20.663183, 20.778971, 20.896287, 21.015172, 21.135673, 21.257837, 21.381715, 21.507357, 21.634821, 21.764162, 21.895441, 22.028724, 22.164075, 22.301567, 22.441275, 22.583277, 22.727657, 22.874504, 23.023912, 23.175981, 23.330817, 23.488535, 23.649255, 23.813106, 23.980228, 24.150769, 24.324889, 24.502761, 24.684571, 24.870521, 25.060830, 25.255736, 25.455500, 25.660405, 25.870765, 26.086925, 26.309266, 26.538212, 26.774237, 27.017872, 27.269717, 27.530450, 27.800851, 28.081811, 28.374371, 28.679745, 28.999371, 29.334975, 29.688650, 30.062983, 30.461232, 30.887593, 31.347636, 31.849016, 32.402775, 33.025879, 33.746927, 34.621766, 35.794793, 38.789595
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         SMA
## 1 1.6094379124, 1.7917594692, 1.7917594692, 1.9459101491, 1.9459101491, 2.0794415417, 2.0794415417, 2.1972245773, 2.1972245773, 2.1972245773, 2.1972245773, 2.1972245773, 2.3025850930, 2.3025850930, 2.3025850930, 2.3025850930, 2.3025850930, 2.3025850930, 2.3025850930, 2.3978952728, 2.3978952728, 2.3978952728, 2.3978952728, 2.3978952728, 2.3978952728, 2.3978952728, 2.4849066498, 2.4849066498, 2.4849066498, 2.5649493575, 2.5649493575, 2.5649493575, 2.5649493575, 2.6390573296, 2.6390573296, 2.6390573296, 2.6390573296, 2.6390573296, 2.6390573296, 2.7080502011, 2.7080502011, 2.7080502011, 2.7080502011, 2.7725887222, 2.7725887222, 2.7725887222, 2.7725887222, 2.7725887222, 2.7725887222, 2.7725887222, 2.7725887222, 2.8332133441, 2.8332133441, 2.8332133441, 2.8332133441, 2.8332133441, 2.8332133441, 2.8332133441, 2.8332133441, 2.8903717579, 2.8903717579, 2.8903717579, 2.8903717579, 2.8903717579, 2.8903717579, 2.8903717579, 2.8903717579, 2.8903717579, 2.9444389792, 2.9444389792, 2.9444389792, 2.9444389792, 2.9444389792, 2.9957322736, 2.9957322736, 2.9957322736, 3.0445224377, 3.0445224377, 3.0910424534, 3.0910424534, 3.1354942159, 3.1780538303, 3.1780538303, 3.1780538303, 3.2188758249, 3.2188758249, 3.2580965380, 3.2580965380, 3.2580965380, 3.2580965380, 3.2958368660, 3.2958368660, 3.3322045102, 3.3322045102, 3.3322045102, 3.3672958300, 3.4011973817, 3.4339872045, 3.4339872045, 3.4339872045, 3.4965075615, 3.4965075615, 3.4965075615, 3.5553480615, 3.8918202981, 4.0073331852, 4.1896547420, -0.4035026678, -0.6055446636, -0.3934169016, -0.0897662917, 0.3217505544, -0.5439929355, -0.5439929355, -0.3424646835, 0.0539872272, -0.2687494608, -0.1902221337, -0.5137313196, -0.2901891602, -0.1418970546, -0.3527403738, -0.2018482212, -0.5643265694, -0.2133202528, -0.2469249490, -0.5439929355, -0.1032382286, -0.3321365075, -0.1418970546, -0.0319910515, -0.3424646835, -0.3007828654, -0.3113012820, -0.0163147004, -0.7254469968, -0.4135638984, -0.1418970546, -0.1542832637, -0.0897662917, -0.1664547090, -0.1292762574, 0.3217505544, 0.1476675438, -0.4636476090, -0.3007828654, 0.0349940022, -0.2687494608, 0.3217505544, -0.1784290543, 0.1476675438, -0.1784290543, -0.3934169016, -0.0617464495, -0.2795136623, 0.1476675438, -0.3833022825, -0.5745548442, -0.4636476090, -0.2133202528, -0.1418970546, 0.0962371485, -0.0471124298, -0.1542832637, -0.3007828654, 0.0962371485, 0.3217505544, -0.2246500097, 0.0742834912, -0.4736482758, -0.0163147004, -0.0759488607, -0.0897662917, -0.2133202528, -0.3629686486, -0.6803702690, 0.3217505544, -0.4736482758, -0.1542832637, 0.0349940022, 0.1203926336, -0.0759488607, -0.2469249490, -0.3217505544, 0.0962371485, -0.3113012820, 0.0962371485, -0.0617464495, 0.3217505544, 0.3217505544, -0.3217505544, -0.2246500097, -0.4636476090, -0.0319910515, -0.3629686486, 0.0349940022, -0.4035026678, 0.1203926336, -0.1664547090, -0.0319910515, 0.1798534998, -0.2133202528, -0.2578891860, 0.3217505544, -0.1902221337, -0.1418970546, -0.0617464495, 0.3217505544, 0.3217505544, -0.3629686486, -0.5643265694, 0.3217505544, 0.1798534998, 0.3217505544, 2.3555445368, 1.9926624244, 2.3736593061, 2.9190378763, 3.6581520481, 2.1032138028, 2.1032138028, 2.4651731940, 3.1772296468, 2.5975710929, 2.7386118812, 2.1575658649, 2.5590638341, 2.8254072363, 2.4467173073, 2.7177305827, 2.0666931181, 2.6971259800, 2.6367695027, 2.1032138028, 2.8948412982, 2.4837233488, 2.8254072363, 3.0228064077, 2.4651731940, 2.5400367695, 2.5211449286, 3.0509622740, 1.7773091174, 2.3374738352, 2.8254072363, 2.8031607043, 2.9190378763, 2.7812999037, 2.8480751055, 3.6581520481, 3.3454863056, 2.2475198501, 2.5400367695, 3.1431164338, 2.5975710929, 3.6581520481, 2.7597931090, 3.3454863056, 2.7597931090, 2.3736593061, 2.9693635497, 2.5782378045, 3.3454863056, 2.3918258973, 2.0483223929, 2.2475198501, 2.6971259800, 2.8254072363, 3.2531135768, 2.9956473130, 2.8031607043, 2.5400367695, 3.2531135768, 3.6581520481, 2.6767769129, 3.2136832124, 2.2295579255, 3.0509622740, 2.9438549868, 2.9190378763, 2.6971259800, 2.4283465821, 1.8582701974, 3.6581520481, 2.2295579255, 2.8031607043, 3.1431164338, 3.2964985841, 2.9438549868, 2.6367695027, 2.5023772757, 3.2531135768, 2.5211449286, 3.2531135768, 2.9693635497, 3.6581520481, 3.6581520481, 2.5023772757, 2.6767769129, 2.2475198501, 3.0228064077, 2.4283465821, 3.1431164338, 2.3555445368, 3.2964985841, 2.7812999037, 3.0228064077, 3.4032946224, 2.6971259800, 2.6170769360, 3.6581520481, 2.7386118812, 2.8254072363, 2.9693635497, 3.6581520481, 3.6581520481, 2.4283465821, 2.0666931181, 3.6581520481, 3.4032946224, 3.6581520481, -0.7461066244, -0.2009029552, -0.5818998369, -0.9731277272, -1.7122418990, -0.0237722611, -0.0237722611, -0.2679486167, -0.9800050694, -0.4003465156, -0.5413873038, 0.0396587124, -0.2564787411, -0.5228221433, -0.1441322143, -0.4151454897, 0.2358919749, -0.3945408870, -0.3341844097, 0.2946814700, -0.4969460254, -0.0858280760, -0.4275119635, -0.6249111349, -0.0672779212, -0.1421414967, -0.0362382788, -0.5660556242, 0.7075975324, 0.2274755222, -0.2604578788, -0.2382113469, -0.3540885188, -0.1422425741, -0.2090177759, -1.0190947185, -0.7064289759, 0.3915374795, 0.0990205601, -0.4350662327, 0.1104791082, -0.9501018470, -0.0517429079, -0.5728975833, 0.0127956132, 0.3989294162, -0.1967748275, 0.1943509178, -0.5728975833, 0.3807628249, 0.7242663294, 0.5856934940, 0.1360873641, 0.0078061078, -0.4199002327, -0.1624339689, 0.0300526397, 0.2931765745, -0.4199002327, -0.7677802902, 0.2135948450, -0.3233114545, 0.6608138324, -0.1605905161, -0.0534832289, -0.0286661184, 0.1932457779, 0.4620251758, 1.0861687817, -0.7137130689, 0.7148810537, 0.1412782748, -0.1986774546, -0.3007663106, 0.0518772868, 0.3589627709, 0.5421451620, -0.2085911391, 0.5698975248, -0.1620711234, 0.1661306662, -0.4800982177, -0.4800982177, 0.6756765546, 0.5420989120, 0.9713559748, 0.2352901303, 0.8297499560, 0.1149801042, 0.9025520012, -0.0006617181, 0.5145369623, 0.3093981024, -0.0710901123, 0.6350785302, 0.7502188940, -0.2569546664, 0.6953753233, 0.6085799682, 0.4646236548, -0.1616444866, -0.1616444866, 1.0681609794, 1.4886549434, 0.2336682500, 0.6040385628, 0.5315026939, 0.8847177874, 0.7041572318, 1.0851541134, 1.7846833634, 2.5237975352, 1.1023906826, 1.1023906826, 1.5821331094, 2.2941895622, 1.7145310084, 1.8555717966, 1.2745257803, 1.7813842652, 2.0477276674, 1.6690377384, 1.9400510138, 1.2890135492, 1.9194464111, 1.8590899338, 1.4208444137, 2.2124719091, 1.8013539597, 2.1430378472, 2.3404370186, 1.7828038049, 1.8576673804, 1.9257869165, 2.4556042619, 1.1819511053, 1.8221585308, 2.3100919318, 2.2878453999, 2.4037225718, 2.3400925714, 2.4068677733, 3.2169447158, 2.9042789733, 1.8063125178, 2.0988294373, 2.7709019730, 2.2253566321, 3.2859375873, 2.3875786482, 3.0378103659, 2.4521171694, 2.0659833664, 2.6616876101, 2.2705618648, 3.0378103659, 2.0841499577, 1.7406464532, 2.0004685322, 2.4500746622, 2.5783559184, 3.0060622590, 2.7485959951, 2.5561093865, 2.2929854517, 3.0060622590, 3.4682591441, 2.4868840089, 3.0237903084, 2.0396650215, 2.8610693700, 2.7539620828, 2.7291449723, 2.5072330760, 2.2384536781, 1.7224445147, 3.5223263654, 2.0937322428, 2.6673350216, 3.0072907511, 3.2119661958, 2.8593225984, 2.5522371144, 2.4666350515, 3.2173713526, 2.5319227200, 3.2638913683, 3.0245931037, 3.7559412165, 3.7559412165, 2.6001664442, 2.8153880759, 2.3861310130, 3.2006382839, 2.6061784582, 3.3209483099, 2.5333764130, 3.5120707882, 2.9968721078, 3.2747462560, 3.6552344707, 2.9490658283, 2.9041081041, 3.9790847678, 3.0923344238, 3.1791297788, 3.3230860923, 4.0743949477, 4.0743949477, 2.8445894816, 2.5417765177, 4.4697076843, 4.3303631458, 4.7675421282

4.2. Fit multiple ALCC models with mapping

# Run multiple examples at once with map()
fit_examples = data.all %>%
  mutate(modALCC = map(data, ~ modALCC(RY = .$RY, STV = .$STV, target=90, confidence = 0.95))) %>% 
  unnest(., cols = c("modALCC"))
## Warning: 7 STV points exceeded two-times (2x) 
##   the CSTV for 90%. Risk of leverage. You may consider a sensitivity analysis by 
##   removing extreme points, re-run the modALCC(), and check results.

## Warning: 9 STV points exceeded the CSTV for 100%.
##   Risk of leverage. You may consider a sensitivity analysis by removing extreme points, 
##   re-run the modALCC(), and check results.

## Warning: 22 STV points exceeded two-times (2x) 
##   the CSTV for 90%. Risk of leverage. You may consider a sensitivity analysis by 
##   removing extreme points, re-run the modALCC(), and check results.

## Warning: 3 STV points exceeded the CSTV for 100%.
##   Risk of leverage. You may consider a sensitivity analysis by removing extreme points, 
##   re-run the modALCC(), and check results.

## Warning: 3 STV points exceeded two-times (2x) 
##   the CSTV for 90%. Risk of leverage. You may consider a sensitivity analysis by 
##   removing extreme points, re-run the modALCC(), and check results.
head(fit_examples)
## # A tibble: 3 x 16
##   id    data         n     r target  CSTV    LL    UL confidence  p_value CSTV90
##   <chr> <list>   <int> <dbl>  <dbl> <dbl> <dbl> <dbl>      <dbl>    <dbl>  <dbl>
## 1 1     <tibble>    15 0.968     90  4.48  3.95  5.08       0.95 3.30e- 9   4.48
## 2 2     <tibble>   137 0.716     90 23.3  21.6  25.1        0.95 7.31e-23  23.3 
## 3 3     <tibble>   107 0.374     90 21.8  19.4  24.5        0.95 7.41e- 5  21.8 
## # ... with 5 more variables: n.90x2 <int>, CSTV100 <dbl>, n.100 <int>,
## #   Curve <list>, SMA <list>
# Alternative with group_map, this does not required nested data.
fit_all = bind_rows(data_1, data_2, data_3, .id = "id") %>% 
  group_by(id) %>% 
  group_map(~ modALCC(data = ., RY = RY, STV = STV, target = 90, confidence = 0.95))
## Warning: 7 STV points exceeded two-times (2x) 
##   the CSTV for 90%. Risk of leverage. You may consider a sensitivity analysis by 
##   removing extreme points, re-run the modALCC(), and check results.

## Warning: 9 STV points exceeded the CSTV for 100%.
##   Risk of leverage. You may consider a sensitivity analysis by removing extreme points, 
##   re-run the modALCC(), and check results.

## Warning: 22 STV points exceeded two-times (2x) 
##   the CSTV for 90%. Risk of leverage. You may consider a sensitivity analysis by 
##   removing extreme points, re-run the modALCC(), and check results.

## Warning: 3 STV points exceeded the CSTV for 100%.
##   Risk of leverage. You may consider a sensitivity analysis by removing extreme points, 
##   re-run the modALCC(), and check results.

## Warning: 3 STV points exceeded two-times (2x) 
##   the CSTV for 90%. Risk of leverage. You may consider a sensitivity analysis by 
##   removing extreme points, re-run the modALCC(), and check results.
head(fit_all)
## [[1]]
##    n         r target     CSTV       LL       UL confidence      p_value
## 1 15 0.9682908     90 4.478476 3.947041 5.081463       0.95 3.296044e-09
##     CSTV90 n.90x2  CSTV100 n.100
## 1 4.478476      7 19.15054     0
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Curve
## 1 65.000000, 65.200000, 65.400000, 65.600000, 65.800000, 66.000000, 66.200000, 66.400000, 66.600000, 66.800000, 67.000000, 67.200000, 67.400000, 67.600000, 67.800000, 68.000000, 68.200000, 68.400000, 68.600000, 68.800000, 69.000000, 69.200000, 69.400000, 69.600000, 69.800000, 70.000000, 70.200000, 70.400000, 70.600000, 70.800000, 71.000000, 71.200000, 71.400000, 71.600000, 71.800000, 72.000000, 72.200000, 72.400000, 72.600000, 72.800000, 73.000000, 73.200000, 73.400000, 73.600000, 73.800000, 74.000000, 74.200000, 74.400000, 74.600000, 74.800000, 75.000000, 75.200000, 75.400000, 75.600000, 75.800000, 76.000000, 76.200000, 76.400000, 76.600000, 76.800000, 77.000000, 77.200000, 77.400000, 77.600000, 77.800000, 78.000000, 78.200000, 78.400000, 78.600000, 78.800000, 79.000000, 79.200000, 79.400000, 79.600000, 79.800000, 80.000000, 80.200000, 80.400000, 80.600000, 80.800000, 81.000000, 81.200000, 81.400000, 81.600000, 81.800000, 82.000000, 82.200000, 82.400000, 82.600000, 82.800000, 83.000000, 83.200000, 83.400000, 83.600000, 83.800000, 84.000000, 84.200000, 84.400000, 84.600000, 84.800000, 85.000000, 85.200000, 85.400000, 85.600000, 85.800000, 86.000000, 86.200000, 86.400000, 86.600000, 86.800000, 87.000000, 87.200000, 87.400000, 87.600000, 87.800000, 88.000000, 88.200000, 88.400000, 88.600000, 88.800000, 89.000000, 89.200000, 89.400000, 89.600000, 89.800000, 90.000000, 90.200000, 90.400000, 90.600000, 90.800000, 91.000000, 91.200000, 91.400000, 91.600000, 91.800000, 92.000000, 92.200000, 92.400000, 92.600000, 92.800000, 93.000000, 93.200000, 93.400000, 93.600000, 93.800000, 94.000000, 94.200000, 94.400000, 94.600000, 94.800000, 95.000000, 95.200000, 95.400000, 95.600000, 95.800000, 96.000000, 96.200000, 96.400000, 96.600000, 96.800000, 97.000000, 97.200000, 97.400000, 97.600000, 97.800000, 98.000000, 98.200000, 98.400000, 98.600000, 98.800000, 99.000000, 99.200000, 99.400000, 99.600000, 99.800000, 100.000000, 1.097927, 1.108379, 1.118944, 1.129625, 1.140423, 1.151339, 1.162376, 1.173535, 1.184817, 1.196225, 1.207760, 1.219425, 1.231221, 1.243150, 1.255214, 1.267415, 1.279755, 1.292236, 1.304860, 1.317630, 1.330548, 1.343616, 1.356836, 1.370210, 1.383742, 1.397433, 1.411286, 1.425303, 1.439488, 1.453842, 1.468369, 1.483071, 1.497951, 1.513012, 1.528257, 1.543689, 1.559311, 1.575127, 1.591138, 1.607350, 1.623765, 1.640386, 1.657217, 1.674262, 1.691525, 1.709008, 1.726717, 1.744655, 1.762826, 1.781234, 1.799883, 1.818779, 1.837924, 1.857325, 1.876985, 1.896910, 1.917103, 1.937572, 1.958319, 1.979352, 2.000675, 2.022293, 2.044214, 2.066441, 2.088983, 2.111844, 2.135031, 2.158551, 2.182410, 2.206616, 2.231175, 2.256095, 2.281384, 2.307048, 2.333097, 2.359537, 2.386379, 2.413629, 2.441298, 2.469395, 2.497929, 2.526910, 2.556347, 2.586252, 2.616636, 2.647508, 2.678882, 2.710768, 2.743179, 2.776127, 2.809626, 2.843690, 2.878331, 2.913565, 2.949407, 2.985872, 3.022976, 3.060736, 3.099169, 3.138294, 3.178128, 3.218691, 3.260004, 3.302086, 3.344960, 3.388649, 3.433176, 3.478564, 3.524841, 3.572032, 3.620165, 3.669269, 3.719374, 3.770512, 3.822716, 3.876020, 3.930460, 3.986075, 4.042904, 4.100988, 4.160372, 4.221100, 4.283223, 4.346790, 4.411856, 4.478476, 4.546710, 4.616622, 4.688278, 4.761749, 4.837110, 4.914440, 4.993823, 5.075351, 5.159117, 5.245225, 5.333784, 5.424910, 5.518728, 5.615374, 5.714992, 5.817737, 5.923779, 6.033299, 6.146495, 6.263582, 6.384794, 6.510388, 6.640644, 6.775870, 6.916408, 7.062634, 7.214969, 7.373879, 7.539891, 7.713596, 7.895664, 8.086860, 8.288063, 8.500287, 8.724716, 8.962742, 9.216022, 9.486552, 9.776766, 10.089688, 10.429142, 10.800084, 11.209119, 11.665380, 12.182103, 12.779738, 13.492946, 14.389790, 15.647308, 19.150544
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             SMA
## 1 0.00000000, 0.69314718, 1.09861229, 1.38629436, 1.60943791, 1.79175947, 1.94591015, 2.07944154, 2.19722458, 2.30258509, 2.39789527, 2.48490665, 2.56494936, 2.63905733, 2.70805020, -0.31130128, -0.14189705, -0.07594886, -0.03199105, 0.00000000, 0.07428349, 0.05398723, 0.12039263, 0.14766754, 0.09623715, 0.17985350, 0.32175055, 0.22158313, 0.22158313, 0.32175055, 0.09342397, 0.85846552, 1.15629226, 1.35480886, 1.49928272, 1.83475226, 1.74309289, 2.04298443, 2.16615987, 1.93389654, 2.31151393, 2.95233114, 2.49996793, 2.49996793, 2.95233114, -0.09342397, -0.16531834, -0.05767997, 0.03148550, 0.11015519, -0.04299279, 0.20281726, 0.03645711, 0.03106471, 0.36868855, 0.08638134, -0.46742449, 0.06498143, 0.13908940, -0.24428093, -1.40585875, 0.05232998, 0.75562183, 1.24182049, 1.60943791, 2.12722900, 2.18972031, 2.62314325, 2.86410172, 2.73719891, 3.21012648, 3.93795506, 3.56563456, 3.63974254, 4.16109861
## 
## [[2]]
##     n         r target     CSTV       LL       UL confidence      p_value
## 1 137 0.7164928     90 23.25457 21.57156 25.06888       0.95 7.314913e-23
##     CSTV90 n.90x2  CSTV100 n.100
## 1 23.25457     22 53.10299     9
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Curve
## 1 12.000000, 12.200000, 12.400000, 12.600000, 12.800000, 13.000000, 13.200000, 13.400000, 13.600000, 13.800000, 14.000000, 14.200000, 14.400000, 14.600000, 14.800000, 15.000000, 15.200000, 15.400000, 15.600000, 15.800000, 16.000000, 16.200000, 16.400000, 16.600000, 16.800000, 17.000000, 17.200000, 17.400000, 17.600000, 17.800000, 18.000000, 18.200000, 18.400000, 18.600000, 18.800000, 19.000000, 19.200000, 19.400000, 19.600000, 19.800000, 20.000000, 20.200000, 20.400000, 20.600000, 20.800000, 21.000000, 21.200000, 21.400000, 21.600000, 21.800000, 22.000000, 22.200000, 22.400000, 22.600000, 22.800000, 23.000000, 23.200000, 23.400000, 23.600000, 23.800000, 24.000000, 24.200000, 24.400000, 24.600000, 24.800000, 25.000000, 25.200000, 25.400000, 25.600000, 25.800000, 26.000000, 26.200000, 26.400000, 26.600000, 26.800000, 27.000000, 27.200000, 27.400000, 27.600000, 27.800000, 28.000000, 28.200000, 28.400000, 28.600000, 28.800000, 29.000000, 29.200000, 29.400000, 29.600000, 29.800000, 30.000000, 30.200000, 30.400000, 30.600000, 30.800000, 31.000000, 31.200000, 31.400000, 31.600000, 31.800000, 32.000000, 32.200000, 32.400000, 32.600000, 32.800000, 33.000000, 33.200000, 33.400000, 33.600000, 33.800000, 34.000000, 34.200000, 34.400000, 34.600000, 34.800000, 35.000000, 35.200000, 35.400000, 35.600000, 35.800000, 36.000000, 36.200000, 36.400000, 36.600000, 36.800000, 37.000000, 37.200000, 37.400000, 37.600000, 37.800000, 38.000000, 38.200000, 38.400000, 38.600000, 38.800000, 39.000000, 39.200000, 39.400000, 39.600000, 39.800000, 40.000000, 40.200000, 40.400000, 40.600000, 40.800000, 41.000000, 41.200000, 41.400000, 41.600000, 41.800000, 42.000000, 42.200000, 42.400000, 42.600000, 42.800000, 43.000000, 43.200000, 43.400000, 43.600000, 43.800000, 44.000000, 44.200000, 44.400000, 44.600000, 44.800000, 45.000000, 45.200000, 45.400000, 45.600000, 45.800000, 46.000000, 46.200000, 46.400000, 46.600000, 46.800000, 47.000000, 47.200000, 47.400000, 47.600000, 47.800000, 48.000000, 48.200000, 48.400000, 48.600000, 48.800000, 49.000000, 49.200000, 49.400000, 49.600000, 49.800000, 50.000000, 50.200000, 50.400000, 50.600000, 50.800000, 51.000000, 51.200000, 51.400000, 51.600000, 51.800000, 52.000000, 52.200000, 52.400000, 52.600000, 52.800000, 53.000000, 53.200000, 53.400000, 53.600000, 53.800000, 54.000000, 54.200000, 54.400000, 54.600000, 54.800000, 55.000000, 55.200000, 55.400000, 55.600000, 55.800000, 56.000000, 56.200000, 56.400000, 56.600000, 56.800000, 57.000000, 57.200000, 57.400000, 57.600000, 57.800000, 58.000000, 58.200000, 58.400000, 58.600000, 58.800000, 59.000000, 59.200000, 59.400000, 59.600000, 59.800000, 60.000000, 60.200000, 60.400000, 60.600000, 60.800000, 61.000000, 61.200000, 61.400000, 61.600000, 61.800000, 62.000000, 62.200000, 62.400000, 62.600000, 62.800000, 63.000000, 63.200000, 63.400000, 63.600000, 63.800000, 64.000000, 64.200000, 64.400000, 64.600000, 64.800000, 65.000000, 65.200000, 65.400000, 65.600000, 65.800000, 66.000000, 66.200000, 66.400000, 66.600000, 66.800000, 67.000000, 67.200000, 67.400000, 67.600000, 67.800000, 68.000000, 68.200000, 68.400000, 68.600000, 68.800000, 69.000000, 69.200000, 69.400000, 69.600000, 69.800000, 70.000000, 70.200000, 70.400000, 70.600000, 70.800000, 71.000000, 71.200000, 71.400000, 71.600000, 71.800000, 72.000000, 72.200000, 72.400000, 72.600000, 72.800000, 73.000000, 73.200000, 73.400000, 73.600000, 73.800000, 74.000000, 74.200000, 74.400000, 74.600000, 74.800000, 75.000000, 75.200000, 75.400000, 75.600000, 75.800000, 76.000000, 76.200000, 76.400000, 76.600000, 76.800000, 77.000000, 77.200000, 77.400000, 77.600000, 77.800000, 78.000000, 78.200000, 78.400000, 78.600000, 78.800000, 79.000000, 79.200000, 79.400000, 79.600000, 79.800000, 80.000000, 80.200000, 80.400000, 80.600000, 80.800000, 81.000000, 81.200000, 81.400000, 81.600000, 81.800000, 82.000000, 82.200000, 82.400000, 82.600000, 82.800000, 83.000000, 83.200000, 83.400000, 83.600000, 83.800000, 84.000000, 84.200000, 84.400000, 84.600000, 84.800000, 85.000000, 85.200000, 85.400000, 85.600000, 85.800000, 86.000000, 86.200000, 86.400000, 86.600000, 86.800000, 87.000000, 87.200000, 87.400000, 87.600000, 87.800000, 88.000000, 88.200000, 88.400000, 88.600000, 88.800000, 89.000000, 89.200000, 89.400000, 89.600000, 89.800000, 90.000000, 90.200000, 90.400000, 90.600000, 90.800000, 91.000000, 91.200000, 91.400000, 91.600000, 91.800000, 92.000000, 92.200000, 92.400000, 92.600000, 92.800000, 93.000000, 93.200000, 93.400000, 93.600000, 93.800000, 94.000000, 94.200000, 94.400000, 94.600000, 94.800000, 95.000000, 95.200000, 95.400000, 95.600000, 95.800000, 96.000000, 96.200000, 96.400000, 96.600000, 96.800000, 97.000000, 97.200000, 97.400000, 97.600000, 97.800000, 98.000000, 98.200000, 98.400000, 98.600000, 98.800000, 99.000000, 99.200000, 99.400000, 99.600000, 99.800000, 100.000000, 2.336883, 2.355345, 2.373822, 2.392314, 2.410824, 2.429353, 2.447902, 2.466472, 2.485066, 2.503683, 2.522326, 2.540994, 2.559691, 2.578416, 2.597171, 2.615957, 2.634775, 2.653625, 2.672510, 2.691430, 2.710385, 2.729377, 2.748407, 2.767476, 2.786584, 2.805733, 2.824922, 2.844155, 2.863430, 2.882748, 2.902112, 2.921521, 2.940976, 2.960478, 2.980028, 2.999627, 3.019275, 3.038973, 3.058722, 3.078522, 3.098374, 3.118280, 3.138239, 3.158253, 3.178322, 3.198446, 3.218628, 3.238866, 3.259162, 3.279517, 3.299931, 3.320405, 3.340940, 3.361536, 3.382194, 3.402915, 3.423698, 3.444546, 3.465459, 3.486436, 3.507480, 3.528590, 3.549767, 3.571012, 3.592326, 3.613709, 3.635161, 3.656685, 3.678279, 3.699945, 3.721683, 3.743495, 3.765380, 3.787340, 3.809375, 3.831485, 3.853672, 3.875936, 3.898277, 3.920697, 3.943195, 3.965774, 3.988432, 4.011172, 4.033993, 4.056896, 4.079883, 4.102953, 4.126107, 4.149347, 4.172672, 4.196083, 4.219582, 4.243168, 4.266843, 4.290606, 4.314460, 4.338404, 4.362439, 4.386567, 4.410787, 4.435100, 4.459507, 4.484009, 4.508607, 4.533301, 4.558092, 4.582980, 4.607967, 4.633054, 4.658240, 4.683527, 4.708916, 4.734406, 4.760000, 4.785698, 4.811500, 4.837408, 4.863422, 4.889542, 4.915771, 4.942108, 4.968555, 4.995111, 5.021779, 5.048559, 5.075451, 5.102457, 5.129578, 5.156813, 5.184165, 5.211634, 5.239220, 5.266926, 5.294751, 5.322696, 5.350763, 5.378953, 5.407266, 5.435703, 5.464265, 5.492953, 5.521768, 5.550712, 5.579784, 5.608986, 5.638319, 5.667784, 5.697382, 5.727114, 5.756981, 5.786984, 5.817124, 5.847402, 5.877819, 5.908377, 5.939075, 5.969916, 6.000901, 6.032030, 6.063304, 6.094726, 6.126295, 6.158014, 6.189883, 6.221903, 6.254076, 6.286402, 6.318884, 6.351522, 6.384317, 6.417271, 6.450385, 6.483660, 6.517098, 6.550699, 6.584466, 6.618399, 6.652499, 6.686769, 6.721209, 6.755821, 6.790607, 6.825566, 6.860702, 6.896016, 6.931508, 6.967181, 7.003035, 7.039073, 7.075296, 7.111705, 7.148302, 7.185089, 7.222066, 7.259237, 7.296601, 7.334162, 7.371920, 7.409878, 7.448036, 7.486397, 7.524963, 7.563734, 7.602714, 7.641903, 7.681304, 7.720918, 7.760747, 7.800794, 7.841059, 7.881546, 7.922255, 7.963189, 8.004350, 8.045739, 8.087360, 8.129213, 8.171302, 8.213628, 8.256193, 8.298999, 8.342049, 8.385345, 8.428890, 8.472684, 8.516732, 8.561034, 8.605594, 8.650414, 8.695497, 8.740844, 8.786458, 8.832342, 8.878499, 8.924930, 8.971640, 9.018629, 9.065902, 9.113461, 9.161308, 9.209446, 9.257879, 9.306609, 9.355639, 9.404972, 9.454611, 9.504560, 9.554821, 9.605397, 9.656292, 9.707509, 9.759051, 9.810922, 9.863125, 9.915663, 9.968541, 10.021761, 10.075327, 10.129242, 10.183511, 10.238138, 10.293126, 10.348478, 10.404200, 10.460295, 10.516766, 10.573619, 10.630857, 10.688485, 10.746507, 10.804928, 10.863751, 10.922982, 10.982625, 11.042685, 11.103166, 11.164074, 11.225413, 11.287189, 11.349407, 11.412071, 11.475188, 11.538762, 11.602799, 11.667304, 11.732284, 11.797744, 11.863690, 11.930128, 11.997064, 12.064504, 12.132455, 12.200922, 12.269914, 12.339435, 12.409494, 12.480096, 12.551250, 12.622962, 12.695240, 12.768091, 12.841522, 12.915543, 12.990159, 13.065381, 13.141215, 13.217670, 13.294756, 13.372480, 13.450851, 13.529880, 13.609574, 13.689945, 13.771001, 13.852752, 13.935209, 14.018381, 14.102280, 14.186917, 14.272302, 14.358448, 14.445364, 14.533064, 14.621560, 14.710863, 14.800987, 14.891945, 14.983749, 15.076415, 15.169955, 15.264384, 15.359717, 15.455968, 15.553154, 15.651289, 15.750391, 15.850475, 15.951559, 16.053661, 16.156798, 16.260989, 16.366253, 16.472609, 16.580077, 16.688679, 16.798434, 16.909365, 17.021495, 17.134845, 17.249441, 17.365306, 17.482466, 17.600946, 17.720773, 17.841975, 17.964580, 18.088618, 18.214118, 18.341112, 18.469631, 18.599711, 18.731384, 18.864686, 18.999655, 19.136328, 19.274745, 19.414946, 19.556974, 19.700873, 19.846689, 19.994468, 20.144260, 20.296115, 20.450087, 20.606231, 20.764604, 20.925266, 21.088278, 21.253707, 21.421618, 21.592084, 21.765177, 21.940974, 22.119557, 22.301010, 22.485420, 22.672882, 22.863491, 23.057350, 23.254567, 23.455255, 23.659532, 23.867524, 24.079364, 24.295192, 24.515156, 24.739412, 24.968128, 25.201479, 25.439655, 25.682855, 25.931293, 26.185196, 26.444810, 26.710396, 26.982235, 27.260631, 27.545908, 27.838422, 28.138553, 28.446718, 28.763369, 29.089000, 29.424154, 29.769426, 30.125473, 30.493024, 30.872890, 31.265974, 31.673293, 32.095997, 32.535388, 32.992958, 33.470424, 33.969784, 34.493376, 35.043972, 35.624899, 36.240199, 36.894871, 37.595217, 38.349366, 39.168111, 40.066313, 41.065417, 42.198418, 43.520998, 45.142004, 47.343203, 53.102988
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                SMA
## 1 1.386294361, 1.609437912, 1.791759469, 1.791759469, 1.945910149, 1.945910149, 2.197224577, 2.197224577, 2.302585093, 2.302585093, 2.302585093, 2.302585093, 2.397895273, 2.397895273, 2.484906650, 2.564949357, 2.564949357, 2.564949357, 2.564949357, 2.564949357, 2.639057330, 2.639057330, 2.639057330, 2.639057330, 2.639057330, 2.708050201, 2.708050201, 2.708050201, 2.708050201, 2.708050201, 2.772588722, 2.772588722, 2.772588722, 2.772588722, 2.772588722, 2.833213344, 2.833213344, 2.833213344, 2.833213344, 2.890371758, 2.890371758, 2.890371758, 2.890371758, 2.944438979, 2.944438979, 2.944438979, 2.944438979, 2.995732274, 2.995732274, 3.044522438, 3.044522438, 3.044522438, 3.044522438, 3.044522438, 3.044522438, 3.091042453, 3.091042453, 3.091042453, 3.091042453, 3.091042453, 3.091042453, 3.135494216, 3.135494216, 3.135494216, 3.178053830, 3.178053830, 3.178053830, 3.218875825, 3.218875825, 3.218875825, 3.218875825, 3.258096538, 3.258096538, 3.295836866, 3.295836866, 3.295836866, 3.295836866, 3.332204510, 3.332204510, 3.332204510, 3.367295830, 3.401197382, 3.401197382, 3.433987204, 3.433987204, 3.526360525, 3.555348061, 3.555348061, 3.555348061, 3.583518938, 3.583518938, 3.583518938, 3.610917913, 3.610917913, 3.610917913, 3.610917913, 3.637586160, 3.637586160, 3.663561646, 3.663561646, 3.713572067, 3.713572067, 3.713572067, 3.713572067, 3.737669618, 3.737669618, 3.737669618, 3.737669618, 3.737669618, 3.761200116, 3.784189634, 3.784189634, 3.806662490, 3.806662490, 3.828641396, 3.850147602, 3.850147602, 3.871201011, 3.871201011, 3.891820298, 3.912023005, 3.912023005, 3.912023005, 3.912023005, 3.912023005, 3.931825633, 3.931825633, 3.951243719, 3.988984047, 3.988984047, 3.988984047, 3.988984047, 4.007333185, 4.007333185, 4.007333185, 4.025351691, 4.025351691, -0.895304167, -0.473648276, -0.246924949, -0.413563898, -0.061746450, -0.311301282, -0.016314700, -0.103238229, -0.154283264, -0.141897055, -0.141897055, -0.075948861, -0.383302283, -0.554140835, 0.017057900, -0.257889186, -0.235848272, -0.190222134, -0.311301282, -0.031991051, -0.047112430, -0.463647609, -0.178429054, -0.201848221, -0.075948861, -0.332136508, -0.116398476, -0.246924949, -0.213320253, -0.178429054, -0.103238229, 0.000000000, -0.089766292, -0.383302283, -0.166454709, 0.321750554, -0.213320253, -0.047112430, -0.154283264, -0.141897055, 0.017057900, -0.089766292, -0.224650010, 0.221583133, -0.075948861, -0.190222134, 0.179853500, -0.178429054, -0.342464683, 0.120392634, -0.166454709, 0.096237148, -0.352740374, -0.047112430, 0.321750554, -0.075948861, -0.129276257, -0.047112430, -0.332136508, 0.017057900, 0.321750554, 0.179853500, -0.268749461, 0.321750554, 0.321750554, 0.221583133, 0.321750554, -0.116398476, 0.000000000, 0.017057900, -0.129276257, -0.075948861, 0.147667544, 0.321750554, 0.321750554, 0.221583133, 0.053987227, 0.120392634, 0.034994002, -0.089766292, 0.147667544, 0.321750554, 0.120392634, 0.321750554, 0.074283491, 0.179853500, 0.321750554, 0.034994002, 0.120392634, 0.221583133, 0.147667544, 0.017057900, 0.221583133, 0.074283491, 0.179853500, -0.031991051, 0.074283491, 0.034994002, 0.179853500, 0.053987227, 0.179853500, 0.321750554, 0.321750554, 0.179853500, 0.321750554, 0.179853500, -0.031991051, 0.321750554, 0.074283491, 0.221583133, 0.179853500, 0.074283491, -0.031991051, 0.120392634, -0.047112430, 0.096237148, 0.096237148, 0.120392634, 0.053987227, 0.096237148, 0.321750554, 0.321750554, 0.321750554, 0.179853500, 0.321750554, 0.321750554, 0.321750554, 0.034994002, 0.321750554, 0.147667544, 0.221583133, 0.179853500, 0.321750554, 0.147667544, 0.034994002, 0.321750554, 0.179853500, 0.848817889, 1.930943814, 2.512800241, 2.085142686, 2.988037180, 2.347586614, 3.104631955, 2.881553835, 2.750553280, 2.782340901, 2.782340901, 2.951588508, 2.162805253, 1.724369955, 3.190278467, 2.484661929, 2.541227115, 2.658320765, 2.347586614, 3.064400604, 3.025593520, 1.956609247, 2.688586196, 2.628483898, 2.951588508, 2.294115672, 2.847779742, 2.512800241, 2.599042396, 2.688586196, 2.881553835, 3.146501547, 2.916127838, 2.162805253, 2.719316822, 3.972233202, 2.599042396, 3.025593520, 2.750553280, 2.782340901, 3.190278467, 2.916127838, 2.569966024, 3.715166324, 2.951588508, 2.658320765, 3.608072556, 2.688586196, 2.267609729, 3.455473846, 2.719316822, 3.393481883, 2.241238484, 3.025593520, 3.972233202, 2.951588508, 2.814730564, 3.025593520, 2.294115672, 3.190278467, 3.972233202, 3.608072556, 2.456790422, 3.972233202, 3.972233202, 3.715166324, 3.972233202, 2.847779742, 3.146501547, 3.190278467, 2.814730564, 2.951588508, 3.525471415, 3.972233202, 3.972233202, 3.715166324, 3.285052862, 3.455473846, 3.236309179, 2.916127838, 3.525471415, 3.972233202, 3.455473846, 3.972233202, 3.337140628, 3.608072556, 3.972233202, 3.236309179, 3.455473846, 3.715166324, 3.525471415, 3.190278467, 3.715166324, 3.337140628, 3.608072556, 3.064400604, 3.337140628, 3.236309179, 3.608072556, 3.285052862, 3.608072556, 3.972233202, 3.972233202, 3.608072556, 3.972233202, 3.608072556, 3.064400604, 3.972233202, 3.337140628, 3.715166324, 3.608072556, 3.337140628, 3.064400604, 3.455473846, 3.025593520, 3.393481883, 3.393481883, 3.455473846, 3.285052862, 3.393481883, 3.972233202, 3.972233202, 3.972233202, 3.608072556, 3.972233202, 3.972233202, 3.972233202, 3.236309179, 3.972233202, 3.525471415, 3.715166324, 3.608072556, 3.972233202, 3.525471415, 3.236309179, 3.972233202, 3.608072556, 0.537476472, -0.321505902, -0.721040772, -0.293383216, -1.042127031, -0.401676465, -0.907407377, -0.684329258, -0.447968187, -0.479755808, -0.479755808, -0.649003415, 0.235090020, 0.673525318, -0.705371817, 0.080287429, 0.023722242, -0.093371408, 0.217362743, -0.499451247, -0.386536191, 0.682448083, -0.049528866, 0.010573431, -0.312531178, 0.413934529, -0.139729541, 0.195249960, 0.109007805, 0.019464006, -0.108965113, -0.373912825, -0.143539116, 0.609783469, 0.053271901, -1.139019858, 0.234170948, -0.192380176, 0.082660064, 0.108030857, -0.299906709, -0.025756080, 0.320405734, -0.770727345, -0.007149529, 0.286118214, -0.663633577, 0.307146078, 0.728122544, -0.410951409, 0.325205616, -0.348959445, 0.803283954, 0.018928917, -0.927710764, 0.139453945, 0.276311890, 0.065448933, 0.796926781, -0.099236014, -0.881190748, -0.472578340, 0.678703794, -0.836738986, -0.794179371, -0.537112494, -0.794179371, 0.371096083, 0.072374278, 0.028597358, 0.404145261, 0.306508030, -0.267374877, -0.676396336, -0.676396336, -0.419329458, 0.010784004, -0.123269336, 0.095895331, 0.416076672, -0.158175585, -0.571035820, -0.054276465, -0.538245997, 0.096846576, -0.081712031, -0.416885140, 0.319038883, 0.099874215, -0.131647386, 0.058047523, 0.393240471, -0.104248411, 0.273777284, 0.002845357, 0.546517308, 0.300445531, 0.401276981, 0.055489090, 0.378508784, 0.105499511, -0.258661135, -0.258661135, 0.105499511, -0.234563583, 0.129597062, 0.673269014, -0.234563583, 0.400528990, 0.046033792, 0.176117078, 0.447049005, 0.742261885, 0.351188644, 0.803047876, 0.456665719, 0.456665719, 0.415727165, 0.586148149, 0.498338416, -0.060210196, -0.060210196, -0.060210196, 0.303950450, -0.060210196, -0.040407569, -0.040407569, 0.714934540, 0.016750845, 0.463512631, 0.273817723, 0.380911491, 0.035099984, 0.481861770, 0.771024006, 0.053118489, 0.417279135, -0.911389297, 0.393880180, 1.158058163, 0.730400608, 1.787445782, 1.146995216, 2.155354985, 1.932276865, 1.906636826, 1.938424447, 1.938424447, 2.107672054, 1.414198979, 0.975763681, 2.528683570, 1.903109739, 1.959674925, 2.076768576, 1.766034424, 2.482848415, 2.518149303, 1.449165029, 2.181141978, 2.121039681, 2.444144290, 1.855664326, 2.409328396, 2.074348895, 2.160591050, 2.250134850, 2.507641010, 2.772588722, 2.542215013, 1.788892428, 2.345403997, 3.658944999, 2.285754193, 2.712305317, 2.437265077, 2.526211112, 2.934148678, 2.659998049, 2.313836235, 3.513103756, 2.749525940, 2.456258197, 3.406009988, 2.537816922, 2.116840456, 3.353494737, 2.617337712, 3.291502773, 2.139259375, 2.923614411, 3.870254092, 2.896129414, 2.759271470, 2.970134427, 2.238656578, 3.134819373, 3.916774108, 3.597065225, 2.445783091, 3.961225870, 4.003785485, 3.746718607, 4.003785485, 2.920154020, 3.218875825, 3.262652745, 2.887104841, 3.063183499, 3.637066406, 4.121568521, 4.121568521, 3.864501643, 3.434388181, 3.641176809, 3.422012142, 3.101830801, 3.746265698, 4.226929036, 3.710169681, 4.259718859, 3.624626286, 3.987931533, 4.381079716, 3.645155693, 3.864320361, 4.152183715, 3.962488807, 3.627295859, 4.179582690, 3.801556994, 4.072488921, 3.528816970, 3.828225241, 3.727393792, 4.125132655, 3.802112961, 4.175143075, 4.539303721, 4.539303721, 4.175143075, 4.563401273, 4.199240627, 3.655568675, 4.563401273, 3.928308700, 4.329864893, 4.245760643, 3.974828715, 3.724561547, 4.115634789, 3.707733370, 4.097127937, 4.097127937, 4.180173310, 4.009752326, 4.138800634, 4.737754660, 4.737754660, 4.737754660, 4.373594014, 4.737754660, 4.757557287, 4.757557287, 4.041051350, 4.814715701, 4.367953915, 4.557648823, 4.450555055, 4.833064840, 4.386303054, 4.097140817, 4.851083345, 4.486922699
## 
## [[3]]
##     n         r target     CSTV       LL       UL confidence      p_value
## 1 107 0.3735166     90 21.76416 19.35018 24.47929       0.95 7.410056e-05
##     CSTV90 n.90x2 CSTV100 n.100
## 1 21.76416      3 38.7896     3
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Curve
## 1 25.000000, 25.200000, 25.400000, 25.600000, 25.800000, 26.000000, 26.200000, 26.400000, 26.600000, 26.800000, 27.000000, 27.200000, 27.400000, 27.600000, 27.800000, 28.000000, 28.200000, 28.400000, 28.600000, 28.800000, 29.000000, 29.200000, 29.400000, 29.600000, 29.800000, 30.000000, 30.200000, 30.400000, 30.600000, 30.800000, 31.000000, 31.200000, 31.400000, 31.600000, 31.800000, 32.000000, 32.200000, 32.400000, 32.600000, 32.800000, 33.000000, 33.200000, 33.400000, 33.600000, 33.800000, 34.000000, 34.200000, 34.400000, 34.600000, 34.800000, 35.000000, 35.200000, 35.400000, 35.600000, 35.800000, 36.000000, 36.200000, 36.400000, 36.600000, 36.800000, 37.000000, 37.200000, 37.400000, 37.600000, 37.800000, 38.000000, 38.200000, 38.400000, 38.600000, 38.800000, 39.000000, 39.200000, 39.400000, 39.600000, 39.800000, 40.000000, 40.200000, 40.400000, 40.600000, 40.800000, 41.000000, 41.200000, 41.400000, 41.600000, 41.800000, 42.000000, 42.200000, 42.400000, 42.600000, 42.800000, 43.000000, 43.200000, 43.400000, 43.600000, 43.800000, 44.000000, 44.200000, 44.400000, 44.600000, 44.800000, 45.000000, 45.200000, 45.400000, 45.600000, 45.800000, 46.000000, 46.200000, 46.400000, 46.600000, 46.800000, 47.000000, 47.200000, 47.400000, 47.600000, 47.800000, 48.000000, 48.200000, 48.400000, 48.600000, 48.800000, 49.000000, 49.200000, 49.400000, 49.600000, 49.800000, 50.000000, 50.200000, 50.400000, 50.600000, 50.800000, 51.000000, 51.200000, 51.400000, 51.600000, 51.800000, 52.000000, 52.200000, 52.400000, 52.600000, 52.800000, 53.000000, 53.200000, 53.400000, 53.600000, 53.800000, 54.000000, 54.200000, 54.400000, 54.600000, 54.800000, 55.000000, 55.200000, 55.400000, 55.600000, 55.800000, 56.000000, 56.200000, 56.400000, 56.600000, 56.800000, 57.000000, 57.200000, 57.400000, 57.600000, 57.800000, 58.000000, 58.200000, 58.400000, 58.600000, 58.800000, 59.000000, 59.200000, 59.400000, 59.600000, 59.800000, 60.000000, 60.200000, 60.400000, 60.600000, 60.800000, 61.000000, 61.200000, 61.400000, 61.600000, 61.800000, 62.000000, 62.200000, 62.400000, 62.600000, 62.800000, 63.000000, 63.200000, 63.400000, 63.600000, 63.800000, 64.000000, 64.200000, 64.400000, 64.600000, 64.800000, 65.000000, 65.200000, 65.400000, 65.600000, 65.800000, 66.000000, 66.200000, 66.400000, 66.600000, 66.800000, 67.000000, 67.200000, 67.400000, 67.600000, 67.800000, 68.000000, 68.200000, 68.400000, 68.600000, 68.800000, 69.000000, 69.200000, 69.400000, 69.600000, 69.800000, 70.000000, 70.200000, 70.400000, 70.600000, 70.800000, 71.000000, 71.200000, 71.400000, 71.600000, 71.800000, 72.000000, 72.200000, 72.400000, 72.600000, 72.800000, 73.000000, 73.200000, 73.400000, 73.600000, 73.800000, 74.000000, 74.200000, 74.400000, 74.600000, 74.800000, 75.000000, 75.200000, 75.400000, 75.600000, 75.800000, 76.000000, 76.200000, 76.400000, 76.600000, 76.800000, 77.000000, 77.200000, 77.400000, 77.600000, 77.800000, 78.000000, 78.200000, 78.400000, 78.600000, 78.800000, 79.000000, 79.200000, 79.400000, 79.600000, 79.800000, 80.000000, 80.200000, 80.400000, 80.600000, 80.800000, 81.000000, 81.200000, 81.400000, 81.600000, 81.800000, 82.000000, 82.200000, 82.400000, 82.600000, 82.800000, 83.000000, 83.200000, 83.400000, 83.600000, 83.800000, 84.000000, 84.200000, 84.400000, 84.600000, 84.800000, 85.000000, 85.200000, 85.400000, 85.600000, 85.800000, 86.000000, 86.200000, 86.400000, 86.600000, 86.800000, 87.000000, 87.200000, 87.400000, 87.600000, 87.800000, 88.000000, 88.200000, 88.400000, 88.600000, 88.800000, 89.000000, 89.200000, 89.400000, 89.600000, 89.800000, 90.000000, 90.200000, 90.400000, 90.600000, 90.800000, 91.000000, 91.200000, 91.400000, 91.600000, 91.800000, 92.000000, 92.200000, 92.400000, 92.600000, 92.800000, 93.000000, 93.200000, 93.400000, 93.600000, 93.800000, 94.000000, 94.200000, 94.400000, 94.600000, 94.800000, 95.000000, 95.200000, 95.400000, 95.600000, 95.800000, 96.000000, 96.200000, 96.400000, 96.600000, 96.800000, 97.000000, 97.200000, 97.400000, 97.600000, 97.800000, 98.000000, 98.200000, 98.400000, 98.600000, 98.800000, 99.000000, 99.200000, 99.400000, 99.600000, 99.800000, 100.000000, 5.913921, 5.938470, 5.963055, 5.987678, 6.012339, 6.037039, 6.061779, 6.086559, 6.111380, 6.136242, 6.161146, 6.186093, 6.211083, 6.236117, 6.261195, 6.286319, 6.311488, 6.336704, 6.361966, 6.387276, 6.412635, 6.438041, 6.463498, 6.489003, 6.514560, 6.540167, 6.565827, 6.591538, 6.617302, 6.643120, 6.668991, 6.694917, 6.720899, 6.746936, 6.773029, 6.799179, 6.825387, 6.851653, 6.877977, 6.904361, 6.930804, 6.957308, 6.983873, 7.010500, 7.037188, 7.063940, 7.090755, 7.117633, 7.144577, 7.171585, 7.198659, 7.225800, 7.253007, 7.280282, 7.307625, 7.335037, 7.362518, 7.390069, 7.417691, 7.445384, 7.473148, 7.500985, 7.528895, 7.556879, 7.584937, 7.613070, 7.641278, 7.669563, 7.697925, 7.726364, 7.754881, 7.783476, 7.812151, 7.840907, 7.869743, 7.898660, 7.927659, 7.956741, 7.985907, 8.015156, 8.044490, 8.073910, 8.103416, 8.133008, 8.162688, 8.192457, 8.222314, 8.252260, 8.282298, 8.312426, 8.342646, 8.372958, 8.403364, 8.433864, 8.464458, 8.495148, 8.525934, 8.556817, 8.587798, 8.618878, 8.650057, 8.681336, 8.712716, 8.744197, 8.775781, 8.807469, 8.839260, 8.871157, 8.903160, 8.935269, 8.967485, 8.999810, 9.032244, 9.064789, 9.097444, 9.130211, 9.163091, 9.196084, 9.229192, 9.262416, 9.295756, 9.329213, 9.362788, 9.396483, 9.430298, 9.464234, 9.498292, 9.532473, 9.566779, 9.601209, 9.635766, 9.670449, 9.705261, 9.740203, 9.775274, 9.810477, 9.845812, 9.881281, 9.916885, 9.952624, 9.988500, 10.024514, 10.060667, 10.096961, 10.133396, 10.169974, 10.206695, 10.243562, 10.280575, 10.317736, 10.355045, 10.392504, 10.430115, 10.467879, 10.505796, 10.543869, 10.582098, 10.620485, 10.659032, 10.697739, 10.736609, 10.775642, 10.814840, 10.854205, 10.893737, 10.933439, 10.973312, 11.013357, 11.053576, 11.093971, 11.134543, 11.175294, 11.216225, 11.257338, 11.298635, 11.340117, 11.381786, 11.423644, 11.465692, 11.507933, 11.550368, 11.592999, 11.635828, 11.678856, 11.722086, 11.765520, 11.809159, 11.853005, 11.897061, 11.941328, 11.985809, 12.030505, 12.075419, 12.120553, 12.165909, 12.211490, 12.257296, 12.303332, 12.349599, 12.396099, 12.442835, 12.489809, 12.537024, 12.584482, 12.632185, 12.680137, 12.728340, 12.776796, 12.825509, 12.874480, 12.923713, 12.973210, 13.022975, 13.073010, 13.123318, 13.173903, 13.224766, 13.275912, 13.327344, 13.379064, 13.431076, 13.483383, 13.535988, 13.588896, 13.642110, 13.695632, 13.749467, 13.803618, 13.858089, 13.912884, 13.968007, 14.023461, 14.079251, 14.135381, 14.191855, 14.248676, 14.305850, 14.363381, 14.421274, 14.479531, 14.538160, 14.597164, 14.656547, 14.716316, 14.776475, 14.837028, 14.897983, 14.959342, 15.021113, 15.083301, 15.145911, 15.208949, 15.272421, 15.336333, 15.400691, 15.465502, 15.530772, 15.596507, 15.662715, 15.729402, 15.796574, 15.864241, 15.932407, 16.001082, 16.070273, 16.139988, 16.210234, 16.281021, 16.352355, 16.424248, 16.496706, 16.569739, 16.643357, 16.717568, 16.792384, 16.867813, 16.943866, 17.020554, 17.097888, 17.175878, 17.254537, 17.333875, 17.413906, 17.494641, 17.576093, 17.658275, 17.741202, 17.824886, 17.909343, 17.994586, 18.080632, 18.167495, 18.255192, 18.343740, 18.433156, 18.523457, 18.614662, 18.706790, 18.799859, 18.893892, 18.988907, 19.084928, 19.181976, 19.280074, 19.379246, 19.479518, 19.580915, 19.683463, 19.787191, 19.892127, 19.998301, 20.105744, 20.214490, 20.324570, 20.436021, 20.548879, 20.663183, 20.778971, 20.896287, 21.015172, 21.135673, 21.257837, 21.381715, 21.507357, 21.634821, 21.764162, 21.895441, 22.028724, 22.164075, 22.301567, 22.441275, 22.583277, 22.727657, 22.874504, 23.023912, 23.175981, 23.330817, 23.488535, 23.649255, 23.813106, 23.980228, 24.150769, 24.324889, 24.502761, 24.684571, 24.870521, 25.060830, 25.255736, 25.455500, 25.660405, 25.870765, 26.086925, 26.309266, 26.538212, 26.774237, 27.017872, 27.269717, 27.530450, 27.800851, 28.081811, 28.374371, 28.679745, 28.999371, 29.334975, 29.688650, 30.062983, 30.461232, 30.887593, 31.347636, 31.849016, 32.402775, 33.025879, 33.746927, 34.621766, 35.794793, 38.789595
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         SMA
## 1 1.6094379124, 1.7917594692, 1.7917594692, 1.9459101491, 1.9459101491, 2.0794415417, 2.0794415417, 2.1972245773, 2.1972245773, 2.1972245773, 2.1972245773, 2.1972245773, 2.3025850930, 2.3025850930, 2.3025850930, 2.3025850930, 2.3025850930, 2.3025850930, 2.3025850930, 2.3978952728, 2.3978952728, 2.3978952728, 2.3978952728, 2.3978952728, 2.3978952728, 2.3978952728, 2.4849066498, 2.4849066498, 2.4849066498, 2.5649493575, 2.5649493575, 2.5649493575, 2.5649493575, 2.6390573296, 2.6390573296, 2.6390573296, 2.6390573296, 2.6390573296, 2.6390573296, 2.7080502011, 2.7080502011, 2.7080502011, 2.7080502011, 2.7725887222, 2.7725887222, 2.7725887222, 2.7725887222, 2.7725887222, 2.7725887222, 2.7725887222, 2.7725887222, 2.8332133441, 2.8332133441, 2.8332133441, 2.8332133441, 2.8332133441, 2.8332133441, 2.8332133441, 2.8332133441, 2.8903717579, 2.8903717579, 2.8903717579, 2.8903717579, 2.8903717579, 2.8903717579, 2.8903717579, 2.8903717579, 2.8903717579, 2.9444389792, 2.9444389792, 2.9444389792, 2.9444389792, 2.9444389792, 2.9957322736, 2.9957322736, 2.9957322736, 3.0445224377, 3.0445224377, 3.0910424534, 3.0910424534, 3.1354942159, 3.1780538303, 3.1780538303, 3.1780538303, 3.2188758249, 3.2188758249, 3.2580965380, 3.2580965380, 3.2580965380, 3.2580965380, 3.2958368660, 3.2958368660, 3.3322045102, 3.3322045102, 3.3322045102, 3.3672958300, 3.4011973817, 3.4339872045, 3.4339872045, 3.4339872045, 3.4965075615, 3.4965075615, 3.4965075615, 3.5553480615, 3.8918202981, 4.0073331852, 4.1896547420, -0.4035026678, -0.6055446636, -0.3934169016, -0.0897662917, 0.3217505544, -0.5439929355, -0.5439929355, -0.3424646835, 0.0539872272, -0.2687494608, -0.1902221337, -0.5137313196, -0.2901891602, -0.1418970546, -0.3527403738, -0.2018482212, -0.5643265694, -0.2133202528, -0.2469249490, -0.5439929355, -0.1032382286, -0.3321365075, -0.1418970546, -0.0319910515, -0.3424646835, -0.3007828654, -0.3113012820, -0.0163147004, -0.7254469968, -0.4135638984, -0.1418970546, -0.1542832637, -0.0897662917, -0.1664547090, -0.1292762574, 0.3217505544, 0.1476675438, -0.4636476090, -0.3007828654, 0.0349940022, -0.2687494608, 0.3217505544, -0.1784290543, 0.1476675438, -0.1784290543, -0.3934169016, -0.0617464495, -0.2795136623, 0.1476675438, -0.3833022825, -0.5745548442, -0.4636476090, -0.2133202528, -0.1418970546, 0.0962371485, -0.0471124298, -0.1542832637, -0.3007828654, 0.0962371485, 0.3217505544, -0.2246500097, 0.0742834912, -0.4736482758, -0.0163147004, -0.0759488607, -0.0897662917, -0.2133202528, -0.3629686486, -0.6803702690, 0.3217505544, -0.4736482758, -0.1542832637, 0.0349940022, 0.1203926336, -0.0759488607, -0.2469249490, -0.3217505544, 0.0962371485, -0.3113012820, 0.0962371485, -0.0617464495, 0.3217505544, 0.3217505544, -0.3217505544, -0.2246500097, -0.4636476090, -0.0319910515, -0.3629686486, 0.0349940022, -0.4035026678, 0.1203926336, -0.1664547090, -0.0319910515, 0.1798534998, -0.2133202528, -0.2578891860, 0.3217505544, -0.1902221337, -0.1418970546, -0.0617464495, 0.3217505544, 0.3217505544, -0.3629686486, -0.5643265694, 0.3217505544, 0.1798534998, 0.3217505544, 2.3555445368, 1.9926624244, 2.3736593061, 2.9190378763, 3.6581520481, 2.1032138028, 2.1032138028, 2.4651731940, 3.1772296468, 2.5975710929, 2.7386118812, 2.1575658649, 2.5590638341, 2.8254072363, 2.4467173073, 2.7177305827, 2.0666931181, 2.6971259800, 2.6367695027, 2.1032138028, 2.8948412982, 2.4837233488, 2.8254072363, 3.0228064077, 2.4651731940, 2.5400367695, 2.5211449286, 3.0509622740, 1.7773091174, 2.3374738352, 2.8254072363, 2.8031607043, 2.9190378763, 2.7812999037, 2.8480751055, 3.6581520481, 3.3454863056, 2.2475198501, 2.5400367695, 3.1431164338, 2.5975710929, 3.6581520481, 2.7597931090, 3.3454863056, 2.7597931090, 2.3736593061, 2.9693635497, 2.5782378045, 3.3454863056, 2.3918258973, 2.0483223929, 2.2475198501, 2.6971259800, 2.8254072363, 3.2531135768, 2.9956473130, 2.8031607043, 2.5400367695, 3.2531135768, 3.6581520481, 2.6767769129, 3.2136832124, 2.2295579255, 3.0509622740, 2.9438549868, 2.9190378763, 2.6971259800, 2.4283465821, 1.8582701974, 3.6581520481, 2.2295579255, 2.8031607043, 3.1431164338, 3.2964985841, 2.9438549868, 2.6367695027, 2.5023772757, 3.2531135768, 2.5211449286, 3.2531135768, 2.9693635497, 3.6581520481, 3.6581520481, 2.5023772757, 2.6767769129, 2.2475198501, 3.0228064077, 2.4283465821, 3.1431164338, 2.3555445368, 3.2964985841, 2.7812999037, 3.0228064077, 3.4032946224, 2.6971259800, 2.6170769360, 3.6581520481, 2.7386118812, 2.8254072363, 2.9693635497, 3.6581520481, 3.6581520481, 2.4283465821, 2.0666931181, 3.6581520481, 3.4032946224, 3.6581520481, -0.7461066244, -0.2009029552, -0.5818998369, -0.9731277272, -1.7122418990, -0.0237722611, -0.0237722611, -0.2679486167, -0.9800050694, -0.4003465156, -0.5413873038, 0.0396587124, -0.2564787411, -0.5228221433, -0.1441322143, -0.4151454897, 0.2358919749, -0.3945408870, -0.3341844097, 0.2946814700, -0.4969460254, -0.0858280760, -0.4275119635, -0.6249111349, -0.0672779212, -0.1421414967, -0.0362382788, -0.5660556242, 0.7075975324, 0.2274755222, -0.2604578788, -0.2382113469, -0.3540885188, -0.1422425741, -0.2090177759, -1.0190947185, -0.7064289759, 0.3915374795, 0.0990205601, -0.4350662327, 0.1104791082, -0.9501018470, -0.0517429079, -0.5728975833, 0.0127956132, 0.3989294162, -0.1967748275, 0.1943509178, -0.5728975833, 0.3807628249, 0.7242663294, 0.5856934940, 0.1360873641, 0.0078061078, -0.4199002327, -0.1624339689, 0.0300526397, 0.2931765745, -0.4199002327, -0.7677802902, 0.2135948450, -0.3233114545, 0.6608138324, -0.1605905161, -0.0534832289, -0.0286661184, 0.1932457779, 0.4620251758, 1.0861687817, -0.7137130689, 0.7148810537, 0.1412782748, -0.1986774546, -0.3007663106, 0.0518772868, 0.3589627709, 0.5421451620, -0.2085911391, 0.5698975248, -0.1620711234, 0.1661306662, -0.4800982177, -0.4800982177, 0.6756765546, 0.5420989120, 0.9713559748, 0.2352901303, 0.8297499560, 0.1149801042, 0.9025520012, -0.0006617181, 0.5145369623, 0.3093981024, -0.0710901123, 0.6350785302, 0.7502188940, -0.2569546664, 0.6953753233, 0.6085799682, 0.4646236548, -0.1616444866, -0.1616444866, 1.0681609794, 1.4886549434, 0.2336682500, 0.6040385628, 0.5315026939, 0.8847177874, 0.7041572318, 1.0851541134, 1.7846833634, 2.5237975352, 1.1023906826, 1.1023906826, 1.5821331094, 2.2941895622, 1.7145310084, 1.8555717966, 1.2745257803, 1.7813842652, 2.0477276674, 1.6690377384, 1.9400510138, 1.2890135492, 1.9194464111, 1.8590899338, 1.4208444137, 2.2124719091, 1.8013539597, 2.1430378472, 2.3404370186, 1.7828038049, 1.8576673804, 1.9257869165, 2.4556042619, 1.1819511053, 1.8221585308, 2.3100919318, 2.2878453999, 2.4037225718, 2.3400925714, 2.4068677733, 3.2169447158, 2.9042789733, 1.8063125178, 2.0988294373, 2.7709019730, 2.2253566321, 3.2859375873, 2.3875786482, 3.0378103659, 2.4521171694, 2.0659833664, 2.6616876101, 2.2705618648, 3.0378103659, 2.0841499577, 1.7406464532, 2.0004685322, 2.4500746622, 2.5783559184, 3.0060622590, 2.7485959951, 2.5561093865, 2.2929854517, 3.0060622590, 3.4682591441, 2.4868840089, 3.0237903084, 2.0396650215, 2.8610693700, 2.7539620828, 2.7291449723, 2.5072330760, 2.2384536781, 1.7224445147, 3.5223263654, 2.0937322428, 2.6673350216, 3.0072907511, 3.2119661958, 2.8593225984, 2.5522371144, 2.4666350515, 3.2173713526, 2.5319227200, 3.2638913683, 3.0245931037, 3.7559412165, 3.7559412165, 2.6001664442, 2.8153880759, 2.3861310130, 3.2006382839, 2.6061784582, 3.3209483099, 2.5333764130, 3.5120707882, 2.9968721078, 3.2747462560, 3.6552344707, 2.9490658283, 2.9041081041, 3.9790847678, 3.0923344238, 3.1791297788, 3.3230860923, 4.0743949477, 4.0743949477, 2.8445894816, 2.5417765177, 4.4697076843, 4.3303631458, 4.7675421282

5. Plots

Examples using ggplot

5.1. Example 1

# Extracting curve data as a data.frame to plot
curve_example1 = fit_example_1 %>% unnest(., cols = Curve)

# Plot
data_1 %>% 
  # Want to remove leverage points?
  #dplyr::filter(STV < fit_example_1$CSTV100) %>% 
  #dplyr::filter(STV < 2*fit_example_1$CSTV90) %>% 
  ggplot()+
  # Points
  geom_point(aes(x = STV, y = RY), fill = "orange", shape = 21, size = 4, alpha = 0.75)+
  # Highlight potential leverage points >2xCSTV90
  geom_point(data = data_1 %>% dplyr::filter(STV > 2*fit_example_1$CSTV90),
             aes(x = STV, y = RY, shape = ">2xCSTV90"), col = "dark red", size = 4, alpha = 1)+
  # Highlight potential leverage points >2xCSTV90
  #geom_point(data = data_1 %>% dplyr::filter(STV > fit_example_1$CSTV100),
   #          aes(x = STV, y = RY, shape = ">CSTV100"), col = "dark red", size = 4, alpha = 1)+
  scale_shape_manual(name = "", values = c(7,10))+
  # Fitted ALCC
  geom_line(data = curve_example1, aes(x= STV.fitted, y = RY.fitted), size = 2)+
  # Critical value
  geom_vline(xintercept = fit_example_1$CSTV, col = "red", size = 1.25, linetype = "dashed")+
  # Confidence limits
  # Lines
  geom_vline(xintercept = fit_example_1$LL, col = "red", size = 0.75, linetype = "dotted")+
  geom_vline(xintercept = fit_example_1$UL, col = "red", size = 0.75, linetype = "dotted")+
  # Shade
  ggpp::annotate(geom = "rect", xmin = fit_example_1$LL, xmax = fit_example_1$UL,
                 ymin = min(data_1$RY), ymax = 100, alpha = .3, fill = "red")+
  # Axis titles
  labs(x = "Soil Test Value (units)", y = "Relative Yield (%)")+
  theme_bw()+
  theme(legend.position = "top")+
  # Annotate critical values data
  ggpp::annotate(geom = "table", y = min(data_1$RY), x = fit_example_1$UL + 0.5, hjust= 0, vjust = 0,
                 label = fit_example_1 %>% dplyr::select(CSTV, LL, UL, r) %>% 
                   mutate_at(.vars = c("r"), ~round(.,2)) %>% 
                   mutate_at(.vars = c("CSTV","LL","UL"), ~round(.,1))
                   )

# SMA regression

SMA_example1 = fit_example_1 %>%  unnest(., cols = SMA)

SMA_example1 %>% 
  ggplot(aes(x = arc_RY, y = ln_STV))+
  ggtitle("SMA Regression. Dataset 1")+
  geom_point(shape=21, fill = "orange", size = 4, alpha = 0.75)+
  #SMA Line
  geom_path(aes(x=arc_RY, y = SMA_line, linetype = "SMA_fit"), size = 2, col = "grey25")+
  scale_linetype_manual(name="", values = c("solid"))+
  #Critical value
  geom_vline(xintercept = 0, col = "grey10", size = 1.25, linetype = "dashed")+
  theme_bw()+
  # Axis titles
  labs(y = "ln_STV", y = "asin(sqrt(RY))-centered")

# Residuals plot

SMA_example1 %>% 
  ggplot(aes(x = fitted_axis, y = residuals))+
  ggtitle("Residuals SMA. Dataset 2")+
  geom_point(shape=21, fill = "orange", size = 4, alpha = 0.75)+
  geom_hline(yintercept = 0, col = "grey10", size = 1.25, linetype = "dashed")+
  theme_bw()+
  # Axis titles
  labs(x = "Fitted Axis -SMA- (see Warton et al. 2006)", y = "Residuals (STV units)")

5.2. Example 2

# Extracting curve data as a data.frame to plot
curve_example2 = fit_example_2 %>% unnest(., cols = Curve)

# Plot
data_2 %>% ggplot()+
  # Want to remove leverage points?
  #dplyr::filter(STV < fit_example_2$CSTV100) %>% 
  #dplyr::filter(STV < 2*fit_example_2$CSTV90) %>% 
  # Points
  geom_point(aes(x = STV, y = RY), fill = "#88dbc8", shape = 21, size = 4, alpha = 0.75)+
  # Highlight potential leverage points >2xCSTV90
  geom_point(data = data_2 %>% dplyr::filter(STV > 2*fit_example_2$CSTV90),
             aes(x = STV, y = RY, shape = ">2xCSTV90"), col = "dark red", size = 4, alpha = 1)+
  # Highlight potential leverage points >CSTV100
  geom_point(data = data_2 %>% dplyr::filter(STV > fit_example_2$CSTV100),
             aes(x = STV, y = RY, shape = ">CSTV100"), col = "dark red", size = 4, alpha = 1)+
  scale_shape_manual(name = "", values = c(7,10))+
  # Fitted ALCC
  geom_line(data = curve_example2, aes(x= STV.fitted, y = RY.fitted), size = 2)+
  # Critical value
  geom_vline(xintercept = fit_example_2$CSTV, col = "red", size = 1.25, linetype = "dashed")+
  # Confidence limits
  geom_vline(xintercept = fit_example_2$LL, col = "red", size = 0.75, linetype = "dotted")+
  geom_vline(xintercept = fit_example_2$UL, col = "red", size = 0.75, linetype = "dotted")+
  ggpp::annotate(geom = "rect", xmin = fit_example_2$LL, xmax = fit_example_2$UL,
                 ymin = min(data_2$RY), ymax = 100, alpha = .3, fill = "red")+
  # Axis titles
  labs(x = "Soil Test Value (units)", y = "Relative Yield (%)")+
  theme_bw()+
  theme(legend.position = "top")+
  # Annotate critical values data
  ggpp::annotate(geom = "table", y = min(data_2$RY), x = fit_example_2$UL + 0.5, hjust= 0, vjust = 0,
                 label = fit_example_2 %>% dplyr::select(CSTV, LL, UL, r) %>% 
                   mutate_at(.vars = c("r"), ~round(.,2)) %>% 
                   mutate_at(.vars = c("CSTV","LL","UL"), ~round(.,1))
                   )

# SMA regression

SMA_example2 = fit_example_2 %>%  unnest(., cols = SMA)

SMA_example2 %>% 
  ggplot(aes(x = arc_RY, y = ln_STV))+
  ggtitle("SMA Regression. Dataset 2")+
  geom_point(shape=21, fill = "#88dbc8", size = 4, alpha = 0.5)+
  #SMA Line
  geom_path(aes(x=arc_RY, y = SMA_line, linetype = "SMA_fit"), size = 2, col = "grey25")+
  scale_linetype_manual(name="", values = c("solid"))+
  #Critical value
  geom_vline(xintercept = 0, col = "grey10", size = 1.25, linetype = "dashed")+
  theme_bw()+
  # Axis titles
  labs(y = "ln_STV", y = "asin(sqrt(RY))-centered")

# Residuals plot

resid_example2 = fit_example_2 %>%  unnest(., cols = SMA)

resid_example2 %>% 
  ggplot(aes(x = fitted_axis, y = residuals))+
  ggtitle("Residuals SMA. Dataset 2")+
  geom_point(shape = 21, fill = "#88dbc8", size = 4, alpha = 0.5)+
  geom_hline(yintercept = 0, col = "grey10", size = 1.25, linetype = "dashed")+
  theme_bw()+
  # Axis titles
  labs(x = "Fitted Axis -SMA- (see Warton et al. 2006)", y = "Residuals (STV units)")

6. Revised SoilTestCocaCola Code

Great initiative from Dr. Austin Pearce working for automatize critical nutrient values estimations for the FRST (Fertilizer Recommendation System Tool) Project.

Original source: https://github.com/austinwpearce/SoilTestCocaCola.git

Copyright (c) 2022 Austin Pearce

Adapted by Adrian Correndo on 03/22/2022

List of modifications:

  1. Modified variables (e.g. x, xt_centered, y, yt) and arguments names (inside functions; e.g. sufficiency for target) for more familiar terminology I personally use.

(i). For example, replaced “lower_cl” with “lower_cstv” to maintain consistency.

  1. Removed sma argument from formulae. Not needed as the modified ALCC is entirely based on SMA. OLS steps described by Correndo et al. (2017) are just some tricks to obtain parameters using a spreadsheet where we cannot run a sma() model (Warton et al., 2006).

  2. Modified slope formula for more explicit one that removes the need of estimating an OLS slope and then rotate. New formula is simply the ratio between standard deviations of variables, as follows:

(i). slope = sd(ln_STV) / sd(arc_ry)

  1. Shortened some steps regarding centering variables.

  2. Fixed model pvalue (replaced student-t pvalue for Pearson-r pvalue)

  3. Modified df as n-2 for the t-test. (see Table 4, Warton et al., 2006)

  4. Modified test_stat formula, obtained directly from qt() instead of pt()

  5. Added probability formula (prob), which includes confidence to later estimate the t_stat.

  6. Shortened se formula, obtained directly from qt() instead of pt()

  7. Modified ssx formula for more explicit one

  8. Fixed model pvalue (replaced student-t pvalue for Pearson-r pvalue)

  9. Fixed issue with dplyr::if_else() when capping RY to 100%

  10. Modified data points removal criteria (remove2x replaced by remove.leverage, which gives users more autonomy)

(i). Users can choose now between options remove.leverage = c(“none”, “cstv90_2x”, “cstv100”)
(ii). Added sample size (n) used for CSTV calculations as outcome to show when removing points.
(ii). Modified printed text in the alcc_plot() in accordance with the new remove.leverage criteria.

  1. Added some extra warning regarding the specification of relative yield “target” and “confidence”. Although defaults are provided, I consider important to create awareness on users about this, which are key features the ALCC model brings.

  2. By the end of stage_3 of alcc(), I replaced “mutate(remove2x =”TRUE”)” with “mutate(remove.leverage = remove.leverage)”, otherwise the summary table always printed “TRUE” even though STV > cstv90_2x were NOT removed (remove2x = FALSE). It currently prints the user specification (“none”, “cstv90_2x”, “cstv100”).

6.1. Revised alcc() functions

# ALCC
# =============================================================================
alcc_core.rev <- function(data,
                  # # AC: I would rather use the acronym of soil test value (stv),
                      # as the same is done for "ry".
                      #stv,
                      stv,
                      ry,
    # AC: WARNING: There is no really an option for "SMA" or not, it is ALWAYS SMA.
                      # sma, 
    # AC: I think the word sufficiency is not appropriate for the case...
      # most likely this is just a "target" RY value
      # sufficiency sounds like 100%, a target would be just an "acceptable" RY
                      target,
    # AC: I added confidence as a needed arg. to define
                      confidence) {
    
    if (nrow(data) < 8) {
        stop("Too few data points. Try at least 8.")
    }
    
    if (missing(stv)) {
        stop("Specify the column containing soil test values (e.g., stv = STK)")
    }
    
    if (missing(ry)) {
        stop("Specify the column containing relative yield (%) values (e.g., ry = RY)")
    }
# AC: # Add statement for missing target, optional since a DEFAULT is provided (90)
    if (missing(target)) {
        stop("Specify the target value of relative yield (%) (e.g., target = 90)")
    }
    
 # AC: # Add statement for missing confidence, optional since a DEFAULT is provided (95)
    if (missing(confidence)) {
        stop("Specify the desired confidence level (%) for cstv estimation (e.g., confidence = 95)")
    }
  
    
    # enquo let's the user enter their own column names for x and y variables
# AC: I think this is particularly confusing because in the SMA regression 
# Soil test is not in the x-axis but on the y-axis, 
# I would rather use "STV" instead of "x", and then you flip them for transformed (xt, yt)
    #x <- enquo(soil_test)
    STV <- enquo(stv)
 # AC: for SMA regression RY is not in the y-axis but on the x-axis, 
  # I would rather use "STV" instead of "x"
    RY <- enquo(ry)
    #y <- enquo(ry)
    
    steps_1_4 <- data %>%
        mutate(
            stv = !!STV,
            # RY values greater than 100 are capped at 100
            ry_cap = if_else(!!RY > 100, 100, as.double(!!RY)),
            # Tranform back to numeric, just in case
            ry_cap = as.numeric(ry_cap),
      # AC: Model is not necessary, it is always SMA
            #model = case_when(sma == TRUE ~ "ALCC-SMA",
            #                  sma == FALSE ~ "ALCC"),
            # get sample size
            n = nrow(data),
      # AC: added degrees of freedom of the model with two pars 
      # (See Warton et al. 2006, Table 4)
            # n-1 was used
            df = n-2,
            # Step 1 Transform (t for "transformed" added to x and y)
      # AC: ### THIS IS NOT ADDED TO X AND Y, note you have flipped them...
      # Thus, I would avoid using x & y
            # for ALCC, soil test goes to Y-axis and RY goes to X-axis
            # the names of variables are difficult to follow, at least for me,
      # AC: I would suggest use ln_STV and arc_RY
            ln_stv = log(stv),
            # Step 2 Center
      # AC: I would center right here as well
            arc_ry = asin(sqrt(ry_cap / 100)) - asin(sqrt(target/100)), 
            target = target, # I think its not necessary
      # AC: UNNECESSARY
            # adjust_by = asin(sqrt(sufficiency / 100)), 
      ### NOT NEEDED, adjust_by = asin(sqrt(target / 100)),
            ### xt_centered = xt - adjust_by,
            # Step 3 Correlation (Pearson)
            r = cor(ln_stv, arc_ry, method = "pearson"),
      # AC: The student-t formula here DID NOT include the confidence level so it
            # was always estimated for 95% confidence level
              #t_stat  = (r * sqrt(df)) / sqrt(1 - r ^ 2),
      # AC: Warning: the df here are n-2, also this is informed later as the p-value 
      #of the model
      # but this is not the pvalue of the model, it's just the pvalue of the t-test 
      # (if B0 =/ from zero)
      # the pvalue of the model is the pvalue of the Pearson correlation test
            #pvalue  = pt(t_stat, df = n - 1, lower.tail = FALSE),
      # AC: I would replace with the following
            prob = 1-((1-confidence/100)/2), # Probability for t-dist
      # AC: The Student-t value from quantile fn (qt) saves a step for the LL 
      #and UL estimations
            t_stat = qt(p=prob, df = df), 
      # AC: This is the pvalue of the model
      # p-value of Pearson correlation (r)
            pvalue = stats::cor.test(ln_stv, arc_ry, method = "pearson")$p.value, 
            # Step 4 Means
      # AC: We DON'T ACTUALLY NEED THE MEANS HERE, can be included into the intercept formula
                #mean_xt  = mean(xt_centered),
                #mean_yt  = mean(yt),
        )
    
    
    # Step 5 Fit linear model to transformed, centered data
    # AC: # THIS STEP IS UNNECESSARY AS THE SMA-slope = sd(ln_stv)/ sd(arc_ry)
    # ols_center <- lm(yt ~ xt_centered, data = steps_1_4)
    
    steps_5_9 <- steps_1_4 %>%
        mutate(
            #intercept = coef(ols_center)[[1]],
            #slope = coef(ols_center)[[2]],
            # Step 6 Rotate the regression (SMA)
            # slope must come first
            # AC: I replaced the slope for the direct formula for SMA regression
            slope = sd(ln_stv) / sd (arc_ry), 
            #slope = case_when(sma == TRUE ~ slope / pearson,
            #                  sma == FALSE ~ slope),
            # AC: I replaced the slope for the direct formula for SMA regression
            intercept = mean(ln_stv) - (mean(arc_ry)*slope),
            #intercept = case_when(sma == TRUE ~ mean_yt - slope * mean_xt,
            #                      sma == FALSE ~ intercept),
            # Step 7 Estimate Critical Soil Test Concentration
            cstv = exp(intercept),
            # Step 8 Estimate the confidence interval
            pred_ln_stv  = intercept + slope * arc_ry, # Fitted ln_STV for observed RY
            mse = sum((pred_ln_stv - ln_stv) ^ 2) / df,
            # AC: I would use a more explicit formula here and not this indirect way
            #ssx      = var(xt_centered) * (n - 1), 
            ssx = sum((mean(arc_ry)-arc_ry)^2),
            confidence = confidence,
            se = sqrt(mse * ((1/n) + ((mean(arc_ry) ^ 2) / ssx))),
            #lower_cstv = exp(intercept - se * qt(1 - (1 - confidence / 100) / 2,
            #                                   df = n - 2)),
            #upper_cstv = exp(intercept + se * qt(1 - (1 - confidence / 100) / 2,
            #                                   df = n - 2)),
            # AC: I replaced boundaries formula for simpler ones
            lower_cstv = exp(intercept - (t_stat * se)), # Lower limit of CSTV
            upper_cstv = exp(intercept + (t_stat * se)), # Upper limit of CSTV
            # Step 9 Back-transform
            fitted_stv = exp(pred_ln_stv),
            fitted_ry = 100 * (sin(
                asin(sqrt(target/100)) + ((pred_ln_stv - intercept) / slope))) ^ 2
        ) %>%
        # 'dataset' might be problematic, not defined in scope
        select(target, cstv,
               lower_cstv, upper_cstv, confidence,
               fitted_stv, fitted_ry, pvalue, r, everything())
}

alcc.rev <- function(data,
                 stv,
                 ry,
                 #sma = TRUE,
                 target = 90,
                 confidence = 95,
                 remove.leverage = "none",
                 #remove2x = FALSE,
                 summary = FALSE){
    
    if (missing(stv)) {
        stop("Specify the soil test variable (e.g., stv = STK)")
    }
    
    if (missing(ry)) {
        stop("Enter name of relative yield (%) variable (e.g., ry = RY)")
    }
  
    # AC: # Add statement for missing target
    if (missing(target)) {
        stop("Specify the target value of relative yield (%) (e.g., target = 90)")
    }
  
    # AC: # Add statement for missing confidence
    if (missing(confidence)) {
        stop("Specify the desired confidence level (%) for cstv estimation (e.g., confidence = 95)")
    }
    
    # enquo let's the user enter their own column names for x and y variables
    # AC: # I think this is particularly confusing because in the SMA regression 
    # Soil test is not in the x-axis but on the y-axis, I will rather use "STV" 
    # instead of "x"
    #x <- enquo(stv)
    STV <- enquo(stv)
    # AC: for SMA regression RY is not in the y-axis but on the x-axis, I will 
    #rather use "STV" instead of "x"
    RY <- enquo(ry)
    #y <- enquo(ry)
    
    test <- data %>% 
        select(!!STV, !!RY)
    
    if (max(test[,2]) > 100) {
        warning("One or more original RY values exceeded 100%.\nAll RY values greater than 100% have been capped to 100% for arcsine transformation.", call. = FALSE)
    }
    
    if (min(test[,1]) < 0) {
        stop("One or more soil test values are less than 0. Remove all data with STV values less than 0 prior to fitting.", call. = FALSE)
    }
    
    # stage 1, 2, and 3 described by Dyson and Conyers 2013
    stage_1 <- data %>%
        alcc_core.rev(
            stv = !!STV,
            ry = !!RY,
            # AC: sma arg. not needed.
            #sma = sma,
            target = 100,
            confidence = confidence
        )
    # AC: Added a small note
    # identify CSTV for 100%
    cstv_100 <<- unique(stage_1$cstv)
    
    # AC: Added a small note
    # identify CSTV for 90%
    stage_2 <- data %>%
    # AC: Warning! This filter line ALWAYS filter out stv > cstv100. 
    # The user should be the one deciding. I don't agree with Dyson here, 
    # as many others may share. The cstv90 estimate should be obtained 
    # without removing anything. 
    # All removes must be OPTIONAL and decision exclusive to researchers.
    # So the filter step should be at stage 3 only
        #filter(!!STV <= cstv_100) %>%
      alcc_core.rev(
            stv = !!STV,
            ry = !!RY,
      # AC: sma arg. not needed.
            #sma = sma,
            target = 90,
            confidence = confidence
        )
    
    # Extract cstv_90
    cstv90_2x <<- unique(stage_2$cstv) * 2
    
# AC: What if I don't want to remove soil test values > CSTV_100 ????
    
    stage_3 <- data %>%
# AC: I would suggest use 3 options as a string: 
      #(i) "cstv90_2x", (ii) "cstv100", (iii) "none"
        #filter(case_when(remove2x == TRUE ~ !!STV <= cstv90_2x,
         #                remove2x == FALSE ~ !!STV <= cstv_100)) %>%  
      filter(case_when(remove.leverage == "none" ~ !!STV != 0,
                       remove.leverage == "cstv90_2x" ~ !!STV <= cstv90_2x,
                       remove.leverage == "cstv100" ~ !!STV <= cstv_100 ) ) %>%  
        alcc_core.rev(stv = !!STV,
                  ry = !!RY,
                  #sma = sma,
                  target = target,
                  confidence = confidence) %>%
    # AC: With this line, in the summary tabla always printed remove2x = "TRUE",
      #It should print the chosen option instead
        mutate(remove.leverage = remove.leverage,
    # AC: I added a line to count the number of observation used for the CSTV estimations
               n = nrow(.))
        #mutate(remove2x = "TRUE")
    
    if(summary == TRUE) {
        return(
            stage_3 %>%
                select(
                    #model,
                    n, # new outcome
                    target,
                    cstv,
                    lower_cstv,
                    upper_cstv,
                    confidence,
                    pvalue,
                    r,
                    # Replaced remove2x
                    remove.leverage) %>% 
                distinct(across(everything()))
        )
    } else {
        return(stage_3)
    }
    
}

6.1. Plot function

# Function alcc_plot() creates a scatter plot of soil test correlation data
# arguments are passed to alcc()
alcc_plot.rev <- function(data,
                      stv,
                      ry,
                      #sma = TRUE,
                      target, 
                      #sufficiency = 90,
                      confidence,
                      remove.leverage = "none") {
    
    if (missing(stv)) {
        stop("Specify the soil test variable (e.g., stv = STK)")
    }
    
    if (missing(ry)) {
        stop("Enter name of relative yield (%) variable (e.g., ry = RY)")
    }
    
    # AC: # Add statement for missing target
    if (missing(target)) {
        stop("Specify the target value of relative yield (%) (e.g., target = 90)")
    }
  
    # AC: # Add statement for missing confidence
    if (missing(confidence)) {
        stop("Specify the desired confidence level (%) for cstv estimation (e.g., confidence = 95)")
    }
  
    # enquo let's the user enter their own column names for x and y variables
    # AC: Replaced names
    STV <- enquo(stv)
    RY <- enquo(ry)
    #x <- enquo(stv)
    #y <- enquo(ry)
    
    
    input <- data %>% 
        transmute(stv = !!STV,
                  # RY values greater than 100 are capped at 100
# AC: the false statement should always be of type double, just in case, 
# use as.double()
# I have just tried with a dataset where I found this problem (data_2)
                  ry_cap = if_else(!!RY > 100, 100, as.double(!!RY)))
    
    # pass to alcc function
    output <- alcc.rev(data,
                   stv = !!STV,
                   ry = !!RY,
                   # AC: sma not needed
                   # sma = sma,
                   target =  target,
                   confidence = confidence,
              # AC: I changed remove2x for remove.leverage 
                   remove.leverage = remove.leverage)
    
    # for plot annotations
    
    maxx <- max(input$stv)
    
    cstv <- (unique(output$cstv))
    cstv <- if_else(cstv < 10, round(cstv, 1), round(cstv, 0))
    
    lower_cstv <- (unique(output$lower_cstv))
    lower_cstv <- if_else(lower_cstv < 10, round(lower_cstv, 1), round(lower_cstv, 0))
    
    upper_cstv <- (unique(output$upper_cstv))
    upper_cstv <- if_else(upper_cstv < 10, round(upper_cstv, 1), round(upper_cstv, 0))
    
    #sufficiency <- unique(output$sufficiency)
    
    r <- round(unique(output$r), 2)

# AC: WARNING! WHAT IF I DON'T WANT TO REMOVE ANYTHING? Currently, the default 
  # is to remove STV > CSTV100
# Default option should be using all available data, then the remove2x = TRUE/FALSE
# plot includes all data, even if remove2x == TRUE, but curve will follow remove2x
    output %>%
        ggplot() +
        geom_point(data = input,
                   aes(stv, ry_cap),
                   size = 2, alpha = 0.7,
                   color = case_when(
                              # AC: I changed the remove2x arg. for remove.leverage
                              # None
                              remove.leverage == "none" & input$stv <= cstv_100 ~ "black",
                              remove.leverage == "none" & input$stv > cstv_100 ~ "purple",
                              # >100
                              remove.leverage == "cstv100" & input$stv <= cstv_100 ~ "black",
                              remove.leverage == "cstv100" & input$stv > cstv_100 ~ 'red',
                              # >90_2x
                              remove.leverage == "cstv90_2x" & input$stv <= cstv90_2x ~ "black",
                              remove.leverage == "cstv90_2x" & input$stv > cstv90_2x ~ "red"
                              #remove.leverage == TRUE & input$stv > cstv90_2x ~ "red"
                              #remove2x == FALSE & input$stv > cstv_100 ~ red,
                              #remove.leverage == FALSE & input$stv > cstv90_2x ~ gold,
                              #remove.leverage == TRUE & input$stv > cstv90_2x ~ red,
                              #TRUE ~ black
                              )) +
        geom_vline(xintercept = lower_cstv,
                   alpha = 0.5,
                   linetype = 3) +
        geom_vline(xintercept = upper_cstv,
                   alpha = 0.5,
                   linetype = 3) +
        geom_line(aes(x = fitted_stv,
                      y = fitted_ry),
                  color = "red", size = 1.5) +
        # the cstv at X% sufficiency
        geom_vline(xintercept = cstv, color = "blue", alpha = 1) +
        geom_hline(yintercept = target, alpha = 0.2) +
        annotate(
            "text",
            label = paste0(
                "CSTV = ", cstv, " ppm at ", target, "% RY",
                "\n", confidence,"% CI [", lower_cstv, " - ", upper_cstv, "]",
                "\n r = ", r),
            x = maxx,
            y = 0,
            hjust = 1,
            vjust = 0,
            alpha = 0.8
        ) + 
        scale_x_continuous(breaks =
                               seq(0, 10000, by = if_else(
                                   maxx >= 200, 40,
                                   if_else(maxx >= 100, 20,
                                           if_else(maxx >= 50, 10, 5))
                               ))) +
        scale_y_continuous(breaks = seq(0, 105, 10)) +
        labs(subtitle = "Modified Arcsine-Log Calibration Curve",
  # AC: Here there could be a problem for people using STV in other than mg/kg ...
            x = expression(Soil ~ Test ~ Value ~ (mg ~ kg ^ -1)),
            y = "Relative yield (%)",
            caption = paste0(
            # AC: I Replaced this in line with the new arg. remove.leverage
  #if_else(remove.leverage == TRUE,
  #"Red points > CSTV90 * 2 excluded from model",
  #"Red points > CSTV100 excluded from model. Yellow points > CSTV90 * 2 not excluded."),
  case_when(remove.leverage == "none" ~ "No points excluded from model. Purple points (>CSTV100).",
            remove.leverage == "cstv100" ~ "Red points (STV > CSTV100) were excluded from model.",
            remove.leverage == "cstv90_2x" ~ "Red points (STV > 2*CSTV90) were excluded from model."),
                "\nVertical dotted lines show lower and upper confidence limits."
            )
        )
}

7. Comparison to SoilTestCocaCola

7.1. Cotton (from agridat package)

For the cotton dataset, Austin’s Code using alcc() produces:

  1. different cstv, lower & upper limits when compared to Adrian’s modALCC() and the reference (SMA regression). This issue is nothing wrong with formulae but a result of using a dataset that presents points with STV > cstv100, since the alcc() removes those points by default, while Adrian’s modALCC() does not, as I prefer to leave this decision up to the user.

  2. wrong p=values, since it uses the student-t one instead of the pvalue to test correlation significance (used by SMA regression).

# Load  Austin's ALCC functions
# alcc.core() and alcc()
source_url("https://raw.githubusercontent.com/austinwpearce/SoilTestCocaCola/main/alcc.R")
# alcc_plot()
#source_url("https://raw.githubusercontent.com/austinwpearce/SoilTestCocaCola/main/alcc_plot.R")

# EXAMPLE 1. Cotton. Relative yield vs soil test potassium
cotton <- tibble(stk = agridat::cate.potassium$potassium,
                 ry = agridat::cate.potassium$yield, 
                 dataset = "cotton")

### CODES COMPARISON

# Adrian's
modALCC(data = cotton, RY = ry, STV = stk, target=90, confidence = 0.95)
## Warning: One or more original RY values exceeded 100%. All RY values greater 
##           than 100% have been capped to 100%.

## Warning: 2 STV points exceeded the CSTV for 100%.
##   Risk of leverage. You may consider a sensitivity analysis by removing extreme points, 
##   re-run the modALCC(), and check results.

## Warning: 2 STV points exceeded two-times (2x) 
##   the CSTV for 90%. Risk of leverage. You may consider a sensitivity analysis by 
##   removing extreme points, re-run the modALCC(), and check results.

##    n         r target     CSTV       LL       UL confidence      p_value
## 1 24 0.7277644     90 76.89175 62.34761 94.82868       0.95 5.567174e-05
##     CSTV90 n.90x2  CSTV100 n.100
## 1 76.89175      2 170.7629     2
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Curve
## 1 40.80000, 41.00000, 41.20000, 41.40000, 41.60000, 41.80000, 42.00000, 42.20000, 42.40000, 42.60000, 42.80000, 43.00000, 43.20000, 43.40000, 43.60000, 43.80000, 44.00000, 44.20000, 44.40000, 44.60000, 44.80000, 45.00000, 45.20000, 45.40000, 45.60000, 45.80000, 46.00000, 46.20000, 46.40000, 46.60000, 46.80000, 47.00000, 47.20000, 47.40000, 47.60000, 47.80000, 48.00000, 48.20000, 48.40000, 48.60000, 48.80000, 49.00000, 49.20000, 49.40000, 49.60000, 49.80000, 50.00000, 50.20000, 50.40000, 50.60000, 50.80000, 51.00000, 51.20000, 51.40000, 51.60000, 51.80000, 52.00000, 52.20000, 52.40000, 52.60000, 52.80000, 53.00000, 53.20000, 53.40000, 53.60000, 53.80000, 54.00000, 54.20000, 54.40000, 54.60000, 54.80000, 55.00000, 55.20000, 55.40000, 55.60000, 55.80000, 56.00000, 56.20000, 56.40000, 56.60000, 56.80000, 57.00000, 57.20000, 57.40000, 57.60000, 57.80000, 58.00000, 58.20000, 58.40000, 58.60000, 58.80000, 59.00000, 59.20000, 59.40000, 59.60000, 59.80000, 60.00000, 60.20000, 60.40000, 60.60000, 60.80000, 61.00000, 61.20000, 61.40000, 61.60000, 61.80000, 62.00000, 62.20000, 62.40000, 62.60000, 62.80000, 63.00000, 63.20000, 63.40000, 63.60000, 63.80000, 64.00000, 64.20000, 64.40000, 64.60000, 64.80000, 65.00000, 65.20000, 65.40000, 65.60000, 65.80000, 66.00000, 66.20000, 66.40000, 66.60000, 66.80000, 67.00000, 67.20000, 67.40000, 67.60000, 67.80000, 68.00000, 68.20000, 68.40000, 68.60000, 68.80000, 69.00000, 69.20000, 69.40000, 69.60000, 69.80000, 70.00000, 70.20000, 70.40000, 70.60000, 70.80000, 71.00000, 71.20000, 71.40000, 71.60000, 71.80000, 72.00000, 72.20000, 72.40000, 72.60000, 72.80000, 73.00000, 73.20000, 73.40000, 73.60000, 73.80000, 74.00000, 74.20000, 74.40000, 74.60000, 74.80000, 75.00000, 75.20000, 75.40000, 75.60000, 75.80000, 76.00000, 76.20000, 76.40000, 76.60000, 76.80000, 77.00000, 77.20000, 77.40000, 77.60000, 77.80000, 78.00000, 78.20000, 78.40000, 78.60000, 78.80000, 79.00000, 79.20000, 79.40000, 79.60000, 79.80000, 80.00000, 80.20000, 80.40000, 80.60000, 80.80000, 81.00000, 81.20000, 81.40000, 81.60000, 81.80000, 82.00000, 82.20000, 82.40000, 82.60000, 82.80000, 83.00000, 83.20000, 83.40000, 83.60000, 83.80000, 84.00000, 84.20000, 84.40000, 84.60000, 84.80000, 85.00000, 85.20000, 85.40000, 85.60000, 85.80000, 86.00000, 86.20000, 86.40000, 86.60000, 86.80000, 87.00000, 87.20000, 87.40000, 87.60000, 87.80000, 88.00000, 88.20000, 88.40000, 88.60000, 88.80000, 89.00000, 89.20000, 89.40000, 89.60000, 89.80000, 90.00000, 90.20000, 90.40000, 90.60000, 90.80000, 91.00000, 91.20000, 91.40000, 91.60000, 91.80000, 92.00000, 92.20000, 92.40000, 92.60000, 92.80000, 93.00000, 93.20000, 93.40000, 93.60000, 93.80000, 94.00000, 94.20000, 94.40000, 94.60000, 94.80000, 95.00000, 95.20000, 95.40000, 95.60000, 95.80000, 96.00000, 96.20000, 96.40000, 96.60000, 96.80000, 97.00000, 97.20000, 97.40000, 97.60000, 97.80000, 98.00000, 98.20000, 98.40000, 98.60000, 98.80000, 99.00000, 99.20000, 99.40000, 99.60000, 99.80000, 100.00000, 19.35974, 19.45764, 19.55595, 19.65469, 19.75386, 19.85346, 19.95350, 20.05397, 20.15488, 20.25624, 20.35805, 20.46030, 20.56302, 20.66619, 20.76982, 20.87392, 20.97848, 21.08352, 21.18904, 21.29503, 21.40151, 21.50848, 21.61593, 21.72389, 21.83234, 21.94129, 22.05075, 22.16072, 22.27121, 22.38221, 22.49374, 22.60579, 22.71837, 22.83149, 22.94515, 23.05935, 23.17411, 23.28941, 23.40527, 23.52169, 23.63868, 23.75624, 23.87437, 23.99308, 24.11238, 24.23227, 24.35275, 24.47383, 24.59551, 24.71781, 24.84071, 24.96424, 25.08839, 25.21317, 25.33859, 25.46464, 25.59134, 25.71869, 25.84670, 25.97537, 26.10470, 26.23471, 26.36540, 26.49678, 26.62884, 26.76160, 26.89507, 27.02924, 27.16413, 27.29974, 27.43608, 27.57315, 27.71096, 27.84952, 27.98883, 28.12891, 28.26975, 28.41136, 28.55376, 28.69695, 28.84093, 28.98571, 29.13130, 29.27772, 29.42495, 29.57302, 29.72193, 29.87169, 30.02230, 30.17378, 30.32613, 30.47937, 30.63349, 30.78851, 30.94443, 31.10127, 31.25904, 31.41774, 31.57737, 31.73796, 31.89952, 32.06204, 32.22554, 32.39003, 32.55551, 32.72201, 32.88953, 33.05807, 33.22766, 33.39830, 33.57000, 33.74277, 33.91662, 34.09157, 34.26763, 34.44480, 34.62311, 34.80255, 34.98315, 35.16491, 35.34785, 35.53199, 35.71733, 35.90388, 36.09167, 36.28069, 36.47098, 36.66254, 36.85539, 37.04953, 37.24499, 37.44178, 37.63992, 37.83941, 38.04028, 38.24255, 38.44622, 38.65131, 38.85785, 39.06585, 39.27532, 39.48629, 39.69876, 39.91277, 40.12832, 40.34544, 40.56415, 40.78447, 41.00641, 41.22999, 41.45525, 41.68219, 41.91084, 42.14122, 42.37336, 42.60727, 42.84298, 43.08052, 43.31990, 43.56115, 43.80431, 44.04938, 44.29640, 44.54540, 44.79640, 45.04943, 45.30452, 45.56170, 45.82099, 46.08243, 46.34604, 46.61187, 46.87993, 47.15027, 47.42292, 47.69790, 47.97526, 48.25504, 48.53726, 48.82197, 49.10920, 49.39899, 49.69139, 49.98643, 50.28416, 50.58461, 50.88784, 51.19389, 51.50280, 51.81462, 52.12940, 52.44719, 52.76804, 53.09201, 53.41914, 53.74949, 54.08312, 54.42009, 54.76045, 55.10427, 55.45161, 55.80253, 56.15710, 56.51540, 56.87748, 57.24342, 57.61331, 57.98720, 58.36519, 58.74734, 59.13376, 59.52452, 59.91971, 60.31943, 60.72377, 61.13282, 61.54669, 61.96548, 62.38931, 62.81827, 63.25250, 63.69210, 64.13720, 64.58793, 65.04443, 65.50682, 65.97525, 66.44988, 66.93084, 67.41831, 67.91245, 68.41343, 68.92143, 69.43664, 69.95925, 70.48947, 71.02750, 71.57357, 72.12791, 72.69076, 73.26238, 73.84301, 74.43295, 75.03248, 75.64191, 76.26156, 76.89175, 77.53285, 78.18523, 78.84928, 79.52541, 80.21406, 80.91570, 81.63081, 82.35991, 83.10357, 83.86235, 84.63690, 85.42787, 86.23598, 87.06199, 87.90672, 88.77104, 89.65590, 90.56233, 91.49142, 92.44435, 93.42244, 94.42710, 95.45985, 96.52240, 97.61660, 98.74451, 99.90838, 101.11074, 102.35443, 103.64260, 104.97882, 106.36717, 107.81229, 109.31953, 110.89510, 112.54630, 114.28174, 116.11178, 118.04901, 120.10898, 122.31131, 124.68127, 127.25246, 130.07109, 133.20386, 136.75336, 140.89273, 145.96033, 152.83194, 170.76289
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      SMA
## 1 3.25809654, 3.33220451, 3.40119738, 3.43398720, 3.52636052, 3.55534806, 3.68887945, 3.78418963, 3.89182030, 4.02535169, 4.21950771, 4.31748811, 4.34380542, 4.35670883, 4.35670883, 4.62497281, 4.77068462, 4.77068462, 4.87519732, 4.89034913, 4.89034913, 5.02388052, 5.26269019, 5.35185813, -0.42861896, -0.31339648, -0.33213651, -0.55617481, -0.14811819, -0.25461120, -0.33213651, -0.32175055, 0.07428349, 0.22158313, -0.29549582, 0.32175055, 0.15668523, -0.07173053, 0.32175055, 0.14766754, 0.14189705, 0.17985350, -0.06461985, 0.04057135, 0.14189705, -0.02734987, 0.32175055, 0.16297034, 3.27950884, 3.56523769, 3.51876614, 2.96319572, 3.97509497, 3.71101347, 3.51876614, 3.54452124, 4.52660689, 4.89188071, 3.60962775, 5.14027599, 4.73094682, 4.16452117, 5.14027599, 4.70858475, 4.69427508, 4.78839952, 4.18215423, 4.44300749, 4.69427508, 4.27457639, 5.14027599, 4.74653264, -0.02141230, -0.23303318, -0.11756876, 0.47079149, -0.44873444, -0.15566541, 0.17011332, 0.23966840, -0.63478660, -0.86652902, 0.60987995, -0.82278787, -0.38714140, 0.19218766, -0.78356716, -0.08361194, 0.07640954, -0.01771489, 0.69304309, 0.44734164, 0.19607405, 0.74930413, 0.12241420, 0.60532549, 2.19520677, 2.55504358, 2.57756491, 2.05478431, 3.15905688, 2.92396292, 2.86524698, 2.98631226, 4.07602858, 4.57483379, 3.48673684, 5.11536549, 4.73235363, 4.17883138, 5.15458620, 4.99115895, 5.12256110, 5.21668553, 4.71495295, 4.99095800, 5.24222560, 4.95605830, 6.06056757, 5.75599216
# Austin's, sma = TRUE
# Check that even stating remove2x = FALSE it always print "remove2x = TRUE" on the summary table.
alcc(cotton, soil_test = stk, ry = ry, sufficiency = 90, 
     confidence = 95, summary = T, remove2x = FALSE, sma = T)
## Warning: One or more original RY values exceeded 100%.
## All RY values greater than 100% have been capped to 100% for arcsine transformation.

## # A tibble: 1 x 9
##   model  sufficiency  cstv lower_cl upper_cl confidence  pvalue pearson remove2x
##   <chr>        <dbl> <dbl>    <dbl>    <dbl>      <dbl>   <dbl>   <dbl> <chr>   
## 1 ALCC-~          90  73.5     59.2     91.2         95 1.54e-4   0.694 TRUE
# Austin's, sma = FALSE
alcc(cotton, soil_test = stk, ry = ry, sufficiency = 90, 
     confidence = 95, summary = T, remove2x = FALSE, sma = F)
## Warning: One or more original RY values exceeded 100%.
## All RY values greater than 100% have been capped to 100% for arcsine transformation.

## # A tibble: 1 x 9
##   model sufficiency  cstv lower_cl upper_cl confidence   pvalue pearson remove2x
##   <chr>       <dbl> <dbl>    <dbl>    <dbl>      <dbl>    <dbl>   <dbl> <chr>   
## 1 ALCC           90  67.5     55.9     81.5         95  8.89e-5   0.725 TRUE
## For the Austin's Code using alcc() ->
# cstv, lower & upper limit, and p=values are wrong compared to 
# SMA regression as reference.
# Austin's results (REFERENCE) [ADRIAN's]:
  # CSTV = 67.49 (76.89) [76.89]
  # LL = 55.87 (62.36) [62.35]
  # UL = 81.54 (94.79) [94.83]
  # pval = 8.87e-05 (5.57e-05) [5.57e-05]

# NOW COMPARE TO MY REVISED VERSION of alcc (alcc.rev)

# Adrian's
modALCC(data = cotton, RY = ry, STV = stk, target=90, confidence = 0.95)
## Warning: One or more original RY values exceeded 100%. All RY values greater 
##           than 100% have been capped to 100%.

## Warning: 2 STV points exceeded the CSTV for 100%.
##   Risk of leverage. You may consider a sensitivity analysis by removing extreme points, 
##   re-run the modALCC(), and check results.

## Warning: 2 STV points exceeded two-times (2x) 
##   the CSTV for 90%. Risk of leverage. You may consider a sensitivity analysis by 
##   removing extreme points, re-run the modALCC(), and check results.

##    n         r target     CSTV       LL       UL confidence      p_value
## 1 24 0.7277644     90 76.89175 62.34761 94.82868       0.95 5.567174e-05
##     CSTV90 n.90x2  CSTV100 n.100
## 1 76.89175      2 170.7629     2
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Curve
## 1 40.80000, 41.00000, 41.20000, 41.40000, 41.60000, 41.80000, 42.00000, 42.20000, 42.40000, 42.60000, 42.80000, 43.00000, 43.20000, 43.40000, 43.60000, 43.80000, 44.00000, 44.20000, 44.40000, 44.60000, 44.80000, 45.00000, 45.20000, 45.40000, 45.60000, 45.80000, 46.00000, 46.20000, 46.40000, 46.60000, 46.80000, 47.00000, 47.20000, 47.40000, 47.60000, 47.80000, 48.00000, 48.20000, 48.40000, 48.60000, 48.80000, 49.00000, 49.20000, 49.40000, 49.60000, 49.80000, 50.00000, 50.20000, 50.40000, 50.60000, 50.80000, 51.00000, 51.20000, 51.40000, 51.60000, 51.80000, 52.00000, 52.20000, 52.40000, 52.60000, 52.80000, 53.00000, 53.20000, 53.40000, 53.60000, 53.80000, 54.00000, 54.20000, 54.40000, 54.60000, 54.80000, 55.00000, 55.20000, 55.40000, 55.60000, 55.80000, 56.00000, 56.20000, 56.40000, 56.60000, 56.80000, 57.00000, 57.20000, 57.40000, 57.60000, 57.80000, 58.00000, 58.20000, 58.40000, 58.60000, 58.80000, 59.00000, 59.20000, 59.40000, 59.60000, 59.80000, 60.00000, 60.20000, 60.40000, 60.60000, 60.80000, 61.00000, 61.20000, 61.40000, 61.60000, 61.80000, 62.00000, 62.20000, 62.40000, 62.60000, 62.80000, 63.00000, 63.20000, 63.40000, 63.60000, 63.80000, 64.00000, 64.20000, 64.40000, 64.60000, 64.80000, 65.00000, 65.20000, 65.40000, 65.60000, 65.80000, 66.00000, 66.20000, 66.40000, 66.60000, 66.80000, 67.00000, 67.20000, 67.40000, 67.60000, 67.80000, 68.00000, 68.20000, 68.40000, 68.60000, 68.80000, 69.00000, 69.20000, 69.40000, 69.60000, 69.80000, 70.00000, 70.20000, 70.40000, 70.60000, 70.80000, 71.00000, 71.20000, 71.40000, 71.60000, 71.80000, 72.00000, 72.20000, 72.40000, 72.60000, 72.80000, 73.00000, 73.20000, 73.40000, 73.60000, 73.80000, 74.00000, 74.20000, 74.40000, 74.60000, 74.80000, 75.00000, 75.20000, 75.40000, 75.60000, 75.80000, 76.00000, 76.20000, 76.40000, 76.60000, 76.80000, 77.00000, 77.20000, 77.40000, 77.60000, 77.80000, 78.00000, 78.20000, 78.40000, 78.60000, 78.80000, 79.00000, 79.20000, 79.40000, 79.60000, 79.80000, 80.00000, 80.20000, 80.40000, 80.60000, 80.80000, 81.00000, 81.20000, 81.40000, 81.60000, 81.80000, 82.00000, 82.20000, 82.40000, 82.60000, 82.80000, 83.00000, 83.20000, 83.40000, 83.60000, 83.80000, 84.00000, 84.20000, 84.40000, 84.60000, 84.80000, 85.00000, 85.20000, 85.40000, 85.60000, 85.80000, 86.00000, 86.20000, 86.40000, 86.60000, 86.80000, 87.00000, 87.20000, 87.40000, 87.60000, 87.80000, 88.00000, 88.20000, 88.40000, 88.60000, 88.80000, 89.00000, 89.20000, 89.40000, 89.60000, 89.80000, 90.00000, 90.20000, 90.40000, 90.60000, 90.80000, 91.00000, 91.20000, 91.40000, 91.60000, 91.80000, 92.00000, 92.20000, 92.40000, 92.60000, 92.80000, 93.00000, 93.20000, 93.40000, 93.60000, 93.80000, 94.00000, 94.20000, 94.40000, 94.60000, 94.80000, 95.00000, 95.20000, 95.40000, 95.60000, 95.80000, 96.00000, 96.20000, 96.40000, 96.60000, 96.80000, 97.00000, 97.20000, 97.40000, 97.60000, 97.80000, 98.00000, 98.20000, 98.40000, 98.60000, 98.80000, 99.00000, 99.20000, 99.40000, 99.60000, 99.80000, 100.00000, 19.35974, 19.45764, 19.55595, 19.65469, 19.75386, 19.85346, 19.95350, 20.05397, 20.15488, 20.25624, 20.35805, 20.46030, 20.56302, 20.66619, 20.76982, 20.87392, 20.97848, 21.08352, 21.18904, 21.29503, 21.40151, 21.50848, 21.61593, 21.72389, 21.83234, 21.94129, 22.05075, 22.16072, 22.27121, 22.38221, 22.49374, 22.60579, 22.71837, 22.83149, 22.94515, 23.05935, 23.17411, 23.28941, 23.40527, 23.52169, 23.63868, 23.75624, 23.87437, 23.99308, 24.11238, 24.23227, 24.35275, 24.47383, 24.59551, 24.71781, 24.84071, 24.96424, 25.08839, 25.21317, 25.33859, 25.46464, 25.59134, 25.71869, 25.84670, 25.97537, 26.10470, 26.23471, 26.36540, 26.49678, 26.62884, 26.76160, 26.89507, 27.02924, 27.16413, 27.29974, 27.43608, 27.57315, 27.71096, 27.84952, 27.98883, 28.12891, 28.26975, 28.41136, 28.55376, 28.69695, 28.84093, 28.98571, 29.13130, 29.27772, 29.42495, 29.57302, 29.72193, 29.87169, 30.02230, 30.17378, 30.32613, 30.47937, 30.63349, 30.78851, 30.94443, 31.10127, 31.25904, 31.41774, 31.57737, 31.73796, 31.89952, 32.06204, 32.22554, 32.39003, 32.55551, 32.72201, 32.88953, 33.05807, 33.22766, 33.39830, 33.57000, 33.74277, 33.91662, 34.09157, 34.26763, 34.44480, 34.62311, 34.80255, 34.98315, 35.16491, 35.34785, 35.53199, 35.71733, 35.90388, 36.09167, 36.28069, 36.47098, 36.66254, 36.85539, 37.04953, 37.24499, 37.44178, 37.63992, 37.83941, 38.04028, 38.24255, 38.44622, 38.65131, 38.85785, 39.06585, 39.27532, 39.48629, 39.69876, 39.91277, 40.12832, 40.34544, 40.56415, 40.78447, 41.00641, 41.22999, 41.45525, 41.68219, 41.91084, 42.14122, 42.37336, 42.60727, 42.84298, 43.08052, 43.31990, 43.56115, 43.80431, 44.04938, 44.29640, 44.54540, 44.79640, 45.04943, 45.30452, 45.56170, 45.82099, 46.08243, 46.34604, 46.61187, 46.87993, 47.15027, 47.42292, 47.69790, 47.97526, 48.25504, 48.53726, 48.82197, 49.10920, 49.39899, 49.69139, 49.98643, 50.28416, 50.58461, 50.88784, 51.19389, 51.50280, 51.81462, 52.12940, 52.44719, 52.76804, 53.09201, 53.41914, 53.74949, 54.08312, 54.42009, 54.76045, 55.10427, 55.45161, 55.80253, 56.15710, 56.51540, 56.87748, 57.24342, 57.61331, 57.98720, 58.36519, 58.74734, 59.13376, 59.52452, 59.91971, 60.31943, 60.72377, 61.13282, 61.54669, 61.96548, 62.38931, 62.81827, 63.25250, 63.69210, 64.13720, 64.58793, 65.04443, 65.50682, 65.97525, 66.44988, 66.93084, 67.41831, 67.91245, 68.41343, 68.92143, 69.43664, 69.95925, 70.48947, 71.02750, 71.57357, 72.12791, 72.69076, 73.26238, 73.84301, 74.43295, 75.03248, 75.64191, 76.26156, 76.89175, 77.53285, 78.18523, 78.84928, 79.52541, 80.21406, 80.91570, 81.63081, 82.35991, 83.10357, 83.86235, 84.63690, 85.42787, 86.23598, 87.06199, 87.90672, 88.77104, 89.65590, 90.56233, 91.49142, 92.44435, 93.42244, 94.42710, 95.45985, 96.52240, 97.61660, 98.74451, 99.90838, 101.11074, 102.35443, 103.64260, 104.97882, 106.36717, 107.81229, 109.31953, 110.89510, 112.54630, 114.28174, 116.11178, 118.04901, 120.10898, 122.31131, 124.68127, 127.25246, 130.07109, 133.20386, 136.75336, 140.89273, 145.96033, 152.83194, 170.76289
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      SMA
## 1 3.25809654, 3.33220451, 3.40119738, 3.43398720, 3.52636052, 3.55534806, 3.68887945, 3.78418963, 3.89182030, 4.02535169, 4.21950771, 4.31748811, 4.34380542, 4.35670883, 4.35670883, 4.62497281, 4.77068462, 4.77068462, 4.87519732, 4.89034913, 4.89034913, 5.02388052, 5.26269019, 5.35185813, -0.42861896, -0.31339648, -0.33213651, -0.55617481, -0.14811819, -0.25461120, -0.33213651, -0.32175055, 0.07428349, 0.22158313, -0.29549582, 0.32175055, 0.15668523, -0.07173053, 0.32175055, 0.14766754, 0.14189705, 0.17985350, -0.06461985, 0.04057135, 0.14189705, -0.02734987, 0.32175055, 0.16297034, 3.27950884, 3.56523769, 3.51876614, 2.96319572, 3.97509497, 3.71101347, 3.51876614, 3.54452124, 4.52660689, 4.89188071, 3.60962775, 5.14027599, 4.73094682, 4.16452117, 5.14027599, 4.70858475, 4.69427508, 4.78839952, 4.18215423, 4.44300749, 4.69427508, 4.27457639, 5.14027599, 4.74653264, -0.02141230, -0.23303318, -0.11756876, 0.47079149, -0.44873444, -0.15566541, 0.17011332, 0.23966840, -0.63478660, -0.86652902, 0.60987995, -0.82278787, -0.38714140, 0.19218766, -0.78356716, -0.08361194, 0.07640954, -0.01771489, 0.69304309, 0.44734164, 0.19607405, 0.74930413, 0.12241420, 0.60532549, 2.19520677, 2.55504358, 2.57756491, 2.05478431, 3.15905688, 2.92396292, 2.86524698, 2.98631226, 4.07602858, 4.57483379, 3.48673684, 5.11536549, 4.73235363, 4.17883138, 5.15458620, 4.99115895, 5.12256110, 5.21668553, 4.71495295, 4.99095800, 5.24222560, 4.95605830, 6.06056757, 5.75599216
# Revised alcc functions
alcc.rev(cotton, stv = stk, ry = ry, target = 90, 
     confidence = 95, summary = T, remove.leverage = "none")
## Warning: One or more original RY values exceeded 100%.
## All RY values greater than 100% have been capped to 100% for arcsine transformation.

## # A tibble: 1 x 9
##       n target  cstv lower_cstv upper_cstv confidence    pvalue     r
##   <int>  <dbl> <dbl>      <dbl>      <dbl>      <dbl>     <dbl> <dbl>
## 1    24     90  76.9       62.3       94.8         95 0.0000557 0.728
## # ... with 1 more variable: remove.leverage <chr>
alcc.rev(cotton, stv = stk, ry = ry, target = 90, 
     confidence = 95, summary = T, remove.leverage = "cstv100")
## Warning: One or more original RY values exceeded 100%.
## All RY values greater than 100% have been capped to 100% for arcsine transformation.

## # A tibble: 1 x 9
##       n target  cstv lower_cstv upper_cstv confidence   pvalue     r
##   <int>  <dbl> <dbl>      <dbl>      <dbl>      <dbl>    <dbl> <dbl>
## 1    22     90  73.5       59.2       91.2         95 0.000339 0.694
## # ... with 1 more variable: remove.leverage <chr>
alcc.rev(cotton, stv = stk, ry = ry, target = 90, 
     confidence = 95, summary = T, remove.leverage = "cstv90_2x")
## Warning: One or more original RY values exceeded 100%.
## All RY values greater than 100% have been capped to 100% for arcsine transformation.

## # A tibble: 1 x 9
##       n target  cstv lower_cstv upper_cstv confidence   pvalue     r
##   <int>  <dbl> <dbl>      <dbl>      <dbl>      <dbl>    <dbl> <dbl>
## 1    22     90  73.5       59.2       91.2         95 0.000339 0.694
## # ... with 1 more variable: remove.leverage <chr>

7.1.2. Double-check with SMA (reference method)

# USE SMA as reference method

target = 90
cotton <- cotton %>% mutate(# Transform stv
                            ln_stv = log(stk), 
                            # Cap if RY > 100
                            RY = ifelse(ry > 100, 100, as.double(ry)),
                            # Transform and center RY
                            arc_ry = (asin(sqrt(RY/100)) - asin(sqrt(target/100))))

# SMA model
sma.cotton <- sma(data = cotton, method = c("SMA"), formula = ln_stv ~  arc_ry)

# Print
sma.cotton
## Call: sma(formula = ln_stv ~ arc_ry, data = cotton, method = c("SMA")) 
## 
## Fit using Standardized Major Axis 
## 
## ------------------------------------------------------------
## Coefficients:
##             elevation    slope
## estimate     4.342399 2.479801
## lower limit  4.133033 1.839335
## upper limit  4.551764 3.343281
## 
## H0 : variables uncorrelated
## R-squared : 0.529641 
## P-value : 5.5672e-05
# Extract intercept, its CI, and model p-value
print("CSTV from SMA")
## [1] "CSTV from SMA"
exp(sma.cotton[["elevtest"]][[1]][["a"]])
## [1] 76.89175
print("Lower limit")
## [1] "Lower limit"
exp(sma.cotton[["elevtest"]][[1]][["a.ci"]][[1]])
## [1] 62.36682
print("Upper limit")
## [1] "Upper limit"
exp(sma.cotton[["elevtest"]][[1]][["a.ci"]][[2]])
## [1] 94.79947
print("p-value")
## [1] "p-value"
sma.cotton[["pval"]][[1]]
## [1] 5.567174e-05

7.2. Other examples

Data_1: The alcc() from Austin works the same than Adrian’s modALCC() and Spreadsheet version.

Data_2: Austin’s original alcc() code fails with data_2 due to an issue with the “if_else()” used to cap RY values. The function needs to have specified the FALSE statement as.double(), otherwise it may result problematic with some datasets loaded from csv files (as data_2).

# Adrian's
fit_example_1 = modALCC(data = data_1, RY = RY, STV = STV, target=90, confidence = 0.95)
## Warning: 7 STV points exceeded two-times (2x) 
##   the CSTV for 90%. Risk of leverage. You may consider a sensitivity analysis by 
##   removing extreme points, re-run the modALCC(), and check results.
fit_example_1
##    n         r target     CSTV       LL       UL confidence      p_value
## 1 15 0.9682908     90 4.478476 3.947041 5.081463       0.95 3.296044e-09
##     CSTV90 n.90x2  CSTV100 n.100
## 1 4.478476      7 19.15054     0
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Curve
## 1 65.000000, 65.200000, 65.400000, 65.600000, 65.800000, 66.000000, 66.200000, 66.400000, 66.600000, 66.800000, 67.000000, 67.200000, 67.400000, 67.600000, 67.800000, 68.000000, 68.200000, 68.400000, 68.600000, 68.800000, 69.000000, 69.200000, 69.400000, 69.600000, 69.800000, 70.000000, 70.200000, 70.400000, 70.600000, 70.800000, 71.000000, 71.200000, 71.400000, 71.600000, 71.800000, 72.000000, 72.200000, 72.400000, 72.600000, 72.800000, 73.000000, 73.200000, 73.400000, 73.600000, 73.800000, 74.000000, 74.200000, 74.400000, 74.600000, 74.800000, 75.000000, 75.200000, 75.400000, 75.600000, 75.800000, 76.000000, 76.200000, 76.400000, 76.600000, 76.800000, 77.000000, 77.200000, 77.400000, 77.600000, 77.800000, 78.000000, 78.200000, 78.400000, 78.600000, 78.800000, 79.000000, 79.200000, 79.400000, 79.600000, 79.800000, 80.000000, 80.200000, 80.400000, 80.600000, 80.800000, 81.000000, 81.200000, 81.400000, 81.600000, 81.800000, 82.000000, 82.200000, 82.400000, 82.600000, 82.800000, 83.000000, 83.200000, 83.400000, 83.600000, 83.800000, 84.000000, 84.200000, 84.400000, 84.600000, 84.800000, 85.000000, 85.200000, 85.400000, 85.600000, 85.800000, 86.000000, 86.200000, 86.400000, 86.600000, 86.800000, 87.000000, 87.200000, 87.400000, 87.600000, 87.800000, 88.000000, 88.200000, 88.400000, 88.600000, 88.800000, 89.000000, 89.200000, 89.400000, 89.600000, 89.800000, 90.000000, 90.200000, 90.400000, 90.600000, 90.800000, 91.000000, 91.200000, 91.400000, 91.600000, 91.800000, 92.000000, 92.200000, 92.400000, 92.600000, 92.800000, 93.000000, 93.200000, 93.400000, 93.600000, 93.800000, 94.000000, 94.200000, 94.400000, 94.600000, 94.800000, 95.000000, 95.200000, 95.400000, 95.600000, 95.800000, 96.000000, 96.200000, 96.400000, 96.600000, 96.800000, 97.000000, 97.200000, 97.400000, 97.600000, 97.800000, 98.000000, 98.200000, 98.400000, 98.600000, 98.800000, 99.000000, 99.200000, 99.400000, 99.600000, 99.800000, 100.000000, 1.097927, 1.108379, 1.118944, 1.129625, 1.140423, 1.151339, 1.162376, 1.173535, 1.184817, 1.196225, 1.207760, 1.219425, 1.231221, 1.243150, 1.255214, 1.267415, 1.279755, 1.292236, 1.304860, 1.317630, 1.330548, 1.343616, 1.356836, 1.370210, 1.383742, 1.397433, 1.411286, 1.425303, 1.439488, 1.453842, 1.468369, 1.483071, 1.497951, 1.513012, 1.528257, 1.543689, 1.559311, 1.575127, 1.591138, 1.607350, 1.623765, 1.640386, 1.657217, 1.674262, 1.691525, 1.709008, 1.726717, 1.744655, 1.762826, 1.781234, 1.799883, 1.818779, 1.837924, 1.857325, 1.876985, 1.896910, 1.917103, 1.937572, 1.958319, 1.979352, 2.000675, 2.022293, 2.044214, 2.066441, 2.088983, 2.111844, 2.135031, 2.158551, 2.182410, 2.206616, 2.231175, 2.256095, 2.281384, 2.307048, 2.333097, 2.359537, 2.386379, 2.413629, 2.441298, 2.469395, 2.497929, 2.526910, 2.556347, 2.586252, 2.616636, 2.647508, 2.678882, 2.710768, 2.743179, 2.776127, 2.809626, 2.843690, 2.878331, 2.913565, 2.949407, 2.985872, 3.022976, 3.060736, 3.099169, 3.138294, 3.178128, 3.218691, 3.260004, 3.302086, 3.344960, 3.388649, 3.433176, 3.478564, 3.524841, 3.572032, 3.620165, 3.669269, 3.719374, 3.770512, 3.822716, 3.876020, 3.930460, 3.986075, 4.042904, 4.100988, 4.160372, 4.221100, 4.283223, 4.346790, 4.411856, 4.478476, 4.546710, 4.616622, 4.688278, 4.761749, 4.837110, 4.914440, 4.993823, 5.075351, 5.159117, 5.245225, 5.333784, 5.424910, 5.518728, 5.615374, 5.714992, 5.817737, 5.923779, 6.033299, 6.146495, 6.263582, 6.384794, 6.510388, 6.640644, 6.775870, 6.916408, 7.062634, 7.214969, 7.373879, 7.539891, 7.713596, 7.895664, 8.086860, 8.288063, 8.500287, 8.724716, 8.962742, 9.216022, 9.486552, 9.776766, 10.089688, 10.429142, 10.800084, 11.209119, 11.665380, 12.182103, 12.779738, 13.492946, 14.389790, 15.647308, 19.150544
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             SMA
## 1 0.00000000, 0.69314718, 1.09861229, 1.38629436, 1.60943791, 1.79175947, 1.94591015, 2.07944154, 2.19722458, 2.30258509, 2.39789527, 2.48490665, 2.56494936, 2.63905733, 2.70805020, -0.31130128, -0.14189705, -0.07594886, -0.03199105, 0.00000000, 0.07428349, 0.05398723, 0.12039263, 0.14766754, 0.09623715, 0.17985350, 0.32175055, 0.22158313, 0.22158313, 0.32175055, 0.09342397, 0.85846552, 1.15629226, 1.35480886, 1.49928272, 1.83475226, 1.74309289, 2.04298443, 2.16615987, 1.93389654, 2.31151393, 2.95233114, 2.49996793, 2.49996793, 2.95233114, -0.09342397, -0.16531834, -0.05767997, 0.03148550, 0.11015519, -0.04299279, 0.20281726, 0.03645711, 0.03106471, 0.36868855, 0.08638134, -0.46742449, 0.06498143, 0.13908940, -0.24428093, -1.40585875, 0.05232998, 0.75562183, 1.24182049, 1.60943791, 2.12722900, 2.18972031, 2.62314325, 2.86410172, 2.73719891, 3.21012648, 3.93795506, 3.56563456, 3.63974254, 4.16109861
# Austin's
alcc(data_1, soil_test = STV, ry = RY, sufficiency = 90, 
     confidence = 95, summary = T, remove2x = FALSE, sma = TRUE)
##      model sufficiency     cstv lower_cl upper_cl confidence       pvalue
## 1 ALCC-SMA          90 4.478476 3.947041 5.081463         95 6.469298e-10
##     pearson remove2x
## 1 0.9682908     TRUE
# Fixed alcc.rev
alcc.rev(data_1, stv = STV, ry = RY, target = 90, 
     confidence = 95, summary = T, remove.leverage = "none")
##    n target     cstv lower_cstv upper_cstv confidence       pvalue         r
## 1 15     90 4.478476   3.947041   5.081463         95 3.296044e-09 0.9682908
##   remove.leverage
## 1            none
# plot
alcc_plot.rev(data_1, stv = STV, ry = RY, target = 90, 
     confidence = 95, remove.leverage = "cstv90_2x")

# Using dataframe

# Alternative using the vectors
# fit_example_1 = modALCC(Y = data_1$RY,STV = data_1$STV, target=90,confidence = 0.95)

# Adrian's
fit_example_2 = modALCC(data = data_2, RY = RY, STV = STV, target=90, confidence = 0.95)
## Warning: 9 STV points exceeded the CSTV for 100%.
##   Risk of leverage. You may consider a sensitivity analysis by removing extreme points, 
##   re-run the modALCC(), and check results.

## Warning: 22 STV points exceeded two-times (2x) 
##   the CSTV for 90%. Risk of leverage. You may consider a sensitivity analysis by 
##   removing extreme points, re-run the modALCC(), and check results.
fit_example_2
##     n         r target     CSTV       LL       UL confidence      p_value
## 1 137 0.7164928     90 23.25457 21.57156 25.06888       0.95 7.314913e-23
##     CSTV90 n.90x2  CSTV100 n.100
## 1 23.25457     22 53.10299     9
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Curve
## 1 12.000000, 12.200000, 12.400000, 12.600000, 12.800000, 13.000000, 13.200000, 13.400000, 13.600000, 13.800000, 14.000000, 14.200000, 14.400000, 14.600000, 14.800000, 15.000000, 15.200000, 15.400000, 15.600000, 15.800000, 16.000000, 16.200000, 16.400000, 16.600000, 16.800000, 17.000000, 17.200000, 17.400000, 17.600000, 17.800000, 18.000000, 18.200000, 18.400000, 18.600000, 18.800000, 19.000000, 19.200000, 19.400000, 19.600000, 19.800000, 20.000000, 20.200000, 20.400000, 20.600000, 20.800000, 21.000000, 21.200000, 21.400000, 21.600000, 21.800000, 22.000000, 22.200000, 22.400000, 22.600000, 22.800000, 23.000000, 23.200000, 23.400000, 23.600000, 23.800000, 24.000000, 24.200000, 24.400000, 24.600000, 24.800000, 25.000000, 25.200000, 25.400000, 25.600000, 25.800000, 26.000000, 26.200000, 26.400000, 26.600000, 26.800000, 27.000000, 27.200000, 27.400000, 27.600000, 27.800000, 28.000000, 28.200000, 28.400000, 28.600000, 28.800000, 29.000000, 29.200000, 29.400000, 29.600000, 29.800000, 30.000000, 30.200000, 30.400000, 30.600000, 30.800000, 31.000000, 31.200000, 31.400000, 31.600000, 31.800000, 32.000000, 32.200000, 32.400000, 32.600000, 32.800000, 33.000000, 33.200000, 33.400000, 33.600000, 33.800000, 34.000000, 34.200000, 34.400000, 34.600000, 34.800000, 35.000000, 35.200000, 35.400000, 35.600000, 35.800000, 36.000000, 36.200000, 36.400000, 36.600000, 36.800000, 37.000000, 37.200000, 37.400000, 37.600000, 37.800000, 38.000000, 38.200000, 38.400000, 38.600000, 38.800000, 39.000000, 39.200000, 39.400000, 39.600000, 39.800000, 40.000000, 40.200000, 40.400000, 40.600000, 40.800000, 41.000000, 41.200000, 41.400000, 41.600000, 41.800000, 42.000000, 42.200000, 42.400000, 42.600000, 42.800000, 43.000000, 43.200000, 43.400000, 43.600000, 43.800000, 44.000000, 44.200000, 44.400000, 44.600000, 44.800000, 45.000000, 45.200000, 45.400000, 45.600000, 45.800000, 46.000000, 46.200000, 46.400000, 46.600000, 46.800000, 47.000000, 47.200000, 47.400000, 47.600000, 47.800000, 48.000000, 48.200000, 48.400000, 48.600000, 48.800000, 49.000000, 49.200000, 49.400000, 49.600000, 49.800000, 50.000000, 50.200000, 50.400000, 50.600000, 50.800000, 51.000000, 51.200000, 51.400000, 51.600000, 51.800000, 52.000000, 52.200000, 52.400000, 52.600000, 52.800000, 53.000000, 53.200000, 53.400000, 53.600000, 53.800000, 54.000000, 54.200000, 54.400000, 54.600000, 54.800000, 55.000000, 55.200000, 55.400000, 55.600000, 55.800000, 56.000000, 56.200000, 56.400000, 56.600000, 56.800000, 57.000000, 57.200000, 57.400000, 57.600000, 57.800000, 58.000000, 58.200000, 58.400000, 58.600000, 58.800000, 59.000000, 59.200000, 59.400000, 59.600000, 59.800000, 60.000000, 60.200000, 60.400000, 60.600000, 60.800000, 61.000000, 61.200000, 61.400000, 61.600000, 61.800000, 62.000000, 62.200000, 62.400000, 62.600000, 62.800000, 63.000000, 63.200000, 63.400000, 63.600000, 63.800000, 64.000000, 64.200000, 64.400000, 64.600000, 64.800000, 65.000000, 65.200000, 65.400000, 65.600000, 65.800000, 66.000000, 66.200000, 66.400000, 66.600000, 66.800000, 67.000000, 67.200000, 67.400000, 67.600000, 67.800000, 68.000000, 68.200000, 68.400000, 68.600000, 68.800000, 69.000000, 69.200000, 69.400000, 69.600000, 69.800000, 70.000000, 70.200000, 70.400000, 70.600000, 70.800000, 71.000000, 71.200000, 71.400000, 71.600000, 71.800000, 72.000000, 72.200000, 72.400000, 72.600000, 72.800000, 73.000000, 73.200000, 73.400000, 73.600000, 73.800000, 74.000000, 74.200000, 74.400000, 74.600000, 74.800000, 75.000000, 75.200000, 75.400000, 75.600000, 75.800000, 76.000000, 76.200000, 76.400000, 76.600000, 76.800000, 77.000000, 77.200000, 77.400000, 77.600000, 77.800000, 78.000000, 78.200000, 78.400000, 78.600000, 78.800000, 79.000000, 79.200000, 79.400000, 79.600000, 79.800000, 80.000000, 80.200000, 80.400000, 80.600000, 80.800000, 81.000000, 81.200000, 81.400000, 81.600000, 81.800000, 82.000000, 82.200000, 82.400000, 82.600000, 82.800000, 83.000000, 83.200000, 83.400000, 83.600000, 83.800000, 84.000000, 84.200000, 84.400000, 84.600000, 84.800000, 85.000000, 85.200000, 85.400000, 85.600000, 85.800000, 86.000000, 86.200000, 86.400000, 86.600000, 86.800000, 87.000000, 87.200000, 87.400000, 87.600000, 87.800000, 88.000000, 88.200000, 88.400000, 88.600000, 88.800000, 89.000000, 89.200000, 89.400000, 89.600000, 89.800000, 90.000000, 90.200000, 90.400000, 90.600000, 90.800000, 91.000000, 91.200000, 91.400000, 91.600000, 91.800000, 92.000000, 92.200000, 92.400000, 92.600000, 92.800000, 93.000000, 93.200000, 93.400000, 93.600000, 93.800000, 94.000000, 94.200000, 94.400000, 94.600000, 94.800000, 95.000000, 95.200000, 95.400000, 95.600000, 95.800000, 96.000000, 96.200000, 96.400000, 96.600000, 96.800000, 97.000000, 97.200000, 97.400000, 97.600000, 97.800000, 98.000000, 98.200000, 98.400000, 98.600000, 98.800000, 99.000000, 99.200000, 99.400000, 99.600000, 99.800000, 100.000000, 2.336883, 2.355345, 2.373822, 2.392314, 2.410824, 2.429353, 2.447902, 2.466472, 2.485066, 2.503683, 2.522326, 2.540994, 2.559691, 2.578416, 2.597171, 2.615957, 2.634775, 2.653625, 2.672510, 2.691430, 2.710385, 2.729377, 2.748407, 2.767476, 2.786584, 2.805733, 2.824922, 2.844155, 2.863430, 2.882748, 2.902112, 2.921521, 2.940976, 2.960478, 2.980028, 2.999627, 3.019275, 3.038973, 3.058722, 3.078522, 3.098374, 3.118280, 3.138239, 3.158253, 3.178322, 3.198446, 3.218628, 3.238866, 3.259162, 3.279517, 3.299931, 3.320405, 3.340940, 3.361536, 3.382194, 3.402915, 3.423698, 3.444546, 3.465459, 3.486436, 3.507480, 3.528590, 3.549767, 3.571012, 3.592326, 3.613709, 3.635161, 3.656685, 3.678279, 3.699945, 3.721683, 3.743495, 3.765380, 3.787340, 3.809375, 3.831485, 3.853672, 3.875936, 3.898277, 3.920697, 3.943195, 3.965774, 3.988432, 4.011172, 4.033993, 4.056896, 4.079883, 4.102953, 4.126107, 4.149347, 4.172672, 4.196083, 4.219582, 4.243168, 4.266843, 4.290606, 4.314460, 4.338404, 4.362439, 4.386567, 4.410787, 4.435100, 4.459507, 4.484009, 4.508607, 4.533301, 4.558092, 4.582980, 4.607967, 4.633054, 4.658240, 4.683527, 4.708916, 4.734406, 4.760000, 4.785698, 4.811500, 4.837408, 4.863422, 4.889542, 4.915771, 4.942108, 4.968555, 4.995111, 5.021779, 5.048559, 5.075451, 5.102457, 5.129578, 5.156813, 5.184165, 5.211634, 5.239220, 5.266926, 5.294751, 5.322696, 5.350763, 5.378953, 5.407266, 5.435703, 5.464265, 5.492953, 5.521768, 5.550712, 5.579784, 5.608986, 5.638319, 5.667784, 5.697382, 5.727114, 5.756981, 5.786984, 5.817124, 5.847402, 5.877819, 5.908377, 5.939075, 5.969916, 6.000901, 6.032030, 6.063304, 6.094726, 6.126295, 6.158014, 6.189883, 6.221903, 6.254076, 6.286402, 6.318884, 6.351522, 6.384317, 6.417271, 6.450385, 6.483660, 6.517098, 6.550699, 6.584466, 6.618399, 6.652499, 6.686769, 6.721209, 6.755821, 6.790607, 6.825566, 6.860702, 6.896016, 6.931508, 6.967181, 7.003035, 7.039073, 7.075296, 7.111705, 7.148302, 7.185089, 7.222066, 7.259237, 7.296601, 7.334162, 7.371920, 7.409878, 7.448036, 7.486397, 7.524963, 7.563734, 7.602714, 7.641903, 7.681304, 7.720918, 7.760747, 7.800794, 7.841059, 7.881546, 7.922255, 7.963189, 8.004350, 8.045739, 8.087360, 8.129213, 8.171302, 8.213628, 8.256193, 8.298999, 8.342049, 8.385345, 8.428890, 8.472684, 8.516732, 8.561034, 8.605594, 8.650414, 8.695497, 8.740844, 8.786458, 8.832342, 8.878499, 8.924930, 8.971640, 9.018629, 9.065902, 9.113461, 9.161308, 9.209446, 9.257879, 9.306609, 9.355639, 9.404972, 9.454611, 9.504560, 9.554821, 9.605397, 9.656292, 9.707509, 9.759051, 9.810922, 9.863125, 9.915663, 9.968541, 10.021761, 10.075327, 10.129242, 10.183511, 10.238138, 10.293126, 10.348478, 10.404200, 10.460295, 10.516766, 10.573619, 10.630857, 10.688485, 10.746507, 10.804928, 10.863751, 10.922982, 10.982625, 11.042685, 11.103166, 11.164074, 11.225413, 11.287189, 11.349407, 11.412071, 11.475188, 11.538762, 11.602799, 11.667304, 11.732284, 11.797744, 11.863690, 11.930128, 11.997064, 12.064504, 12.132455, 12.200922, 12.269914, 12.339435, 12.409494, 12.480096, 12.551250, 12.622962, 12.695240, 12.768091, 12.841522, 12.915543, 12.990159, 13.065381, 13.141215, 13.217670, 13.294756, 13.372480, 13.450851, 13.529880, 13.609574, 13.689945, 13.771001, 13.852752, 13.935209, 14.018381, 14.102280, 14.186917, 14.272302, 14.358448, 14.445364, 14.533064, 14.621560, 14.710863, 14.800987, 14.891945, 14.983749, 15.076415, 15.169955, 15.264384, 15.359717, 15.455968, 15.553154, 15.651289, 15.750391, 15.850475, 15.951559, 16.053661, 16.156798, 16.260989, 16.366253, 16.472609, 16.580077, 16.688679, 16.798434, 16.909365, 17.021495, 17.134845, 17.249441, 17.365306, 17.482466, 17.600946, 17.720773, 17.841975, 17.964580, 18.088618, 18.214118, 18.341112, 18.469631, 18.599711, 18.731384, 18.864686, 18.999655, 19.136328, 19.274745, 19.414946, 19.556974, 19.700873, 19.846689, 19.994468, 20.144260, 20.296115, 20.450087, 20.606231, 20.764604, 20.925266, 21.088278, 21.253707, 21.421618, 21.592084, 21.765177, 21.940974, 22.119557, 22.301010, 22.485420, 22.672882, 22.863491, 23.057350, 23.254567, 23.455255, 23.659532, 23.867524, 24.079364, 24.295192, 24.515156, 24.739412, 24.968128, 25.201479, 25.439655, 25.682855, 25.931293, 26.185196, 26.444810, 26.710396, 26.982235, 27.260631, 27.545908, 27.838422, 28.138553, 28.446718, 28.763369, 29.089000, 29.424154, 29.769426, 30.125473, 30.493024, 30.872890, 31.265974, 31.673293, 32.095997, 32.535388, 32.992958, 33.470424, 33.969784, 34.493376, 35.043972, 35.624899, 36.240199, 36.894871, 37.595217, 38.349366, 39.168111, 40.066313, 41.065417, 42.198418, 43.520998, 45.142004, 47.343203, 53.102988
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                SMA
## 1 1.386294361, 1.609437912, 1.791759469, 1.791759469, 1.945910149, 1.945910149, 2.197224577, 2.197224577, 2.302585093, 2.302585093, 2.302585093, 2.302585093, 2.397895273, 2.397895273, 2.484906650, 2.564949357, 2.564949357, 2.564949357, 2.564949357, 2.564949357, 2.639057330, 2.639057330, 2.639057330, 2.639057330, 2.639057330, 2.708050201, 2.708050201, 2.708050201, 2.708050201, 2.708050201, 2.772588722, 2.772588722, 2.772588722, 2.772588722, 2.772588722, 2.833213344, 2.833213344, 2.833213344, 2.833213344, 2.890371758, 2.890371758, 2.890371758, 2.890371758, 2.944438979, 2.944438979, 2.944438979, 2.944438979, 2.995732274, 2.995732274, 3.044522438, 3.044522438, 3.044522438, 3.044522438, 3.044522438, 3.044522438, 3.091042453, 3.091042453, 3.091042453, 3.091042453, 3.091042453, 3.091042453, 3.135494216, 3.135494216, 3.135494216, 3.178053830, 3.178053830, 3.178053830, 3.218875825, 3.218875825, 3.218875825, 3.218875825, 3.258096538, 3.258096538, 3.295836866, 3.295836866, 3.295836866, 3.295836866, 3.332204510, 3.332204510, 3.332204510, 3.367295830, 3.401197382, 3.401197382, 3.433987204, 3.433987204, 3.526360525, 3.555348061, 3.555348061, 3.555348061, 3.583518938, 3.583518938, 3.583518938, 3.610917913, 3.610917913, 3.610917913, 3.610917913, 3.637586160, 3.637586160, 3.663561646, 3.663561646, 3.713572067, 3.713572067, 3.713572067, 3.713572067, 3.737669618, 3.737669618, 3.737669618, 3.737669618, 3.737669618, 3.761200116, 3.784189634, 3.784189634, 3.806662490, 3.806662490, 3.828641396, 3.850147602, 3.850147602, 3.871201011, 3.871201011, 3.891820298, 3.912023005, 3.912023005, 3.912023005, 3.912023005, 3.912023005, 3.931825633, 3.931825633, 3.951243719, 3.988984047, 3.988984047, 3.988984047, 3.988984047, 4.007333185, 4.007333185, 4.007333185, 4.025351691, 4.025351691, -0.895304167, -0.473648276, -0.246924949, -0.413563898, -0.061746450, -0.311301282, -0.016314700, -0.103238229, -0.154283264, -0.141897055, -0.141897055, -0.075948861, -0.383302283, -0.554140835, 0.017057900, -0.257889186, -0.235848272, -0.190222134, -0.311301282, -0.031991051, -0.047112430, -0.463647609, -0.178429054, -0.201848221, -0.075948861, -0.332136508, -0.116398476, -0.246924949, -0.213320253, -0.178429054, -0.103238229, 0.000000000, -0.089766292, -0.383302283, -0.166454709, 0.321750554, -0.213320253, -0.047112430, -0.154283264, -0.141897055, 0.017057900, -0.089766292, -0.224650010, 0.221583133, -0.075948861, -0.190222134, 0.179853500, -0.178429054, -0.342464683, 0.120392634, -0.166454709, 0.096237148, -0.352740374, -0.047112430, 0.321750554, -0.075948861, -0.129276257, -0.047112430, -0.332136508, 0.017057900, 0.321750554, 0.179853500, -0.268749461, 0.321750554, 0.321750554, 0.221583133, 0.321750554, -0.116398476, 0.000000000, 0.017057900, -0.129276257, -0.075948861, 0.147667544, 0.321750554, 0.321750554, 0.221583133, 0.053987227, 0.120392634, 0.034994002, -0.089766292, 0.147667544, 0.321750554, 0.120392634, 0.321750554, 0.074283491, 0.179853500, 0.321750554, 0.034994002, 0.120392634, 0.221583133, 0.147667544, 0.017057900, 0.221583133, 0.074283491, 0.179853500, -0.031991051, 0.074283491, 0.034994002, 0.179853500, 0.053987227, 0.179853500, 0.321750554, 0.321750554, 0.179853500, 0.321750554, 0.179853500, -0.031991051, 0.321750554, 0.074283491, 0.221583133, 0.179853500, 0.074283491, -0.031991051, 0.120392634, -0.047112430, 0.096237148, 0.096237148, 0.120392634, 0.053987227, 0.096237148, 0.321750554, 0.321750554, 0.321750554, 0.179853500, 0.321750554, 0.321750554, 0.321750554, 0.034994002, 0.321750554, 0.147667544, 0.221583133, 0.179853500, 0.321750554, 0.147667544, 0.034994002, 0.321750554, 0.179853500, 0.848817889, 1.930943814, 2.512800241, 2.085142686, 2.988037180, 2.347586614, 3.104631955, 2.881553835, 2.750553280, 2.782340901, 2.782340901, 2.951588508, 2.162805253, 1.724369955, 3.190278467, 2.484661929, 2.541227115, 2.658320765, 2.347586614, 3.064400604, 3.025593520, 1.956609247, 2.688586196, 2.628483898, 2.951588508, 2.294115672, 2.847779742, 2.512800241, 2.599042396, 2.688586196, 2.881553835, 3.146501547, 2.916127838, 2.162805253, 2.719316822, 3.972233202, 2.599042396, 3.025593520, 2.750553280, 2.782340901, 3.190278467, 2.916127838, 2.569966024, 3.715166324, 2.951588508, 2.658320765, 3.608072556, 2.688586196, 2.267609729, 3.455473846, 2.719316822, 3.393481883, 2.241238484, 3.025593520, 3.972233202, 2.951588508, 2.814730564, 3.025593520, 2.294115672, 3.190278467, 3.972233202, 3.608072556, 2.456790422, 3.972233202, 3.972233202, 3.715166324, 3.972233202, 2.847779742, 3.146501547, 3.190278467, 2.814730564, 2.951588508, 3.525471415, 3.972233202, 3.972233202, 3.715166324, 3.285052862, 3.455473846, 3.236309179, 2.916127838, 3.525471415, 3.972233202, 3.455473846, 3.972233202, 3.337140628, 3.608072556, 3.972233202, 3.236309179, 3.455473846, 3.715166324, 3.525471415, 3.190278467, 3.715166324, 3.337140628, 3.608072556, 3.064400604, 3.337140628, 3.236309179, 3.608072556, 3.285052862, 3.608072556, 3.972233202, 3.972233202, 3.608072556, 3.972233202, 3.608072556, 3.064400604, 3.972233202, 3.337140628, 3.715166324, 3.608072556, 3.337140628, 3.064400604, 3.455473846, 3.025593520, 3.393481883, 3.393481883, 3.455473846, 3.285052862, 3.393481883, 3.972233202, 3.972233202, 3.972233202, 3.608072556, 3.972233202, 3.972233202, 3.972233202, 3.236309179, 3.972233202, 3.525471415, 3.715166324, 3.608072556, 3.972233202, 3.525471415, 3.236309179, 3.972233202, 3.608072556, 0.537476472, -0.321505902, -0.721040772, -0.293383216, -1.042127031, -0.401676465, -0.907407377, -0.684329258, -0.447968187, -0.479755808, -0.479755808, -0.649003415, 0.235090020, 0.673525318, -0.705371817, 0.080287429, 0.023722242, -0.093371408, 0.217362743, -0.499451247, -0.386536191, 0.682448083, -0.049528866, 0.010573431, -0.312531178, 0.413934529, -0.139729541, 0.195249960, 0.109007805, 0.019464006, -0.108965113, -0.373912825, -0.143539116, 0.609783469, 0.053271901, -1.139019858, 0.234170948, -0.192380176, 0.082660064, 0.108030857, -0.299906709, -0.025756080, 0.320405734, -0.770727345, -0.007149529, 0.286118214, -0.663633577, 0.307146078, 0.728122544, -0.410951409, 0.325205616, -0.348959445, 0.803283954, 0.018928917, -0.927710764, 0.139453945, 0.276311890, 0.065448933, 0.796926781, -0.099236014, -0.881190748, -0.472578340, 0.678703794, -0.836738986, -0.794179371, -0.537112494, -0.794179371, 0.371096083, 0.072374278, 0.028597358, 0.404145261, 0.306508030, -0.267374877, -0.676396336, -0.676396336, -0.419329458, 0.010784004, -0.123269336, 0.095895331, 0.416076672, -0.158175585, -0.571035820, -0.054276465, -0.538245997, 0.096846576, -0.081712031, -0.416885140, 0.319038883, 0.099874215, -0.131647386, 0.058047523, 0.393240471, -0.104248411, 0.273777284, 0.002845357, 0.546517308, 0.300445531, 0.401276981, 0.055489090, 0.378508784, 0.105499511, -0.258661135, -0.258661135, 0.105499511, -0.234563583, 0.129597062, 0.673269014, -0.234563583, 0.400528990, 0.046033792, 0.176117078, 0.447049005, 0.742261885, 0.351188644, 0.803047876, 0.456665719, 0.456665719, 0.415727165, 0.586148149, 0.498338416, -0.060210196, -0.060210196, -0.060210196, 0.303950450, -0.060210196, -0.040407569, -0.040407569, 0.714934540, 0.016750845, 0.463512631, 0.273817723, 0.380911491, 0.035099984, 0.481861770, 0.771024006, 0.053118489, 0.417279135, -0.911389297, 0.393880180, 1.158058163, 0.730400608, 1.787445782, 1.146995216, 2.155354985, 1.932276865, 1.906636826, 1.938424447, 1.938424447, 2.107672054, 1.414198979, 0.975763681, 2.528683570, 1.903109739, 1.959674925, 2.076768576, 1.766034424, 2.482848415, 2.518149303, 1.449165029, 2.181141978, 2.121039681, 2.444144290, 1.855664326, 2.409328396, 2.074348895, 2.160591050, 2.250134850, 2.507641010, 2.772588722, 2.542215013, 1.788892428, 2.345403997, 3.658944999, 2.285754193, 2.712305317, 2.437265077, 2.526211112, 2.934148678, 2.659998049, 2.313836235, 3.513103756, 2.749525940, 2.456258197, 3.406009988, 2.537816922, 2.116840456, 3.353494737, 2.617337712, 3.291502773, 2.139259375, 2.923614411, 3.870254092, 2.896129414, 2.759271470, 2.970134427, 2.238656578, 3.134819373, 3.916774108, 3.597065225, 2.445783091, 3.961225870, 4.003785485, 3.746718607, 4.003785485, 2.920154020, 3.218875825, 3.262652745, 2.887104841, 3.063183499, 3.637066406, 4.121568521, 4.121568521, 3.864501643, 3.434388181, 3.641176809, 3.422012142, 3.101830801, 3.746265698, 4.226929036, 3.710169681, 4.259718859, 3.624626286, 3.987931533, 4.381079716, 3.645155693, 3.864320361, 4.152183715, 3.962488807, 3.627295859, 4.179582690, 3.801556994, 4.072488921, 3.528816970, 3.828225241, 3.727393792, 4.125132655, 3.802112961, 4.175143075, 4.539303721, 4.539303721, 4.175143075, 4.563401273, 4.199240627, 3.655568675, 4.563401273, 3.928308700, 4.329864893, 4.245760643, 3.974828715, 3.724561547, 4.115634789, 3.707733370, 4.097127937, 4.097127937, 4.180173310, 4.009752326, 4.138800634, 4.737754660, 4.737754660, 4.737754660, 4.373594014, 4.737754660, 4.757557287, 4.757557287, 4.041051350, 4.814715701, 4.367953915, 4.557648823, 4.450555055, 4.833064840, 4.386303054, 4.097140817, 4.851083345, 4.486922699
# Revised alcc.rev
#
# remove.leverage = "none"
alcc.rev(data_2, stv = STV, ry = RY, target = 90, 
     confidence = 95, summary = T, remove.leverage = "none")
##     n target     cstv lower_cstv upper_cstv confidence       pvalue         r
## 1 137     90 23.25457   21.57156   25.06888         95 7.314913e-23 0.7164928
##   remove.leverage
## 1            none
# plot
alcc_plot.rev(data_2, stv = STV, ry = RY, target = 90, 
     confidence = 95, remove.leverage = "none")

# remove.leverage = "cstv100"
alcc.rev(data_2, stv = STV, ry = RY, target = 90, 
     confidence = 95, summary = T, remove.leverage = "cstv100")
##     n target     cstv lower_cstv upper_cstv confidence       pvalue         r
## 1 128     90 22.74894   21.07941    24.5507         95 1.722875e-20 0.7044885
##   remove.leverage
## 1         cstv100
# plot
alcc_plot.rev(data_2, stv = STV, ry = RY, target = 90, 
     confidence = 95, remove.leverage = "cstv100")

# remove.leverage = "cstv90_2x"
alcc.rev(data_2, stv = STV, ry = RY, target = 90, 
     confidence = 95, summary = T, remove.leverage = "cstv90_2x")
##     n target     cstv lower_cstv upper_cstv confidence       pvalue         r
## 1 115     90 21.98504   20.32021   23.78626         95 5.322914e-17 0.6813117
##   remove.leverage
## 1       cstv90_2x
# plot
alcc_plot.rev(data_2, stv = STV, ry = RY, target = 90, 
     confidence = 95, remove.leverage = "cstv90_2x")

# Austin's original alcc() fails with data_2
# alcc(data_2, soil_test = STV, ry = RY, sufficiency = 90, confidence = 95, summary = T, remove2x = FALSE, sma = TRUE)

7.3. Extra example data_3

Data_3: Austin’s alcc() does not produce the same results than the modALCC() or the Spreadsheet version. Again, this is related to the fact that Austin’s alcc() always remove points STV > CSTV100 when present, so it produces different results than Adrian’s modALCC().

Using the Adrian’s revised alcc.rev() functions, Austin’s alcc() is equivalent to use the alcc.rev(remove.leverage = ‘cstv100’).

# Example 3 dataframe. Imported from xlsx file
data_3 = readxl::read_xlsx(path ="data_3.xlsx", sheet = 1)

# Adrian's modALCC()
modALCC(data = data_3, RY = RY, STV = STV, target=90, confidence = 0.95)
## Warning: 3 STV points exceeded the CSTV for 100%.
##   Risk of leverage. You may consider a sensitivity analysis by removing extreme points, 
##   re-run the modALCC(), and check results.

## Warning: 3 STV points exceeded two-times (2x) 
##   the CSTV for 90%. Risk of leverage. You may consider a sensitivity analysis by 
##   removing extreme points, re-run the modALCC(), and check results.

##     n         r target     CSTV       LL       UL confidence      p_value
## 1 107 0.3735166     90 21.76416 19.35018 24.47929       0.95 7.410056e-05
##     CSTV90 n.90x2 CSTV100 n.100
## 1 21.76416      3 38.7896     3
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Curve
## 1 25.000000, 25.200000, 25.400000, 25.600000, 25.800000, 26.000000, 26.200000, 26.400000, 26.600000, 26.800000, 27.000000, 27.200000, 27.400000, 27.600000, 27.800000, 28.000000, 28.200000, 28.400000, 28.600000, 28.800000, 29.000000, 29.200000, 29.400000, 29.600000, 29.800000, 30.000000, 30.200000, 30.400000, 30.600000, 30.800000, 31.000000, 31.200000, 31.400000, 31.600000, 31.800000, 32.000000, 32.200000, 32.400000, 32.600000, 32.800000, 33.000000, 33.200000, 33.400000, 33.600000, 33.800000, 34.000000, 34.200000, 34.400000, 34.600000, 34.800000, 35.000000, 35.200000, 35.400000, 35.600000, 35.800000, 36.000000, 36.200000, 36.400000, 36.600000, 36.800000, 37.000000, 37.200000, 37.400000, 37.600000, 37.800000, 38.000000, 38.200000, 38.400000, 38.600000, 38.800000, 39.000000, 39.200000, 39.400000, 39.600000, 39.800000, 40.000000, 40.200000, 40.400000, 40.600000, 40.800000, 41.000000, 41.200000, 41.400000, 41.600000, 41.800000, 42.000000, 42.200000, 42.400000, 42.600000, 42.800000, 43.000000, 43.200000, 43.400000, 43.600000, 43.800000, 44.000000, 44.200000, 44.400000, 44.600000, 44.800000, 45.000000, 45.200000, 45.400000, 45.600000, 45.800000, 46.000000, 46.200000, 46.400000, 46.600000, 46.800000, 47.000000, 47.200000, 47.400000, 47.600000, 47.800000, 48.000000, 48.200000, 48.400000, 48.600000, 48.800000, 49.000000, 49.200000, 49.400000, 49.600000, 49.800000, 50.000000, 50.200000, 50.400000, 50.600000, 50.800000, 51.000000, 51.200000, 51.400000, 51.600000, 51.800000, 52.000000, 52.200000, 52.400000, 52.600000, 52.800000, 53.000000, 53.200000, 53.400000, 53.600000, 53.800000, 54.000000, 54.200000, 54.400000, 54.600000, 54.800000, 55.000000, 55.200000, 55.400000, 55.600000, 55.800000, 56.000000, 56.200000, 56.400000, 56.600000, 56.800000, 57.000000, 57.200000, 57.400000, 57.600000, 57.800000, 58.000000, 58.200000, 58.400000, 58.600000, 58.800000, 59.000000, 59.200000, 59.400000, 59.600000, 59.800000, 60.000000, 60.200000, 60.400000, 60.600000, 60.800000, 61.000000, 61.200000, 61.400000, 61.600000, 61.800000, 62.000000, 62.200000, 62.400000, 62.600000, 62.800000, 63.000000, 63.200000, 63.400000, 63.600000, 63.800000, 64.000000, 64.200000, 64.400000, 64.600000, 64.800000, 65.000000, 65.200000, 65.400000, 65.600000, 65.800000, 66.000000, 66.200000, 66.400000, 66.600000, 66.800000, 67.000000, 67.200000, 67.400000, 67.600000, 67.800000, 68.000000, 68.200000, 68.400000, 68.600000, 68.800000, 69.000000, 69.200000, 69.400000, 69.600000, 69.800000, 70.000000, 70.200000, 70.400000, 70.600000, 70.800000, 71.000000, 71.200000, 71.400000, 71.600000, 71.800000, 72.000000, 72.200000, 72.400000, 72.600000, 72.800000, 73.000000, 73.200000, 73.400000, 73.600000, 73.800000, 74.000000, 74.200000, 74.400000, 74.600000, 74.800000, 75.000000, 75.200000, 75.400000, 75.600000, 75.800000, 76.000000, 76.200000, 76.400000, 76.600000, 76.800000, 77.000000, 77.200000, 77.400000, 77.600000, 77.800000, 78.000000, 78.200000, 78.400000, 78.600000, 78.800000, 79.000000, 79.200000, 79.400000, 79.600000, 79.800000, 80.000000, 80.200000, 80.400000, 80.600000, 80.800000, 81.000000, 81.200000, 81.400000, 81.600000, 81.800000, 82.000000, 82.200000, 82.400000, 82.600000, 82.800000, 83.000000, 83.200000, 83.400000, 83.600000, 83.800000, 84.000000, 84.200000, 84.400000, 84.600000, 84.800000, 85.000000, 85.200000, 85.400000, 85.600000, 85.800000, 86.000000, 86.200000, 86.400000, 86.600000, 86.800000, 87.000000, 87.200000, 87.400000, 87.600000, 87.800000, 88.000000, 88.200000, 88.400000, 88.600000, 88.800000, 89.000000, 89.200000, 89.400000, 89.600000, 89.800000, 90.000000, 90.200000, 90.400000, 90.600000, 90.800000, 91.000000, 91.200000, 91.400000, 91.600000, 91.800000, 92.000000, 92.200000, 92.400000, 92.600000, 92.800000, 93.000000, 93.200000, 93.400000, 93.600000, 93.800000, 94.000000, 94.200000, 94.400000, 94.600000, 94.800000, 95.000000, 95.200000, 95.400000, 95.600000, 95.800000, 96.000000, 96.200000, 96.400000, 96.600000, 96.800000, 97.000000, 97.200000, 97.400000, 97.600000, 97.800000, 98.000000, 98.200000, 98.400000, 98.600000, 98.800000, 99.000000, 99.200000, 99.400000, 99.600000, 99.800000, 100.000000, 5.913921, 5.938470, 5.963055, 5.987678, 6.012339, 6.037039, 6.061779, 6.086559, 6.111380, 6.136242, 6.161146, 6.186093, 6.211083, 6.236117, 6.261195, 6.286319, 6.311488, 6.336704, 6.361966, 6.387276, 6.412635, 6.438041, 6.463498, 6.489003, 6.514560, 6.540167, 6.565827, 6.591538, 6.617302, 6.643120, 6.668991, 6.694917, 6.720899, 6.746936, 6.773029, 6.799179, 6.825387, 6.851653, 6.877977, 6.904361, 6.930804, 6.957308, 6.983873, 7.010500, 7.037188, 7.063940, 7.090755, 7.117633, 7.144577, 7.171585, 7.198659, 7.225800, 7.253007, 7.280282, 7.307625, 7.335037, 7.362518, 7.390069, 7.417691, 7.445384, 7.473148, 7.500985, 7.528895, 7.556879, 7.584937, 7.613070, 7.641278, 7.669563, 7.697925, 7.726364, 7.754881, 7.783476, 7.812151, 7.840907, 7.869743, 7.898660, 7.927659, 7.956741, 7.985907, 8.015156, 8.044490, 8.073910, 8.103416, 8.133008, 8.162688, 8.192457, 8.222314, 8.252260, 8.282298, 8.312426, 8.342646, 8.372958, 8.403364, 8.433864, 8.464458, 8.495148, 8.525934, 8.556817, 8.587798, 8.618878, 8.650057, 8.681336, 8.712716, 8.744197, 8.775781, 8.807469, 8.839260, 8.871157, 8.903160, 8.935269, 8.967485, 8.999810, 9.032244, 9.064789, 9.097444, 9.130211, 9.163091, 9.196084, 9.229192, 9.262416, 9.295756, 9.329213, 9.362788, 9.396483, 9.430298, 9.464234, 9.498292, 9.532473, 9.566779, 9.601209, 9.635766, 9.670449, 9.705261, 9.740203, 9.775274, 9.810477, 9.845812, 9.881281, 9.916885, 9.952624, 9.988500, 10.024514, 10.060667, 10.096961, 10.133396, 10.169974, 10.206695, 10.243562, 10.280575, 10.317736, 10.355045, 10.392504, 10.430115, 10.467879, 10.505796, 10.543869, 10.582098, 10.620485, 10.659032, 10.697739, 10.736609, 10.775642, 10.814840, 10.854205, 10.893737, 10.933439, 10.973312, 11.013357, 11.053576, 11.093971, 11.134543, 11.175294, 11.216225, 11.257338, 11.298635, 11.340117, 11.381786, 11.423644, 11.465692, 11.507933, 11.550368, 11.592999, 11.635828, 11.678856, 11.722086, 11.765520, 11.809159, 11.853005, 11.897061, 11.941328, 11.985809, 12.030505, 12.075419, 12.120553, 12.165909, 12.211490, 12.257296, 12.303332, 12.349599, 12.396099, 12.442835, 12.489809, 12.537024, 12.584482, 12.632185, 12.680137, 12.728340, 12.776796, 12.825509, 12.874480, 12.923713, 12.973210, 13.022975, 13.073010, 13.123318, 13.173903, 13.224766, 13.275912, 13.327344, 13.379064, 13.431076, 13.483383, 13.535988, 13.588896, 13.642110, 13.695632, 13.749467, 13.803618, 13.858089, 13.912884, 13.968007, 14.023461, 14.079251, 14.135381, 14.191855, 14.248676, 14.305850, 14.363381, 14.421274, 14.479531, 14.538160, 14.597164, 14.656547, 14.716316, 14.776475, 14.837028, 14.897983, 14.959342, 15.021113, 15.083301, 15.145911, 15.208949, 15.272421, 15.336333, 15.400691, 15.465502, 15.530772, 15.596507, 15.662715, 15.729402, 15.796574, 15.864241, 15.932407, 16.001082, 16.070273, 16.139988, 16.210234, 16.281021, 16.352355, 16.424248, 16.496706, 16.569739, 16.643357, 16.717568, 16.792384, 16.867813, 16.943866, 17.020554, 17.097888, 17.175878, 17.254537, 17.333875, 17.413906, 17.494641, 17.576093, 17.658275, 17.741202, 17.824886, 17.909343, 17.994586, 18.080632, 18.167495, 18.255192, 18.343740, 18.433156, 18.523457, 18.614662, 18.706790, 18.799859, 18.893892, 18.988907, 19.084928, 19.181976, 19.280074, 19.379246, 19.479518, 19.580915, 19.683463, 19.787191, 19.892127, 19.998301, 20.105744, 20.214490, 20.324570, 20.436021, 20.548879, 20.663183, 20.778971, 20.896287, 21.015172, 21.135673, 21.257837, 21.381715, 21.507357, 21.634821, 21.764162, 21.895441, 22.028724, 22.164075, 22.301567, 22.441275, 22.583277, 22.727657, 22.874504, 23.023912, 23.175981, 23.330817, 23.488535, 23.649255, 23.813106, 23.980228, 24.150769, 24.324889, 24.502761, 24.684571, 24.870521, 25.060830, 25.255736, 25.455500, 25.660405, 25.870765, 26.086925, 26.309266, 26.538212, 26.774237, 27.017872, 27.269717, 27.530450, 27.800851, 28.081811, 28.374371, 28.679745, 28.999371, 29.334975, 29.688650, 30.062983, 30.461232, 30.887593, 31.347636, 31.849016, 32.402775, 33.025879, 33.746927, 34.621766, 35.794793, 38.789595
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         SMA
## 1 1.6094379124, 1.7917594692, 1.7917594692, 1.9459101491, 1.9459101491, 2.0794415417, 2.0794415417, 2.1972245773, 2.1972245773, 2.1972245773, 2.1972245773, 2.1972245773, 2.3025850930, 2.3025850930, 2.3025850930, 2.3025850930, 2.3025850930, 2.3025850930, 2.3025850930, 2.3978952728, 2.3978952728, 2.3978952728, 2.3978952728, 2.3978952728, 2.3978952728, 2.3978952728, 2.4849066498, 2.4849066498, 2.4849066498, 2.5649493575, 2.5649493575, 2.5649493575, 2.5649493575, 2.6390573296, 2.6390573296, 2.6390573296, 2.6390573296, 2.6390573296, 2.6390573296, 2.7080502011, 2.7080502011, 2.7080502011, 2.7080502011, 2.7725887222, 2.7725887222, 2.7725887222, 2.7725887222, 2.7725887222, 2.7725887222, 2.7725887222, 2.7725887222, 2.8332133441, 2.8332133441, 2.8332133441, 2.8332133441, 2.8332133441, 2.8332133441, 2.8332133441, 2.8332133441, 2.8903717579, 2.8903717579, 2.8903717579, 2.8903717579, 2.8903717579, 2.8903717579, 2.8903717579, 2.8903717579, 2.8903717579, 2.9444389792, 2.9444389792, 2.9444389792, 2.9444389792, 2.9444389792, 2.9957322736, 2.9957322736, 2.9957322736, 3.0445224377, 3.0445224377, 3.0910424534, 3.0910424534, 3.1354942159, 3.1780538303, 3.1780538303, 3.1780538303, 3.2188758249, 3.2188758249, 3.2580965380, 3.2580965380, 3.2580965380, 3.2580965380, 3.2958368660, 3.2958368660, 3.3322045102, 3.3322045102, 3.3322045102, 3.3672958300, 3.4011973817, 3.4339872045, 3.4339872045, 3.4339872045, 3.4965075615, 3.4965075615, 3.4965075615, 3.5553480615, 3.8918202981, 4.0073331852, 4.1896547420, -0.4035026678, -0.6055446636, -0.3934169016, -0.0897662917, 0.3217505544, -0.5439929355, -0.5439929355, -0.3424646835, 0.0539872272, -0.2687494608, -0.1902221337, -0.5137313196, -0.2901891602, -0.1418970546, -0.3527403738, -0.2018482212, -0.5643265694, -0.2133202528, -0.2469249490, -0.5439929355, -0.1032382286, -0.3321365075, -0.1418970546, -0.0319910515, -0.3424646835, -0.3007828654, -0.3113012820, -0.0163147004, -0.7254469968, -0.4135638984, -0.1418970546, -0.1542832637, -0.0897662917, -0.1664547090, -0.1292762574, 0.3217505544, 0.1476675438, -0.4636476090, -0.3007828654, 0.0349940022, -0.2687494608, 0.3217505544, -0.1784290543, 0.1476675438, -0.1784290543, -0.3934169016, -0.0617464495, -0.2795136623, 0.1476675438, -0.3833022825, -0.5745548442, -0.4636476090, -0.2133202528, -0.1418970546, 0.0962371485, -0.0471124298, -0.1542832637, -0.3007828654, 0.0962371485, 0.3217505544, -0.2246500097, 0.0742834912, -0.4736482758, -0.0163147004, -0.0759488607, -0.0897662917, -0.2133202528, -0.3629686486, -0.6803702690, 0.3217505544, -0.4736482758, -0.1542832637, 0.0349940022, 0.1203926336, -0.0759488607, -0.2469249490, -0.3217505544, 0.0962371485, -0.3113012820, 0.0962371485, -0.0617464495, 0.3217505544, 0.3217505544, -0.3217505544, -0.2246500097, -0.4636476090, -0.0319910515, -0.3629686486, 0.0349940022, -0.4035026678, 0.1203926336, -0.1664547090, -0.0319910515, 0.1798534998, -0.2133202528, -0.2578891860, 0.3217505544, -0.1902221337, -0.1418970546, -0.0617464495, 0.3217505544, 0.3217505544, -0.3629686486, -0.5643265694, 0.3217505544, 0.1798534998, 0.3217505544, 2.3555445368, 1.9926624244, 2.3736593061, 2.9190378763, 3.6581520481, 2.1032138028, 2.1032138028, 2.4651731940, 3.1772296468, 2.5975710929, 2.7386118812, 2.1575658649, 2.5590638341, 2.8254072363, 2.4467173073, 2.7177305827, 2.0666931181, 2.6971259800, 2.6367695027, 2.1032138028, 2.8948412982, 2.4837233488, 2.8254072363, 3.0228064077, 2.4651731940, 2.5400367695, 2.5211449286, 3.0509622740, 1.7773091174, 2.3374738352, 2.8254072363, 2.8031607043, 2.9190378763, 2.7812999037, 2.8480751055, 3.6581520481, 3.3454863056, 2.2475198501, 2.5400367695, 3.1431164338, 2.5975710929, 3.6581520481, 2.7597931090, 3.3454863056, 2.7597931090, 2.3736593061, 2.9693635497, 2.5782378045, 3.3454863056, 2.3918258973, 2.0483223929, 2.2475198501, 2.6971259800, 2.8254072363, 3.2531135768, 2.9956473130, 2.8031607043, 2.5400367695, 3.2531135768, 3.6581520481, 2.6767769129, 3.2136832124, 2.2295579255, 3.0509622740, 2.9438549868, 2.9190378763, 2.6971259800, 2.4283465821, 1.8582701974, 3.6581520481, 2.2295579255, 2.8031607043, 3.1431164338, 3.2964985841, 2.9438549868, 2.6367695027, 2.5023772757, 3.2531135768, 2.5211449286, 3.2531135768, 2.9693635497, 3.6581520481, 3.6581520481, 2.5023772757, 2.6767769129, 2.2475198501, 3.0228064077, 2.4283465821, 3.1431164338, 2.3555445368, 3.2964985841, 2.7812999037, 3.0228064077, 3.4032946224, 2.6971259800, 2.6170769360, 3.6581520481, 2.7386118812, 2.8254072363, 2.9693635497, 3.6581520481, 3.6581520481, 2.4283465821, 2.0666931181, 3.6581520481, 3.4032946224, 3.6581520481, -0.7461066244, -0.2009029552, -0.5818998369, -0.9731277272, -1.7122418990, -0.0237722611, -0.0237722611, -0.2679486167, -0.9800050694, -0.4003465156, -0.5413873038, 0.0396587124, -0.2564787411, -0.5228221433, -0.1441322143, -0.4151454897, 0.2358919749, -0.3945408870, -0.3341844097, 0.2946814700, -0.4969460254, -0.0858280760, -0.4275119635, -0.6249111349, -0.0672779212, -0.1421414967, -0.0362382788, -0.5660556242, 0.7075975324, 0.2274755222, -0.2604578788, -0.2382113469, -0.3540885188, -0.1422425741, -0.2090177759, -1.0190947185, -0.7064289759, 0.3915374795, 0.0990205601, -0.4350662327, 0.1104791082, -0.9501018470, -0.0517429079, -0.5728975833, 0.0127956132, 0.3989294162, -0.1967748275, 0.1943509178, -0.5728975833, 0.3807628249, 0.7242663294, 0.5856934940, 0.1360873641, 0.0078061078, -0.4199002327, -0.1624339689, 0.0300526397, 0.2931765745, -0.4199002327, -0.7677802902, 0.2135948450, -0.3233114545, 0.6608138324, -0.1605905161, -0.0534832289, -0.0286661184, 0.1932457779, 0.4620251758, 1.0861687817, -0.7137130689, 0.7148810537, 0.1412782748, -0.1986774546, -0.3007663106, 0.0518772868, 0.3589627709, 0.5421451620, -0.2085911391, 0.5698975248, -0.1620711234, 0.1661306662, -0.4800982177, -0.4800982177, 0.6756765546, 0.5420989120, 0.9713559748, 0.2352901303, 0.8297499560, 0.1149801042, 0.9025520012, -0.0006617181, 0.5145369623, 0.3093981024, -0.0710901123, 0.6350785302, 0.7502188940, -0.2569546664, 0.6953753233, 0.6085799682, 0.4646236548, -0.1616444866, -0.1616444866, 1.0681609794, 1.4886549434, 0.2336682500, 0.6040385628, 0.5315026939, 0.8847177874, 0.7041572318, 1.0851541134, 1.7846833634, 2.5237975352, 1.1023906826, 1.1023906826, 1.5821331094, 2.2941895622, 1.7145310084, 1.8555717966, 1.2745257803, 1.7813842652, 2.0477276674, 1.6690377384, 1.9400510138, 1.2890135492, 1.9194464111, 1.8590899338, 1.4208444137, 2.2124719091, 1.8013539597, 2.1430378472, 2.3404370186, 1.7828038049, 1.8576673804, 1.9257869165, 2.4556042619, 1.1819511053, 1.8221585308, 2.3100919318, 2.2878453999, 2.4037225718, 2.3400925714, 2.4068677733, 3.2169447158, 2.9042789733, 1.8063125178, 2.0988294373, 2.7709019730, 2.2253566321, 3.2859375873, 2.3875786482, 3.0378103659, 2.4521171694, 2.0659833664, 2.6616876101, 2.2705618648, 3.0378103659, 2.0841499577, 1.7406464532, 2.0004685322, 2.4500746622, 2.5783559184, 3.0060622590, 2.7485959951, 2.5561093865, 2.2929854517, 3.0060622590, 3.4682591441, 2.4868840089, 3.0237903084, 2.0396650215, 2.8610693700, 2.7539620828, 2.7291449723, 2.5072330760, 2.2384536781, 1.7224445147, 3.5223263654, 2.0937322428, 2.6673350216, 3.0072907511, 3.2119661958, 2.8593225984, 2.5522371144, 2.4666350515, 3.2173713526, 2.5319227200, 3.2638913683, 3.0245931037, 3.7559412165, 3.7559412165, 2.6001664442, 2.8153880759, 2.3861310130, 3.2006382839, 2.6061784582, 3.3209483099, 2.5333764130, 3.5120707882, 2.9968721078, 3.2747462560, 3.6552344707, 2.9490658283, 2.9041081041, 3.9790847678, 3.0923344238, 3.1791297788, 3.3230860923, 4.0743949477, 4.0743949477, 2.8445894816, 2.5417765177, 4.4697076843, 4.3303631458, 4.7675421282
# Austin's alcc()
alcc(data_3, soil_test = STV, ry = RY, sufficiency = 90, 
     confidence = 95, summary = T, remove2x = FALSE, sma = TRUE)
## # A tibble: 1 x 9
##   model  sufficiency  cstv lower_cl upper_cl confidence  pvalue pearson remove2x
##   <chr>        <dbl> <dbl>    <dbl>    <dbl>      <dbl>   <dbl>   <dbl> <chr>   
## 1 ALCC-~          90  21.1     18.7     23.7         95 0.00136   0.291 TRUE
# Fixed alcc.rev(remove.leverage = "none")
alcc.rev(data_3, stv = STV, ry = RY, target = 90, 
     confidence = 95, summary = T, remove.leverage = "none")
## # A tibble: 1 x 9
##       n target  cstv lower_cstv upper_cstv confidence    pvalue     r
##   <int>  <dbl> <dbl>      <dbl>      <dbl>      <dbl>     <dbl> <dbl>
## 1   107     90  21.8       19.4       24.5         95 0.0000741 0.374
## # ... with 1 more variable: remove.leverage <chr>
# Fixed alcc.rev(remove.leverage = "cstv100")
alcc.rev(data_3, stv = STV, ry = RY, target = 90, 
     confidence = 95, summary = T, remove.leverage = "cstv100")
## # A tibble: 1 x 9
##       n target  cstv lower_cstv upper_cstv confidence  pvalue     r
##   <int>  <dbl> <dbl>      <dbl>      <dbl>      <dbl>   <dbl> <dbl>
## 1   104     90  21.1       18.7       23.7         95 0.00272 0.291
## # ... with 1 more variable: remove.leverage <chr>
# Fixed alcc.rev(remove.leverage = "cstv90_2x")
alcc.rev(data_3, stv = STV, ry = RY, target = 90, 
     confidence = 95, summary = T, remove.leverage = "cstv90_2x")
## # A tibble: 1 x 9
##       n target  cstv lower_cstv upper_cstv confidence  pvalue     r
##   <int>  <dbl> <dbl>      <dbl>      <dbl>      <dbl>   <dbl> <dbl>
## 1   104     90  21.1       18.7       23.7         95 0.00272 0.291
## # ... with 1 more variable: remove.leverage <chr>
# plot
alcc_plot.rev(data_3, stv = STV, ry = RY, target = 90, 
     confidence = 95, remove.leverage = "none")

alcc_plot.rev(data_3, stv = STV, ry = RY, target = 90, 
     confidence = 95, remove.leverage = "cstv100")

About

Code to estimate soil test critical values following Correndo, A.A., Salvagiotti, F., García, F.O. and Gutiérrez-Boem, F.H., 2017. A modification of the arcsine–log calibration curve for analysing soil test value–relative yield relationships. Crop and Pasture Science, 68(3), pp.297-304. doi: 10.1071/CP16444

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published