R/EvoRAG_Code.R

Defines functions plotGradient.ci power.test TypeI.error parameter.reestimation simulation.analysis sisterContinuous_logSpace_profile_CI Profile.like.CI bootstrap.test expectation.gradient expectation.time sim.sisters model.test.sisters MScorrection find.mle.sister sisterContinuous sisterContinuous_logSpace starting.values

Documented in bootstrap.test expectation.gradient expectation.time find.mle.sister model.test.sisters MScorrection parameter.reestimation plotGradient.ci power.test Profile.like.CI sim.sisters simulation.analysis sisterContinuous sisterContinuous_logSpace sisterContinuous_logSpace_profile_CI starting.values TypeI.error

starting.values <- function(MODEL){
      if(MODEL == "BM_null"){
         p_matrix <- c(
            0.00001,
            0.0001,
            0.001,
            0.01,
            0.02,
            0.04,
            0.06,
            0.08,
            0.1,
            0.2,
            0.3,
            0.4,
            0.5,
            0.6,
            0.7,
            0.8,
            0.9,
            1.0,
            2.0,
            5.0,
            10.0,
            100.0,
            1000,
            10000
         )
         p_starting <- matrix(p_matrix, length(p_matrix), 1, byrow=TRUE)
         result_matrix <- matrix(NA, nrow(p_starting), 3)
         result_matrix[,1] <- p_starting
      }
      if(MODEL == "BM_linear"){
         p_matrix <- c(
            0.01, 0.01,
            0.01, 0.1,
            0.01, 0.5,
            0.01,-0.01,
            0.01, -0.1,
            0.01, -0.5,
            0.1, 0.01,
            0.1, 0.1,
            0.1, 0.5,
            0.1,-0.01,
            0.1, -0.1,
            0.1, -0.5,
            0.5, 0.01,
            0.5, 0.1,
            0.5, 0.5,
            0.5,-0.01,
            0.5, -0.1,
            0.5, -0.5,
            1.0, 0.01,
            1.0, 0.1,
            1.0, 0.5,
            1.0,-0.01,
            1.0, -0.1,
            1.0, -0.5,
            10.0, 0.01,
            10.0, 0.1,
            10.0, 0.5,
            10.0,-0.01,
            10.0, -0.1,
            10.0, -0.5,
            100.0, 0.01,
            100.0, 0.1,
            100.0, 0.5,
            100.0,-0.01,
            100.0, -0.1,
            100.0, -0.5,
            1.0, 1,
            1.0, 5,
            1.0, 10,
            1.0,-1,
            1.0, -5,
            1.0, -10,
            10.0, 1,
            10.0, 5,
            10.0, 10,
            10.0,-1,
            10.0, -5,
            10.0, -10,
            100.0, 1,
            100.0, 5,
            100.0, 10,
            100.0,-1,
            100.0, -5,
            100.0, -10
         )
         p_starting <- matrix(p_matrix, length(p_matrix)/2, 2, byrow=TRUE)
         result_matrix <- matrix(NA, nrow(p_starting), 3)
         result_matrix[,1:2] <- p_starting
      }
     if(MODEL == "BM_linear_2"){
         A <- c(0.01, 0.1, 0.5, 1, 10, 100)
         B <- c(-10, -5, -1, -0.5, -0.1, -0.01, 0, 0.01, 0.1, 0.5, 1, 5, 10)
         C <- c(-10, -5, -1, -0.5, -0.1, -0.01, 0, 0.01, 0.1, 0.5, 1, 5, 10)
         NROW <- length(A) * length(B) * length(C)
         result_matrix <- matrix(NA, nrow = NROW, 4)
         count <- 1
         for(i in 1:length(A)){
            AA <- A[i]
            for(p in 1:length(B)){
               BB <- B[p]
               for(z in 1:length(C)){
                  CC <- C[z]
                  result_matrix[count,c(1:3)] <- c(AA, BB, CC)
                  count = count + 1
               }
            }
         }
      }
     if(MODEL == "BM_linear_3"){
         A <- c(0.01, 0.1, 0.5, 1, 10)
         B <- c(-5, -1, -0.5, -0.1, -0.01, 0, 0.01, 0.1, 0.5, 1, 5)
         C <- c(-5, -1, -0.5, -0.1, -0.01, 0, 0.01, 0.1, 0.5, 1, 5)
         D <- c(-1, -0.5, -0.1, -0.001, 0, 0.001,  0.1, 0.5, 1)
         NROW <- length(A) * length(B) * length(C) * length(D)
         result_matrix <- matrix(NA, nrow = NROW, 5)
         count <- 1
         for(i in 1:length(A)){
            AA <- A[i]
            for(p in 1:length(B)){
               BB <- B[p]
               for(z in 1:length(C)){
                  CC <- C[z]
                  for(r in 1:length(D)){
                     DD <- D[r]
                     result_matrix[count,c(1:4)] <- c(AA, BB, CC, DD)
                     count = count + 1
                  }
               }
            }
         }
      }

   ###
      if(MODEL == "OU_null"){
         p_matrix <- c(
            100,	0.001,
            100,	0.01,
            100,	0.1,
            100,	1,
            100,	10,
            10,	0.001,
            10,	0.01,
            10,	0.1,
            10,	1,
            1,	0.001,
            1,	0.01,
            1,	0.1,
            1,	1,
            0.5,	0.001,
            0.5,	0.01,
            0.5,	0.1,
            0.5,	1,
            0.1,	0.001,
            0.1,	0.01,
            0.1,	0.1,
            0.1,	1,	
            0.01,	0.001,
            0.01,	0.01,
            0.01,	0.1,
            0.01,	1
         )
         p_starting <- matrix(p_matrix, length(p_matrix)/2, 2, byrow=TRUE)
         result_matrix <- matrix(NA, nrow(p_starting), 3)
         result_matrix[,1:2] <- p_starting
      }

      if(MODEL == "OU_linear_beta"){
         A <- c(0.01, 0.1, 0.5, 1, 10,100)
         B <- c(0.001, -0.001, 0.01, -0.01, 0.1, -0.1, -1, 1, 10, -10, 100, -100)
         C <- c(0.001, 0.01,   0.1,   0.5,1,5,10, 20)
         NROW <- length(A) * length(B) * length(C)
         result_matrix <- matrix(NA, nrow = NROW, 4)
         count <- 1
         for(i in 1:length(A)){
            AA <- A[i]
            for(p in 1:length(B)){
               BB <- B[p]
               for(z in 1:length(C)){
                  CC <- C[z]
                  result_matrix[count,c(1:3)] <- c(AA, BB, CC)
                  count = count + 1
               }
            }
         }
      }
 
      if(MODEL == "OU_linear_beta_2"){
         A <- c(0.01, 0.1, 0.5, 1, 10)
         B <- c(0.001, -0.001, 0.01, -0.01, 0.1, -0.1, -1, 1)
         C <- c(0.001, -0.001, 0.01, -0.01, 0.1, -0.1, -1, 1)
         D <- c(0.001, 0.01,   0.1,   0.5,1,5,10)
         NROW <- length(A) * length(B) * length(C) * length(D)
         result_matrix <- matrix(NA, nrow = NROW, 5)
         count <- 1
         for(i in 1:length(A)){
            AA <- A[i]
            for(p in 1:length(B)){
               BB <- B[p]
               for(z in 1:length(C)){
                  CC <- C[z]
                  for(r in 1:length(D)){
                     DD <- D[r]
                     result_matrix[count,c(1:4)] <- c(AA, BB, CC, DD)
                     count = count + 1
                  }
               }
            }
         }
      }
 
      if(MODEL == "OU_linear_beta_3"){
         A <- c(0.01, 0.1, 1, 10)
         B <- c(0.01, -0.01, 0.1, -0.1, -1, 1)
         C <- c(0.01, -0.01, 0.1, -0.1, -1, 1)
         D <- c(0.001, -0.001, 0.01, -0.01, 0.1, -0.1)
         E <- c(0.001, 0.01,   0.1,   0.5,1,5,10)
         NROW <- length(A) * length(B) * length(C) * length(D) * length(E)
         result_matrix <- matrix(NA, nrow = NROW, 6)
         count <- 1
         for(i in 1:length(A)){
            AA <- A[i]
            for(p in 1:length(B)){
               BB <- B[p]
               for(z in 1:length(C)){
                  CC <- C[z]
                  for(r in 1:length(D)){
                     DD <- D[r]
                     for(h in 1:length(E)){
                        EE <- E[h]
                        result_matrix[count,c(1:5)] <- c(AA, BB, CC, DD, EE)
                        count = count + 1
                     }
                  }
               }
            }
         }
      }

      if(MODEL == "OU_linear"){
         p_matrix <- c(
            10,	0.01,	0.01,	0.01,
            10,	0.01,	0.1,	0.01,
            10,	0.01,	0.5,	0.01,
            10,	0.01,	1,	0.01,
            10,	0.01,	5,	0.01,
            10,	0.01,	10,	0.01,
            10,	0.1,	0.01,	0.01,
            10,	0.1,	0.1,	0.01,
            10,	0.1,	0.5,	0.01,
            10,	0.1,	1,	0.01,
            10,	0.1,	5,	0.01,
            10,	0.1,	10,	0.01,
            10,	0.01,	0.01,	0.1,
            10,	0.01,	0.1,	0.1,
            10,	0.01,	0.5,	0.1,
            10,	0.01,	1,	0.1,
            10,	0.01,	5,	0.1,
            10,	0.01,	10,	0.1,
            10,	0.001,	0.01,	0.001,
            10,	0.001,	0.1,	0.001,
            10,	0.001,	0.5,	0.001,
            10,	0.001,	1,	0.001,
            10,	0.001,	5,	0.001,
            10,	0.001,	10,	0.001,

            10,	-0.01,	0.01,	0.01,
            10,	-0.01,	0.1,	0.01,
            10,	-0.01,	0.5,	0.01,
            10,	-0.01,	1,	0.01,
            10,	-0.01,	5,	0.01,
            10,	-0.01,	10,	0.01,
            10,	-0.1,	0.01,	0.01,
            10,	-0.1,	0.1,	0.01,
            10,	-0.1,	0.5,	0.01,
            10,	-0.1,	1,	0.01,
            10,	-0.1,	5,	0.01,
            10,	-0.1,	10,	0.01,
            10,	-0.01,	0.01,	0.1,
            10,	-0.01,	0.1,	0.1,
            10,	-0.01,	0.5,	0.1,
            10,	-0.01,	1,	0.1,
            10,	-0.01,	5,	0.1,
            10,	-0.01,	10,	0.1,
            10,	-0.001,	0.01,	0.001,
            10,	-0.001,	0.1,	0.001,
            10,	-0.001,	0.5,	0.001,
            10,	-0.001,	1,	0.001,
            10,	-0.001,	5,	0.001,
            10,	-0.001,	10,	0.001,

            10,	0.01,	0.01,	-0.01,
            10,	0.01,	0.1,	-0.01,
            10,	0.01,	0.5,	-0.01,
            10,	0.01,	1,	-0.01,
            10,	0.01,	5,	-0.01,
            10,	0.01,	10,	-0.01,
            10,	0.1,	0.01,	-0.01,
            10,	0.1,	0.1,	-0.01,
            10,	0.1,	0.5,	-0.01,
            10,	0.1,	1,	-0.01,
            10,	0.1,	5,	-0.01,
            10,	0.1,	10,	-0.01,
            10,	0.01,	0.01,	-0.1,
            10,	0.01,	0.1,	-0.1,
            10,	0.01,	0.5,	-0.1,
            10,	0.01,	1,	-0.1,
            10,	0.01,	5,	-0.1,
            10,	0.01,	10,	-0.1,
            10,	0.001,	0.01,	-0.001,
            10,	0.001,	0.1,	-0.001,
            10,	0.001,	0.5,	-0.001,
            10,	0.001,	1,	-0.001,
            10,	0.001,	5,	-0.001,
            10,	0.001,	10,	-0.001,


            10,	-0.01,	0.01,	-0.01,
            10,	-0.01,	0.1,	-0.01,
            10,	-0.01,	0.5,	-0.01,
            10,	-0.01,	1,	-0.01,
            10,	-0.01,	5,	-0.01,
            10,	-0.01,	10,	-0.01,
            10,	-0.1,	0.01,	-0.01,
            10,	-0.1,	0.1,	-0.01,
            10,	-0.1,	0.5,	-0.01,
            10,	-0.1,	1,	-0.01,
            10,	-0.1,	5,	-0.01,
            10,	-0.1,	10,	-0.01,
            10,	-0.01,	0.01,	-0.1,
            10,	-0.01,	0.1,	-0.1,
            10,	-0.01,	0.5,	-0.1,
            10,	-0.01,	1,	-0.1,
            10,	-0.01,	5,	-0.1,
            10,	-0.01,	10,	-0.1,
            10,	-0.001,	0.01,	-0.001,
            10,	-0.001,	0.1,	-0.001,
            10,	-0.001,	0.5,	-0.001,
            10,	-0.001,	1,	-0.001,
            10,	-0.001,	5,	-0.001,
            10,	-0.001,	10,	-0.001,

           10,	0.01,	0.01,	0.01,
            1,	0.01,	0.1,	0.01,
            1,	0.01,	0.5,	0.01,
            1,	0.01,	1,	0.01,
            1,	0.01,	5,	0.01,
            1,	0.01,	10,	0.01,
            1,	0.1,	0.01,	0.01,
            1,	0.1,	0.1,	0.01,
            1,	0.1,	0.5,	0.01,
            1,	0.1,	1,	0.01,
            1,	0.1,	5,	0.01,
            1,	0.1,	10,	0.01,
            1,	0.01,	0.01,	0.1,
            1,	0.01,	0.1,	0.1,
            1,	0.01,	0.5,	0.1,
            1,	0.01,	1,	0.1,
            1,	0.01,	5,	0.1,
            1,	0.01,	10,	0.1,
            1,	0.001,	0.01,	0.001,
            1,	0.001,	0.1,	0.001,
            1,	0.001,	0.5,	0.001,
            1,	0.001,	1,	0.001,
            1,	0.001,	5,	0.001,
            1,	0.001,	10,	0.001,

            1,	-0.01,	0.01,	0.01,
            1,	-0.01,	0.1,	0.01,
            1,	-0.01,	0.5,	0.01,
            1,	-0.01,	1,	0.01,
            1,	-0.01,	5,	0.01,
            1,	-0.01,	10,	0.01,
            1,	-0.1,	0.01,	0.01,
            1,	-0.1,	0.1,	0.01,
            1,	-0.1,	0.5,	0.01,
            1,	-0.1,	1,	0.01,
            1,	-0.1,	5,	0.01,
            1,	-0.1,	10,	0.01,
            1,	-0.01,	0.01,	0.1,
            1,	-0.01,	0.1,	0.1,
            1,	-0.01,	0.5,	0.1,
            1,	-0.01,	1,	0.1,
            1,	-0.01,	5,	0.1,
            1,	-0.01,	10,	0.1,
            1,	-0.001,	0.01,	0.001,
            1,	-0.001,	0.1,	0.001,
            1,	-0.001,	0.5,	0.001,
            1,	-0.001,	1,	0.001,
            1,	-0.001,	5,	0.001,
            1,	-0.001,	10,	0.001,

            1,	0.01,	0.01,	-0.01,
            1,	0.01,	0.1,	-0.01,
            1,	0.01,	0.5,	-0.01,
            1,	0.01,	1,	-0.01,
            1,	0.01,	5,	-0.01,
            1,	0.01,	10,	-0.01,
            1,	0.1,	0.01,	-0.01,
            1,	0.1,	0.1,	-0.01,
            1,	0.1,	0.5,	-0.01,
            1,	0.1,	1,	-0.01,
            1,	0.1,	5,	-0.01,
            1,	0.1,	10,	-0.01,
            1,	0.01,	0.01,	-0.1,
            1,	0.01,	0.1,	-0.1,
            1,	0.01,	0.5,	-0.1,
            1,	0.01,	1,	-0.1,
            1,	0.01,	5,	-0.1,
            1,	0.01,	10,	-0.1,
            1,	0.001,	0.01,	-0.001,
            1,	0.001,	0.1,	-0.001,
            1,	0.001,	0.5,	-0.001,
            1,	0.001,	1,	-0.001,
            1,	0.001,	5,	-0.001,
            1,	0.001,	10,	-0.001,


            1,	-0.01,	0.01,	-0.01,
            1,	-0.01,	0.1,	-0.01,
            1,	-0.01,	0.5,	-0.01,
            1,	-0.01,	1,	-0.01,
            1,	-0.01,	5,	-0.01,
            1,	-0.01,	10,	-0.01,
            1,	-0.1,	0.01,	-0.01,
            1,	-0.1,	0.1,	-0.01,
            1,	-0.1,	0.5,	-0.01,
            1,	-0.1,	1,	-0.01,
            1,	-0.1,	5,	-0.01,
            1,	-0.1,	10,	-0.01,
            1,	-0.01,	0.01,	-0.1,
            1,	-0.01,	0.1,	-0.1,
            1,	-0.01,	0.5,	-0.1,
            1,	-0.01,	1,	-0.1,
            1,	-0.01,	5,	-0.1,
            1,	-0.01,	10,	-0.1,
            1,	-0.001,	0.01,	-0.001,
            1,	-0.001,	0.1,	-0.001,
            1,	-0.001,	0.5,	-0.001,
            1,	-0.001,	1,	-0.001,
            1,	-0.001,	5,	-0.001,
            1,	-0.001,	10,	-0.001, 


            0.01,	0.01,	0.001,	0.01,
            0.01,	0.01,	0.1,	0.01,
            0.01,	0.01,	0.5,	0.01,
            0.1,	0.01,	0.01,	0.01,
            0.1,	0.01,	0.1,	0.01,
            0.1,	0.01,	0.5,	0.01,
            0.5,	0.01,	0.01,	0.01,
            0.5,	0.01,	0.1,	0.01,
            0.5,	0.01,	0.5,	0.01,
            0.01,	0.1,	0.01,	0.1,
            0.01,	0.1,	0.1,	0.1,
            0.01,	0.1,	0.5,	0.1,
            0.1,	0.1,	0.01,	0.1,
            0.1,	0.1,	0.1,	0.1,
            0.1,	0.1,	0.5,	0.1,
            0.5,	0.1,	0.01,	0.1,
            0.5,	0.1,	0.1,	0.1,
            0.5,	0.1,	0.5,	0.1,
            0.01,	0.1,	0.01,	0.01,
            0.01,	0.1,	0.1,	0.01,
            0.01,	0.1,	0.5,	0.01,
            0.1,	0.1,	0.01,	0.01,
            0.1,	0.1,	0.1,	0.01,
            0.1,	0.1,	0.5,	0.01,
            0.5,	0.1,	0.01,	0.01,
            0.5,	0.1,	0.1,	0.01,
            0.5,	0.1,	0.5,	0.01,
            0.01,	0.1,	0.01,	0.01,
            0.01,	0.1,	0.1,	0.01,
            0.01,	0.1,	0.5,	0.01,
            0.1,	0.1,	0.01,	0.01,
            0.1,	0.1,	0.1,	0.01,
            0.1,	0.1,	0.5,	0.01,
            0.5,	0.1,	0.01,	0.01,
            0.5,	0.1,	0.1,	0.01,
            0.5,	0.1,	0.5,	0.01,
            0.01,	-0.01,	0.01,	-0.01,
            0.01,	-0.01,	0.1,	-0.01,
            0.01,	-0.01,	0.5,	-0.01,
            0.1,	-0.01,	0.01,	-0.01,
            0.1,	-0.01,	0.1,	-0.01,
            0.1,	-0.01,	0.5,	-0.01,
            0.5,	-0.01,	0.01,	-0.01,
            0.5,	-0.01,	0.1,	-0.01,
            0.5,	-0.01,	0.5,	-0.01,
            0.01,	-0.1,	0.01,	-0.1,
            0.01,	-0.1,	0.1,	-0.1,
            0.01,	-0.1,	0.5,	-0.1,
            0.1,	-0.1,	0.01,	-0.1,
            0.1,	-0.1,	0.1,	-0.1,
            0.1,	-0.1,	0.5,	-0.1,
            0.5,	-0.1,	0.01,	-0.1,
            0.5,	-0.1,	0.1,	-0.1,
            0.5,	-0.1,	0.5,	-0.1,
            0.01,	-0.1,	0.01,	-0.01,
            0.01,	-0.1,	0.1,	-0.01,
            0.01,	-0.1,	0.5,	-0.01,
            0.1,	-0.1,	0.01,	-0.01,
            0.1,	-0.1,	0.1,	-0.01,
            0.1,	-0.1,	0.5,	-0.01,
            0.5,	-0.1,	0.01,	-0.01,
            0.5,	-0.1,	0.1,	-0.01,
            0.5,	-0.1,	0.5,	-0.01,
            0.01,	-0.1,	0.01,	-0.01,
            0.01,	-0.1,	0.1,	-0.01,
            0.01,	-0.1,	0.5,	-0.01,
            0.1,	-0.1,	0.01,	-0.01,
            0.1,	-0.1,	0.1,	-0.01,
            0.1,	-0.1,	0.5,	-0.01,
            0.5,	-0.1,	0.01,	-0.01,
            0.5,	-0.1,	0.1,	-0.01,
            0.5,	-0.1,	0.5,	-0.01,
            0.01,	0.01,	0.01,	-0.01,
            0.01,	0.01,	0.1,	-0.01,
            0.01,	0.01,	0.5,	-0.01,
            0.1,	0.01,	0.01,	-0.01,
            0.1,	0.01,	0.1,	-0.01,
            0.1,	0.01,	0.5,	-0.01,
            0.5,	0.01,	0.01,	-0.01,
            0.5,	0.01,	0.1,	-0.01,
            0.5,	0.01,	0.5,	-0.01,
            0.01,	0.1,	0.01,	-0.1,
            0.01,	0.1,	0.1,	-0.1,
            0.01,	0.1,	0.5,	-0.1,
            0.1,	0.1,	0.01,	-0.1,
            0.1,	0.1,	0.1,	-0.1,
            0.1,	0.1,	0.5,	-0.1,
            0.5,	0.1,	0.01,	-0.1,
            0.5,	0.1,	0.1,	-0.1,
            0.5,	0.1,	0.5,	-0.1,
            0.01,	0.1,	0.01,	-0.01,
            0.01,	0.1,	0.1,	-0.01,
            0.01,	0.1,	0.5,	-0.01,
            0.1,	0.1,	0.01,	-0.01,
            0.1,	0.1,	0.1,	-0.01,
            0.1,	0.1,	0.5,	-0.01,
            0.5,	0.1,	0.01,	-0.01,
            0.5,	0.1,	0.1,	-0.01,
            0.5,	0.1,	0.5,	-0.01,
            0.01,	0.1,	0.01,	-0.01,
            0.01,	0.1,	0.1,	-0.01,
            0.01,	0.1,	0.5,	-0.01,
            0.1,	0.1,	0.01,	-0.01,
            0.1,	0.1,	0.1,	-0.01,
            0.1,	0.1,	0.5,	-0.01,
            0.5,	0.1,	0.01,	-0.01,
            0.5,	0.1,	0.1,	-0.01,
            0.5,	0.1,	0.5,	-0.01,
            0.01,	-0.01,	0.01,	0.01,
            0.01,	-0.01,	0.1,	0.01,
            0.01,	-0.01,	0.5,	0.01,
            0.1,	-0.01,	0.01,	0.01,
            0.1,	-0.01,	0.1,	0.01,
            0.1,	-0.01,	0.5,	0.01,
            0.5,	-0.01,	0.01,	0.01,
            0.5,	-0.01,	0.1,	0.01,
            0.5,	-0.01,	0.5,	0.01,
            0.01,	-0.1,	0.01,	0.1,
            0.01,	-0.1,	0.1,	0.1,
            0.01,	-0.1,	0.5,	0.1,
            0.1,	-0.1,	0.01,	0.1,
            0.1,	-0.1,	0.1,	0.1,
            0.1,	-0.1,	0.5,	0.1,
            0.5,	-0.1,	0.01,	0.1,
            0.5,	-0.1,	0.1,	0.1,
            0.5,	-0.1,	0.5,	0.1,
            0.01,	-0.1,	0.01,	0.01,
            0.01,	-0.1,	0.1,	0.01,
            0.01,	-0.1,	0.5,	0.01,
            0.1,	-0.1,	0.01,	0.01,
            0.1,	-0.1,	0.1,	0.01,
            0.1,	-0.1,	0.5,	0.01,
            0.5,	-0.1,	0.01,	0.01,
            0.5,	-0.1,	0.1,	0.01,
            0.5,	-0.1,	0.5,	0.01,
            0.01,	-0.1,	0.01,	0.01,
            0.01,	-0.1,	0.1,	0.01,
            0.01,	-0.1,	0.5,	0.01,
            0.1,	-0.1,	0.01,	0.01,
            0.1,	-0.1,	0.1,	0.01,
            0.1,	-0.1,	0.5,	0.01,
            0.5,	-0.1,	0.01,	0.01,
            0.5,	-0.1,	0.1,	0.01,
            0.5,	-0.1,	0.5,	0.01
         )
         p_starting <- matrix(p_matrix, length(p_matrix)/4, 4, byrow=TRUE)
         result_matrix <- matrix(NA, nrow(p_starting), 5)
         result_matrix[,1:4] <- p_starting
      }

      if(MODEL == "BM_linear_breakpoint"){
         p_matrix <- c(
            0.0001,	0.0001,	20,	0.0001,
            0.1,	0.0001,	20,	0.0001,
            1,	0.0001,	20,	0.0001,
            10,	0.0001,	20,	0.0001,
            100,	0.0001,	20,	0.0001,
            0.0001,	0.01,	20,	0.0001,
            0.1,	0.01,	20,	0.0001,
            1,	0.01,	20,	0.0001,
            10,	0.01,	20,	0.0001,
            100,	0.01,	20,	0.0001,
            0.0001,	0.1,	20,	0.0001,
            0.1,	0.1,	20,	0.0001,
            1,	0.1,	20,	0.0001,
            10,	0.1,	20,	0.0001,
            100,	0.1,	20,	0.0001,
            0.0001,	1,	20,	0.0001,
            0.1,	1,	20,	0.0001,
            1,	1,	20,	0.0001,
            10,	1,	20,	0.0001,
            100,	1,	20,	0.0001,
            0.0001,	-0.0001,	20,	0.0001,
            0.1,	-0.0001,	20,	0.0001,
            1,	-0.0001,	20,	0.0001,
            10,	-0.0001,	20,	0.0001,
            100,	-0.0001,	20,	0.0001,
            0.0001,	-0.01,	20,	0.0001,
            0.1,	-0.01,	20,	0.0001,
            1,	-0.01,	20,	0.0001,
            10,	-0.01,	20,	0.0001,
            100,	-0.01,	20,	0.0001,
            0.0001,	-0.1,	20,	0.0001,
            0.1,	-0.1,	20,	0.0001,
            1,	-0.1,	20,	0.0001,
            10,	-0.1,	20,	0.0001,
            100,	-0.1,	20,	0.0001,
            0.0001,	-1,	20,	0.0001,
            0.1,	-1,	20,	0.0001,
            1,	-1,	20,	0.0001,
            10,	-1,	20,	0.0001,
            100,	-1,	20,	0.0001,
            0.0001,	0.0001,	20,	0.01,
            0.1,	0.0001,	20,	0.01,
            1,	0.0001,	20,	0.01,
            10,	0.0001,	20,	0.01,
            100,	0.0001,	20,	0.01,
            0.0001,	0.01,	20,	0.01,
            0.1,	0.01,	20,	0.01,
            1,	0.01,	20,	0.01,
            10,	0.01,	20,	0.01,
            100,	0.01,	20,	0.01,
            0.0001,	0.1,	20,	0.01,
            0.1,	0.1,	20,	0.01,
            1,	0.1,	20,	0.01,
            10,	0.1,	20,	0.01,
            100,	0.1,	20,	0.01,
            0.0001,	1,	20,	0.01,
            0.1,	1,	20,	0.01,
            1,	1,	20,	0.01,
            10,	1,	20,	0.01,
            100,	1,	20,	0.01,
            0.0001,	-0.0001,	20,	0.01,
            0.1,	-0.0001,	20,	0.01,
            1,	-0.0001,	20,	0.01,
            10,	-0.0001,	20,	0.01,
            100,	-0.0001,	20,	0.01,
            0.0001,	-0.01,	20,	0.01,
            0.1,	-0.01,	20,	0.01,
            1,	-0.01,	20,	0.01,
            10,	-0.01,	20,	0.01,
            100,	-0.01,	20,	0.01,
            0.0001,	-0.1,	20,	0.01,
            0.1,	-0.1,	20,	0.01,
            1,	-0.1,	20,	0.01,
            10,	-0.1,	20,	0.01,
            100,	-0.1,	20,	0.01,
            0.0001,	-1,	20,	0.01,
            0.1,	-1,	20,	0.01,
            1,	-1,	20,	0.01,
            10,	-1,	20,	0.01,
            100,	-1,	20,	0.01,
            0.0001,	0.0001,	20,	0.1,
            0.1,	0.0001,	20,	0.1,
            1,	0.0001,	20,	0.1,
            10,	0.0001,	20,	0.1,
            100,	0.0001,	20,	0.1,
            0.0001,	0.01,	20,	0.1,
            0.1,	0.01,	20,	0.1,
            1,	0.01,	20,	0.1,
            10,	0.01,	20,	0.1,
            100,	0.01,	20,	0.1,
            0.0001,	0.1,	20,	0.1,
            0.1,	0.1,	20,	0.1,
            1,	0.1,	20,	0.1,
            10,	0.1,	20,	0.1,
            100,	0.1,	20,	0.1,
            0.0001,	1,	20,	0.1,
            0.1,	1,	20,	0.1,
            1,	1,	20,	0.1,
            10,	1,	20,	0.1,
            100,	1,	20,	0.1,
            0.0001,	-0.0001,	20,	0.1,
            0.1,	-0.0001,	20,	0.1,
            1,	-0.0001,	20,	0.1,
            10,	-0.0001,	20,	0.1,
            100,	-0.0001,	20,	0.1,
            0.0001,	-0.01,	20,	0.1,
            0.1,	-0.01,	20,	0.1,
            1,	-0.01,	20,	0.1,
            10,	-0.01,	20,	0.1,
            100,	-0.01,	20,	0.1,
            0.0001,	-0.1,	20,	0.1,
            0.1,	-0.1,	20,	0.1,
            1,	-0.1,	20,	0.1,
            10,	-0.1,	20,	0.1,
            100,	-0.1,	20,	0.1,
            0.0001,	-1,	20,	0.1,
            0.1,	-1,	20,	0.1,
            1,	-1,	20,	0.1,
            10,	-1,	20,	0.1,
            100,	-1,	20,	0.1,
            0.0001,	0.0001,	20,	0.0001,
            0.1,	0.0001,	20,	0.0001,
            1,	0.0001,	20,	0.0001,
            10,	0.0001,	20,	0.0001,
            100,	0.0001,	20,	0.0001,
            0.0001,	0.01,	20,	0.0001,
            0.1,	0.01,	20,	0.0001,
            1,	0.01,	20,	0.0001,
            10,	0.01,	20,	0.0001,
            100,	0.01,	20,	0.0001,
            0.0001,	0.1,	20,	0.0001,
            0.1,	0.1,	20,	0.0001,
            1,	0.1,	20,	0.0001,
            10,	0.1,	20,	0.0001,
            100,	0.1,	20,	0.0001,
            0.0001,	1,	20,	0.0001,
            0.1,	1,	20,	0.0001,
            1,	1,	20,	0.0001,
            10,	1,	20,	0.0001,
            100,	1,	20,	0.0001,
            0.0001,	-0.0001,	20,	0.0001,
            0.1,	-0.0001,	20,	0.0001,
            1,	-0.0001,	20,	0.0001,
            10,	-0.0001,	20,	0.0001,
            100,	-0.0001,	20,	0.0001,
            0.0001,	-0.01,	20,	0.0001,
            0.1,	-0.01,	20,	0.0001,
            1,	-0.01,	20,	0.0001,
            10,	-0.01,	20,	0.0001,
            100,	-0.01,	20,	0.0001,
            0.0001,	-0.1,	20,	0.0001,
            0.1,	-0.1,	20,	0.0001,
            1,	-0.1,	20,	0.0001,
            10,	-0.1,	20,	0.0001,
            100,	-0.1,	20,	0.0001,
            0.0001,	-1,	20,	0.0001,
            0.1,	-1,	20,	0.0001,
            1,	-1,	20,	0.0001,
            10,	-1,	20,	0.0001,
            100,	-1,	20,	0.0001,
            0.0001,	0.0001,	20,	-0.0001,
            0.1,	0.0001,	20,	-0.0001,
            1,	0.0001,	20,	-0.0001,
            10,	0.0001,	20,	-0.0001,
            100,	0.0001,	20,	-0.0001,
            0.0001,	0.01,	20,	-0.0001,
            0.1,	0.01,	20,	-0.0001,
            1,	0.01,	20,	-0.0001,
            10,	0.01,	20,	-0.0001,
            100,	0.01,	20,	-0.0001,
            0.0001,	0.1,	20,	-0.0001,
            0.1,	0.1,	20,	-0.0001,
            1,	0.1,	20,	-0.0001,
            10,	0.1,	20,	-0.0001,
            100,	0.1,	20,	-0.0001,
            0.0001,	1,	20,	-0.0001,
            0.1,	1,	20,	-0.0001,
            1,	1,	20,	-0.0001,
            10,	1,	20,	-0.0001,
            100,	1,	20,	-0.0001,
            0.0001,	-0.0001,	20,	-0.0001,
            0.1,	-0.0001,	20,	-0.0001,
            1,	-0.0001,	20,	-0.0001,
            10,	-0.0001,	20,	-0.0001,
            100,	-0.0001,	20,	-0.0001,
            0.0001,	-0.01,	20,	-0.0001,
            0.1,	-0.01,	20,	-0.0001,
            1,	-0.01,	20,	-0.0001,
            10,	-0.01,	20,	-0.0001,
            100,	-0.01,	20,	-0.0001,
            0.0001,	-0.1,	20,	-0.0001,
            0.1,	-0.1,	20,	-0.0001,
            1,	-0.1,	20,	-0.0001,
            10,	-0.1,	20,	-0.0001,
            100,	-0.1,	20,	-0.0001,
            0.0001,	-1,	20,	-0.0001,
            0.1,	-1,	20,	-0.0001,
            1,	-1,	20,	-0.0001,
            10,	-1,	20,	-0.0001,
            100,	-1,	20,	-0.0001,
            0.0001,	0.0001,	20,	-0.01,
            0.1,	0.0001,	20,	-0.01,
            1,	0.0001,	20,	-0.01,
            10,	0.0001,	20,	-0.01,
            100,	0.0001,	20,	-0.01,
            0.0001,	0.01,	20,	-0.01,
            0.1,	0.01,	20,	-0.01,
            1,	0.01,	20,	-0.01,
            10,	0.01,	20,	-0.01,
            100,	0.01,	20,	-0.01,
            0.0001,	0.1,	20,	-0.01,
            0.1,	0.1,	20,	-0.01,
            1,	0.1,	20,	-0.01,
            10,	0.1,	20,	-0.01,
            100,	0.1,	20,	-0.01,
            0.0001,	1,	20,	-0.01,
            0.1,	1,	20,	-0.01,
            1,	1,	20,	-0.01,
            10,	1,	20,	-0.01,
            100,	1,	20,	-0.01,
            0.0001,	-0.0001,	20,	-0.01,
            0.1,	-0.0001,	20,	-0.01,
            1,	-0.0001,	20,	-0.01,
            10,	-0.0001,	20,	-0.01,
            100,	-0.0001,	20,	-0.01,
            0.0001,	-0.01,	20,	-0.01,
            0.1,	-0.01,	20,	-0.01,
            1,	-0.01,	20,	-0.01,
            10,	-0.01,	20,	-0.01,
            100,	-0.01,	20,	-0.01,
            0.0001,	-0.1,	20,	-0.01,
            0.1,	-0.1,	20,	-0.01,
            1,	-0.1,	20,	-0.01,
            10,	-0.1,	20,	-0.01,
            100,	-0.1,	20,	-0.01,
            0.0001,	-1,	20,	-0.01,
            0.1,	-1,	20,	-0.01,
            1,	-1,	20,	-0.01,
            10,	-1,	20,	-0.01,
            100,	-1,	20,	-0.01,
            0.0001,	0.0001,	20,	-0.1,
            0.1,	0.0001,	20,	-0.1,
            1,	0.0001,	20,	-0.1,
            10,	0.0001,	20,	-0.1,
            100,	0.0001,	20,	-0.1,
            0.0001,	0.01,	20,	-0.1,
            0.1,	0.01,	20,	-0.1,
            1,	0.01,	20,	-0.1,
            10,	0.01,	20,	-0.1,
            100,	0.01,	20,	-0.1,
            0.0001,	0.1,	20,	-0.1,
            0.1,	0.1,	20,	-0.1,
            1,	0.1,	20,	-0.1,
            10,	0.1,	20,	-0.1,
            100,	0.1,	20,	-0.1,
            0.0001,	1,	20,	-0.1,
            0.1,	1,	20,	-0.1,
            1,	1,	20,	-0.1,
            10,	1,	20,	-0.1,
            100,	1,	20,	-0.1,
            0.0001,	-0.0001,	20,	-0.1,
            0.1,	-0.0001,	20,	-0.1,
            1,	-0.0001,	20,	-0.1,
            10,	-0.0001,	20,	-0.1,
            100,	-0.0001,	20,	-0.1,
            0.0001,	-0.01,	20,	-0.1,
            0.1,	-0.01,	20,	-0.1,
            1,	-0.01,	20,	-0.1,
            10,	-0.01,	20,	-0.1,
            100,	-0.01,	20,	-0.1,
            0.0001,	-0.1,	20,	-0.1,
            0.1,	-0.1,	20,	-0.1,
            1,	-0.1,	20,	-0.1,
            10,	-0.1,	20,	-0.1,
            100,	-0.1,	20,	-0.1,
            0.0001,	-1,	20,	-0.1,
            0.1,	-1,	20,	-0.1,
            1,	-1,	20,	-0.1,
            10,	-1,	20,	-0.1,
            100,	-1,	20,	-0.1,
            0.0001,	0.0001,	20,	-0.0001,
            0.1,	0.0001,	20,	-0.0001,
            1,	0.0001,	20,	-0.0001,
            10,	0.0001,	20,	-0.0001,
            100,	0.0001,	20,	-0.0001,
            0.0001,	0.01,	20,	-0.0001,
            0.1,	0.01,	20,	-0.0001,
            1,	0.01,	20,	-0.0001,
            10,	0.01,	20,	-0.0001,
            100,	0.01,	20,	-0.0001,
            0.0001,	0.1,	20,	-0.0001,
            0.1,	0.1,	20,	-0.0001,
            1,	0.1,	20,	-0.0001,
            10,	0.1,	20,	-0.0001,
            100,	0.1,	20,	-0.0001,
            0.0001,	1,	20,	-0.0001,
            0.1,	1,	20,	-0.0001,
            1,	1,	20,	-0.0001,
            10,	1,	20,	-0.0001,
            100,	1,	20,	-0.0001,
            0.0001,	-0.0001,	20,	-0.0001,
            0.1,	-0.0001,	20,	-0.0001,
            1,	-0.0001,	20,	-0.0001,
            10,	-0.0001,	20,	-0.0001,
            100,	-0.0001,	20,	-0.0001,
            0.0001,	-0.01,	20,	-0.0001,
            0.1,	-0.01,	20,	-0.0001,
            1,	-0.01,	20,	-0.0001,
            10,	-0.01,	20,	-0.0001,
            100,	-0.01,	20,	-0.0001,
            0.0001,	-0.1,	20,	-0.0001,
            0.1,	-0.1,	20,	-0.0001,
            1,	-0.1,	20,	-0.0001,
            10,	-0.1,	20,	-0.0001,
            100,	-0.1,	20,	-0.0001,
            0.0001,	-1,	20,	-0.0001,
            0.1,	-1,	20,	-0.0001,
            1,	-1,	20,	-0.0001,
            10,	-1,	20,	-0.0001,
            100,	-1,	20,	-0.0001,
            0.0001,	0.0001,	30,	0.0001,
            0.1,	0.0001,	30,	0.0001,
            1,	0.0001,	30,	0.0001,
            10,	0.0001,	30,	0.0001,
            100,	0.0001,	30,	0.0001,
            0.0001,	0.01,	30,	0.0001,
            0.1,	0.01,	30,	0.0001,
            1,	0.01,	30,	0.0001,
            10,	0.01,	30,	0.0001,
            100,	0.01,	30,	0.0001,
            0.0001,	0.1,	30,	0.0001,
            0.1,	0.1,	30,	0.0001,
            1,	0.1,	30,	0.0001,
            10,	0.1,	30,	0.0001,
            100,	0.1,	30,	0.0001,
            0.0001,	1,	30,	0.0001,
            0.1,	1,	30,	0.0001,
            1,	1,	30,	0.0001,
            10,	1,	30,	0.0001,
            100,	1,	30,	0.0001,
            0.0001,	-0.0001,	30,	0.0001,
            0.1,	-0.0001,	30,	0.0001,
            1,	-0.0001,	30,	0.0001,
            10,	-0.0001,	30,	0.0001,
            100,	-0.0001,	30,	0.0001,
            0.0001,	-0.01,	30,	0.0001,
            0.1,	-0.01,	30,	0.0001,
            1,	-0.01,	30,	0.0001,
            10,	-0.01,	30,	0.0001,
            100,	-0.01,	30,	0.0001,
            0.0001,	-0.1,	30,	0.0001,
            0.1,	-0.1,	30,	0.0001,
            1,	-0.1,	30,	0.0001,
            10,	-0.1,	30,	0.0001,
            100,	-0.1,	30,	0.0001,
            0.0001,	-1,	30,	0.0001,
            0.1,	-1,	30,	0.0001,
            1,	-1,	30,	0.0001,
            10,	-1,	30,	0.0001,
            100,	-1,	30,	0.0001,
            0.0001,	0.0001,	30,	0.01,
            0.1,	0.0001,	30,	0.01,
            1,	0.0001,	30,	0.01,
            10,	0.0001,	30,	0.01,
            100,	0.0001,	30,	0.01,
            0.0001,	0.01,	30,	0.01,
            0.1,	0.01,	30,	0.01,
            1,	0.01,	30,	0.01,
            10,	0.01,	30,	0.01,
            100,	0.01,	30,	0.01,
            0.0001,	0.1,	30,	0.01,
            0.1,	0.1,	30,	0.01,
            1,	0.1,	30,	0.01,
            10,	0.1,	30,	0.01,
            100,	0.1,	30,	0.01,
            0.0001,	1,	30,	0.01,
            0.1,	1,	30,	0.01,
            1,	1,	30,	0.01,
            10,	1,	30,	0.01,
            100,	1,	30,	0.01,
            0.0001,	-0.0001,	30,	0.01,
            0.1,	-0.0001,	30,	0.01,
            1,	-0.0001,	30,	0.01,
            10,	-0.0001,	30,	0.01,
            100,	-0.0001,	30,	0.01,
            0.0001,	-0.01,	30,	0.01,
            0.1,	-0.01,	30,	0.01,
            1,	-0.01,	30,	0.01,
            10,	-0.01,	30,	0.01,
            100,	-0.01,	30,	0.01,
            0.0001,	-0.1,	30,	0.01,
            0.1,	-0.1,	30,	0.01,
            1,	-0.1,	30,	0.01,
            10,	-0.1,	30,	0.01,
            100,	-0.1,	30,	0.01,
            0.0001,	-1,	30,	0.01,
            0.1,	-1,	30,	0.01,
            1,	-1,	30,	0.01,
            10,	-1,	30,	0.01,
            100,	-1,	30,	0.01,
            0.0001,	0.0001,	30,	0.1,
            0.1,	0.0001,	30,	0.1,
            1,	0.0001,	30,	0.1,
            10,	0.0001,	30,	0.1,
            100,	0.0001,	30,	0.1,
            0.0001,	0.01,	30,	0.1,
            0.1,	0.01,	30,	0.1,
            1,	0.01,	30,	0.1,
            10,	0.01,	30,	0.1,
            100,	0.01,	30,	0.1,
            0.0001,	0.1,	30,	0.1,
            0.1,	0.1,	30,	0.1,
            1,	0.1,	30,	0.1,
            10,	0.1,	30,	0.1,
            100,	0.1,	30,	0.1,
            0.0001,	1,	30,	0.1,
            0.1,	1,	30,	0.1,
            1,	1,	30,	0.1,
            10,	1,	30,	0.1,
            100,	1,	30,	0.1,
            0.0001,	-0.0001,	30,	0.1,
            0.1,	-0.0001,	30,	0.1,
            1,	-0.0001,	30,	0.1,
            10,	-0.0001,	30,	0.1,
            100,	-0.0001,	30,	0.1,
            0.0001,	-0.01,	30,	0.1,
            0.1,	-0.01,	30,	0.1,
            1,	-0.01,	30,	0.1,
            10,	-0.01,	30,	0.1,
            100,	-0.01,	30,	0.1,
            0.0001,	-0.1,	30,	0.1,
            0.1,	-0.1,	30,	0.1,
            1,	-0.1,	30,	0.1,
            10,	-0.1,	30,	0.1,
            100,	-0.1,	30,	0.1,
            0.0001,	-1,	30,	0.1,
            0.1,	-1,	30,	0.1,
            1,	-1,	30,	0.1,
            10,	-1,	30,	0.1,
            100,	-1,	30,	0.1,
            0.0001,	0.0001,	30,	0.0001,
            0.1,	0.0001,	30,	0.0001,
            1,	0.0001,	30,	0.0001,
            10,	0.0001,	30,	0.0001,
            100,	0.0001,	30,	0.0001,
            0.0001,	0.01,	30,	0.0001,
            0.1,	0.01,	30,	0.0001,
            1,	0.01,	30,	0.0001,
            10,	0.01,	30,	0.0001,
            100,	0.01,	30,	0.0001,
            0.0001,	0.1,	30,	0.0001,
            0.1,	0.1,	30,	0.0001,
            1,	0.1,	30,	0.0001,
            10,	0.1,	30,	0.0001,
            100,	0.1,	30,	0.0001,
            0.0001,	1,	30,	0.0001,
            0.1,	1,	30,	0.0001,
            1,	1,	30,	0.0001,
            10,	1,	30,	0.0001,
            100,	1,	30,	0.0001,
            0.0001,	-0.0001,	30,	0.0001,
            0.1,	-0.0001,	30,	0.0001,
            1,	-0.0001,	30,	0.0001,
            10,	-0.0001,	30,	0.0001,
            100,	-0.0001,	30,	0.0001,
            0.0001,	-0.01,	30,	0.0001,
            0.1,	-0.01,	30,	0.0001,
            1,	-0.01,	30,	0.0001,
            10,	-0.01,	30,	0.0001,
            100,	-0.01,	30,	0.0001,
            0.0001,	-0.1,	30,	0.0001,
            0.1,	-0.1,	30,	0.0001,
            1,	-0.1,	30,	0.0001,
            10,	-0.1,	30,	0.0001,
            100,	-0.1,	30,	0.0001,
            0.0001,	-1,	30,	0.0001,
            0.1,	-1,	30,	0.0001,
            1,	-1,	30,	0.0001,
            10,	-1,	30,	0.0001,
            100,	-1,	30,	0.0001,
            0.0001,	0.0001,	30,	-0.0001,
            0.1,	0.0001,	30,	-0.0001,
            1,	0.0001,	30,	-0.0001,
            10,	0.0001,	30,	-0.0001,
            100,	0.0001,	30,	-0.0001,
            0.0001,	0.01,	30,	-0.0001,
            0.1,	0.01,	30,	-0.0001,
            1,	0.01,	30,	-0.0001,
            10,	0.01,	30,	-0.0001,
            100,	0.01,	30,	-0.0001,
            0.0001,	0.1,	30,	-0.0001,
            0.1,	0.1,	30,	-0.0001,
            1,	0.1,	30,	-0.0001,
            10,	0.1,	30,	-0.0001,
            100,	0.1,	30,	-0.0001,
            0.0001,	1,	30,	-0.0001,
            0.1,	1,	30,	-0.0001,
            1,	1,	30,	-0.0001,
            10,	1,	30,	-0.0001,
            100,	1,	30,	-0.0001,
            0.0001,	-0.0001,	30,	-0.0001,
            0.1,	-0.0001,	30,	-0.0001,
            1,	-0.0001,	30,	-0.0001,
            10,	-0.0001,	30,	-0.0001,
            100,	-0.0001,	30,	-0.0001,
            0.0001,	-0.01,	30,	-0.0001,
            0.1,	-0.01,	30,	-0.0001,
            1,	-0.01,	30,	-0.0001,
            10,	-0.01,	30,	-0.0001,
            100,	-0.01,	30,	-0.0001,
            0.0001,	-0.1,	30,	-0.0001,
            0.1,	-0.1,	30,	-0.0001,
            1,	-0.1,	30,	-0.0001,
            10,	-0.1,	30,	-0.0001,
            100,	-0.1,	30,	-0.0001,
            0.0001,	-1,	30,	-0.0001,
            0.1,	-1,	30,	-0.0001,
            1,	-1,	30,	-0.0001,
            10,	-1,	30,	-0.0001,
            100,	-1,	30,	-0.0001,
            0.0001,	0.0001,	30,	-0.01,
            0.1,	0.0001,	30,	-0.01,
            1,	0.0001,	30,	-0.01,
            10,	0.0001,	30,	-0.01,
            100,	0.0001,	30,	-0.01,
            0.0001,	0.01,	30,	-0.01,
            0.1,	0.01,	30,	-0.01,
            1,	0.01,	30,	-0.01,
            10,	0.01,	30,	-0.01,
            100,	0.01,	30,	-0.01,
            0.0001,	0.1,	30,	-0.01,
            0.1,	0.1,	30,	-0.01,
            1,	0.1,	30,	-0.01,
            10,	0.1,	30,	-0.01,
            100,	0.1,	30,	-0.01,
            0.0001,	1,	30,	-0.01,
            0.1,	1,	30,	-0.01,
            1,	1,	30,	-0.01,
            10,	1,	30,	-0.01,
            100,	1,	30,	-0.01,
            0.0001,	-0.0001,	30,	-0.01,
            0.1,	-0.0001,	30,	-0.01,
            1,	-0.0001,	30,	-0.01,
            10,	-0.0001,	30,	-0.01,
            100,	-0.0001,	30,	-0.01,
            0.0001,	-0.01,	30,	-0.01,
            0.1,	-0.01,	30,	-0.01,
            1,	-0.01,	30,	-0.01,
            10,	-0.01,	30,	-0.01,
            100,	-0.01,	30,	-0.01,
            0.0001,	-0.1,	30,	-0.01,
            0.1,	-0.1,	30,	-0.01,
            1,	-0.1,	30,	-0.01,
            10,	-0.1,	30,	-0.01,
            100,	-0.1,	30,	-0.01,
            0.0001,	-1,	30,	-0.01,
            0.1,	-1,	30,	-0.01,
            1,	-1,	30,	-0.01,
            10,	-1,	30,	-0.01,
            100,	-1,	30,	-0.01,
            0.0001,	0.0001,	30,	-0.1,
            0.1,	0.0001,	30,	-0.1,
            1,	0.0001,	30,	-0.1,
            10,	0.0001,	30,	-0.1,
            100,	0.0001,	30,	-0.1,
            0.0001,	0.01,	30,	-0.1,
            0.1,	0.01,	30,	-0.1,
            1,	0.01,	30,	-0.1,
            10,	0.01,	30,	-0.1,
            100,	0.01,	30,	-0.1,
            0.0001,	0.1,	30,	-0.1,
            0.1,	0.1,	30,	-0.1,
            1,	0.1,	30,	-0.1,
            10,	0.1,	30,	-0.1,
            100,	0.1,	30,	-0.1,
            0.0001,	1,	30,	-0.1,
            0.1,	1,	30,	-0.1,
            1,	1,	30,	-0.1,
            10,	1,	30,	-0.1,
            100,	1,	30,	-0.1,
            0.0001,	-0.0001,	30,	-0.1,
            0.1,	-0.0001,	30,	-0.1,
            1,	-0.0001,	30,	-0.1,
            10,	-0.0001,	30,	-0.1,
            100,	-0.0001,	30,	-0.1,
            0.0001,	-0.01,	30,	-0.1,
            0.1,	-0.01,	30,	-0.1,
            1,	-0.01,	30,	-0.1,
            10,	-0.01,	30,	-0.1,
            100,	-0.01,	30,	-0.1,
            0.0001,	-0.1,	30,	-0.1,
            0.1,	-0.1,	30,	-0.1,
            1,	-0.1,	30,	-0.1,
            10,	-0.1,	30,	-0.1,
            100,	-0.1,	30,	-0.1,
            0.0001,	-1,	30,	-0.1,
            0.1,	-1,	30,	-0.1,
            1,	-1,	30,	-0.1,
            10,	-1,	30,	-0.1,
            100,	-1,	30,	-0.1,
            0.0001,	0.0001,	30,	-0.0001,
            0.1,	0.0001,	30,	-0.0001,
            1,	0.0001,	30,	-0.0001,
            10,	0.0001,	30,	-0.0001,
            100,	0.0001,	30,	-0.0001,
            0.0001,	0.01,	30,	-0.0001,
            0.1,	0.01,	30,	-0.0001,
            1,	0.01,	30,	-0.0001,
            10,	0.01,	30,	-0.0001,
            100,	0.01,	30,	-0.0001,
            0.0001,	0.1,	30,	-0.0001,
            0.1,	0.1,	30,	-0.0001,
            1,	0.1,	30,	-0.0001,
            10,	0.1,	30,	-0.0001,
            100,	0.1,	30,	-0.0001,
            0.0001,	1,	30,	-0.0001,
            0.1,	1,	30,	-0.0001,
            1,	1,	30,	-0.0001,
            10,	1,	30,	-0.0001,
            100,	1,	30,	-0.0001,
            0.0001,	-0.0001,	30,	-0.0001,
            0.1,	-0.0001,	30,	-0.0001,
            1,	-0.0001,	30,	-0.0001,
            10,	-0.0001,	30,	-0.0001,
            100,	-0.0001,	30,	-0.0001,
            0.0001,	-0.01,	30,	-0.0001,
            0.1,	-0.01,	30,	-0.0001,
            1,	-0.01,	30,	-0.0001,
            10,	-0.01,	30,	-0.0001,
            100,	-0.01,	30,	-0.0001,
            0.0001,	-0.1,	30,	-0.0001,
            0.1,	-0.1,	30,	-0.0001,
            1,	-0.1,	30,	-0.0001,
            10,	-0.1,	30,	-0.0001,
            100,	-0.1,	30,	-0.0001,
            0.0001,	-1,	30,	-0.0001,
            0.1,	-1,	30,	-0.0001,
            1,	-1,	30,	-0.0001,
            10,	-1,	30,	-0.0001,
            100,	-1,	30,	-0.0001,
            0.0001,	0.0001,	40,	0.0001,
            0.1,	0.0001,	40,	0.0001,
            1,	0.0001,	40,	0.0001,
            10,	0.0001,	40,	0.0001,
            100,	0.0001,	40,	0.0001,
            0.0001,	0.01,	40,	0.0001,
            0.1,	0.01,	40,	0.0001,
            1,	0.01,	40,	0.0001,
            10,	0.01,	40,	0.0001,
            100,	0.01,	40,	0.0001,
            0.0001,	0.1,	40,	0.0001,
            0.1,	0.1,	40,	0.0001,
            1,	0.1,	40,	0.0001,
            10,	0.1,	40,	0.0001,
            100,	0.1,	40,	0.0001,
            0.0001,	1,	40,	0.0001,
            0.1,	1,	40,	0.0001,
            1,	1,	40,	0.0001,
            10,	1,	40,	0.0001,
            100,	1,	40,	0.0001,
            0.0001,	-0.0001,	40,	0.0001,
            0.1,	-0.0001,	40,	0.0001,
            1,	-0.0001,	40,	0.0001,
            10,	-0.0001,	40,	0.0001,
            100,	-0.0001,	40,	0.0001,
            0.0001,	-0.01,	40,	0.0001,
            0.1,	-0.01,	40,	0.0001,
            1,	-0.01,	40,	0.0001,
            10,	-0.01,	40,	0.0001,
            100,	-0.01,	40,	0.0001,
            0.0001,	-0.1,	40,	0.0001,
            0.1,	-0.1,	40,	0.0001,
            1,	-0.1,	40,	0.0001,
            10,	-0.1,	40,	0.0001,
            100,	-0.1,	40,	0.0001,
            0.0001,	-1,	40,	0.0001,
            0.1,	-1,	40,	0.0001,
            1,	-1,	40,	0.0001,
            10,	-1,	40,	0.0001,
            100,	-1,	40,	0.0001,
            0.0001,	0.0001,	40,	0.01,
            0.1,	0.0001,	40,	0.01,
            1,	0.0001,	40,	0.01,
            10,	0.0001,	40,	0.01,
            100,	0.0001,	40,	0.01,
            0.0001,	0.01,	40,	0.01,
            0.1,	0.01,	40,	0.01,
            1,	0.01,	40,	0.01,
            10,	0.01,	40,	0.01,
            100,	0.01,	40,	0.01,
            0.0001,	0.1,	40,	0.01,
            0.1,	0.1,	40,	0.01,
            1,	0.1,	40,	0.01,
            10,	0.1,	40,	0.01,
            100,	0.1,	40,	0.01,
            0.0001,	1,	40,	0.01,
            0.1,	1,	40,	0.01,
            1,	1,	40,	0.01,
            10,	1,	40,	0.01,
            100,	1,	40,	0.01,
            0.0001,	-0.0001,	40,	0.01,
            0.1,	-0.0001,	40,	0.01,
            1,	-0.0001,	40,	0.01,
            10,	-0.0001,	40,	0.01,
            100,	-0.0001,	40,	0.01,
            0.0001,	-0.01,	40,	0.01,
            0.1,	-0.01,	40,	0.01,
            1,	-0.01,	40,	0.01,
            10,	-0.01,	40,	0.01,
            100,	-0.01,	40,	0.01,
            0.0001,	-0.1,	40,	0.01,
            0.1,	-0.1,	40,	0.01,
            1,	-0.1,	40,	0.01,
            10,	-0.1,	40,	0.01,
            100,	-0.1,	40,	0.01,
            0.0001,	-1,	40,	0.01,
            0.1,	-1,	40,	0.01,
            1,	-1,	40,	0.01,
            10,	-1,	40,	0.01,
            100,	-1,	40,	0.01,
            0.0001,	0.0001,	40,	0.1,
            0.1,	0.0001,	40,	0.1,
            1,	0.0001,	40,	0.1,
            10,	0.0001,	40,	0.1,
            100,	0.0001,	40,	0.1,
            0.0001,	0.01,	40,	0.1,
            0.1,	0.01,	40,	0.1,
            1,	0.01,	40,	0.1,
            10,	0.01,	40,	0.1,
            100,	0.01,	40,	0.1,
            0.0001,	0.1,	40,	0.1,
            0.1,	0.1,	40,	0.1,
            1,	0.1,	40,	0.1,
            10,	0.1,	40,	0.1,
            100,	0.1,	40,	0.1,
            0.0001,	1,	40,	0.1,
            0.1,	1,	40,	0.1,
            1,	1,	40,	0.1,
            10,	1,	40,	0.1,
            100,	1,	40,	0.1,
            0.0001,	-0.0001,	40,	0.1,
            0.1,	-0.0001,	40,	0.1,
            1,	-0.0001,	40,	0.1,
            10,	-0.0001,	40,	0.1,
            100,	-0.0001,	40,	0.1,
            0.0001,	-0.01,	40,	0.1,
            0.1,	-0.01,	40,	0.1,
            1,	-0.01,	40,	0.1,
            10,	-0.01,	40,	0.1,
            100,	-0.01,	40,	0.1,
            0.0001,	-0.1,	40,	0.1,
            0.1,	-0.1,	40,	0.1,
            1,	-0.1,	40,	0.1,
            10,	-0.1,	40,	0.1,
            100,	-0.1,	40,	0.1,
            0.0001,	-1,	40,	0.1,
            0.1,	-1,	40,	0.1,
            1,	-1,	40,	0.1,
            10,	-1,	40,	0.1,
            100,	-1,	40,	0.1,
            0.0001,	0.0001,	40,	0.0001,
            0.1,	0.0001,	40,	0.0001,
            1,	0.0001,	40,	0.0001,
            10,	0.0001,	40,	0.0001,
            100,	0.0001,	40,	0.0001,
            0.0001,	0.01,	40,	0.0001,
            0.1,	0.01,	40,	0.0001,
            1,	0.01,	40,	0.0001,
            10,	0.01,	40,	0.0001,
            100,	0.01,	40,	0.0001,
            0.0001,	0.1,	40,	0.0001,
            0.1,	0.1,	40,	0.0001,
            1,	0.1,	40,	0.0001,
            10,	0.1,	40,	0.0001,
            100,	0.1,	40,	0.0001,
            0.0001,	1,	40,	0.0001,
            0.1,	1,	40,	0.0001,
            1,	1,	40,	0.0001,
            10,	1,	40,	0.0001,
            100,	1,	40,	0.0001,
            0.0001,	-0.0001,	40,	0.0001,
            0.1,	-0.0001,	40,	0.0001,
            1,	-0.0001,	40,	0.0001,
            10,	-0.0001,	40,	0.0001,
            100,	-0.0001,	40,	0.0001,
            0.0001,	-0.01,	40,	0.0001,
            0.1,	-0.01,	40,	0.0001,
            1,	-0.01,	40,	0.0001,
            10,	-0.01,	40,	0.0001,
            100,	-0.01,	40,	0.0001,
            0.0001,	-0.1,	40,	0.0001,
            0.1,	-0.1,	40,	0.0001,
            1,	-0.1,	40,	0.0001,
            10,	-0.1,	40,	0.0001,
            100,	-0.1,	40,	0.0001,
            0.0001,	-1,	40,	0.0001,
            0.1,	-1,	40,	0.0001,
            1,	-1,	40,	0.0001,
            10,	-1,	40,	0.0001,
            100,	-1,	40,	0.0001,
            0.0001,	0.0001,	40,	-0.0001,
            0.1,	0.0001,	40,	-0.0001,
            1,	0.0001,	40,	-0.0001,
            10,	0.0001,	40,	-0.0001,
            100,	0.0001,	40,	-0.0001,
            0.0001,	0.01,	40,	-0.0001,
            0.1,	0.01,	40,	-0.0001,
            1,	0.01,	40,	-0.0001,
            10,	0.01,	40,	-0.0001,
            100,	0.01,	40,	-0.0001,
            0.0001,	0.1,	40,	-0.0001,
            0.1,	0.1,	40,	-0.0001,
            1,	0.1,	40,	-0.0001,
            10,	0.1,	40,	-0.0001,
            100,	0.1,	40,	-0.0001,
            0.0001,	1,	40,	-0.0001,
            0.1,	1,	40,	-0.0001,
            1,	1,	40,	-0.0001,
            10,	1,	40,	-0.0001,
            100,	1,	40,	-0.0001,
            0.0001,	-0.0001,	40,	-0.0001,
            0.1,	-0.0001,	40,	-0.0001,
            1,	-0.0001,	40,	-0.0001,
            10,	-0.0001,	40,	-0.0001,
            100,	-0.0001,	40,	-0.0001,
            0.0001,	-0.01,	40,	-0.0001,
            0.1,	-0.01,	40,	-0.0001,
            1,	-0.01,	40,	-0.0001,
            10,	-0.01,	40,	-0.0001,
            100,	-0.01,	40,	-0.0001,
            0.0001,	-0.1,	40,	-0.0001,
            0.1,	-0.1,	40,	-0.0001,
            1,	-0.1,	40,	-0.0001,
            10,	-0.1,	40,	-0.0001,
            100,	-0.1,	40,	-0.0001,
            0.0001,	-1,	40,	-0.0001,
            0.1,	-1,	40,	-0.0001,
            1,	-1,	40,	-0.0001,
            10,	-1,	40,	-0.0001,
            100,	-1,	40,	-0.0001,
            0.0001,	0.0001,	40,	-0.01,
            0.1,	0.0001,	40,	-0.01,
            1,	0.0001,	40,	-0.01,
            10,	0.0001,	40,	-0.01,
            100,	0.0001,	40,	-0.01,
            0.0001,	0.01,	40,	-0.01,
            0.1,	0.01,	40,	-0.01,
            1,	0.01,	40,	-0.01,
            10,	0.01,	40,	-0.01,
            100,	0.01,	40,	-0.01,
            0.0001,	0.1,	40,	-0.01,
            0.1,	0.1,	40,	-0.01,
            1,	0.1,	40,	-0.01,
            10,	0.1,	40,	-0.01,
            100,	0.1,	40,	-0.01,
            0.0001,	1,	40,	-0.01,
            0.1,	1,	40,	-0.01,
            1,	1,	40,	-0.01,
            10,	1,	40,	-0.01,
            100,	1,	40,	-0.01,
            0.0001,	-0.0001,	40,	-0.01,
            0.1,	-0.0001,	40,	-0.01,
            1,	-0.0001,	40,	-0.01,
            10,	-0.0001,	40,	-0.01,
            100,	-0.0001,	40,	-0.01,
            0.0001,	-0.01,	40,	-0.01,
            0.1,	-0.01,	40,	-0.01,
            1,	-0.01,	40,	-0.01,
            10,	-0.01,	40,	-0.01,
            100,	-0.01,	40,	-0.01,
            0.0001,	-0.1,	40,	-0.01,
            0.1,	-0.1,	40,	-0.01,
            1,	-0.1,	40,	-0.01,
            10,	-0.1,	40,	-0.01,
            100,	-0.1,	40,	-0.01,
            0.0001,	-1,	40,	-0.01,
            0.1,	-1,	40,	-0.01,
            1,	-1,	40,	-0.01,
            10,	-1,	40,	-0.01,
            100,	-1,	40,	-0.01,
            0.0001,	0.0001,	40,	-0.1,
            0.1,	0.0001,	40,	-0.1,
            1,	0.0001,	40,	-0.1,
            10,	0.0001,	40,	-0.1,
            100,	0.0001,	40,	-0.1,
            0.0001,	0.01,	40,	-0.1,
            0.1,	0.01,	40,	-0.1,
            1,	0.01,	40,	-0.1,
            10,	0.01,	40,	-0.1,
            100,	0.01,	40,	-0.1,
            0.0001,	0.1,	40,	-0.1,
            0.1,	0.1,	40,	-0.1,
            1,	0.1,	40,	-0.1,
            10,	0.1,	40,	-0.1,
            100,	0.1,	40,	-0.1,
            0.0001,	1,	40,	-0.1,
            0.1,	1,	40,	-0.1,
            1,	1,	40,	-0.1,
            10,	1,	40,	-0.1,
            100,	1,	40,	-0.1,
            0.0001,	-0.0001,	40,	-0.1,
            0.1,	-0.0001,	40,	-0.1,
            1,	-0.0001,	40,	-0.1,
            10,	-0.0001,	40,	-0.1,
            100,	-0.0001,	40,	-0.1,
            0.0001,	-0.01,	40,	-0.1,
            0.1,	-0.01,	40,	-0.1,
            1,	-0.01,	40,	-0.1,
            10,	-0.01,	40,	-0.1,
            100,	-0.01,	40,	-0.1,
            0.0001,	-0.1,	40,	-0.1,
            0.1,	-0.1,	40,	-0.1,
            1,	-0.1,	40,	-0.1,
            10,	-0.1,	40,	-0.1,
            100,	-0.1,	40,	-0.1,
            0.0001,	-1,	40,	-0.1,
            0.1,	-1,	40,	-0.1,
            1,	-1,	40,	-0.1,
            10,	-1,	40,	-0.1,
            100,	-1,	40,	-0.1,
            0.0001,	0.0001,	40,	-0.0001,
            0.1,	0.0001,	40,	-0.0001,
            1,	0.0001,	40,	-0.0001,
            10,	0.0001,	40,	-0.0001,
            100,	0.0001,	40,	-0.0001,
            0.0001,	0.01,	40,	-0.0001,
            0.1,	0.01,	40,	-0.0001,
            1,	0.01,	40,	-0.0001,
            10,	0.01,	40,	-0.0001,
            100,	0.01,	40,	-0.0001,
            0.0001,	0.1,	40,	-0.0001,
            0.1,	0.1,	40,	-0.0001,
            1,	0.1,	40,	-0.0001,
            10,	0.1,	40,	-0.0001,
            100,	0.1,	40,	-0.0001,
            0.0001,	1,	40,	-0.0001,
            0.1,	1,	40,	-0.0001,
            1,	1,	40,	-0.0001,
            10,	1,	40,	-0.0001,
            100,	1,	40,	-0.0001,
            0.0001,	-0.0001,	40,	-0.0001,
            0.1,	-0.0001,	40,	-0.0001,
            1,	-0.0001,	40,	-0.0001,
            10,	-0.0001,	40,	-0.0001,
            100,	-0.0001,	40,	-0.0001,
            0.0001,	-0.01,	40,	-0.0001,
            0.1,	-0.01,	40,	-0.0001,
            1,	-0.01,	40,	-0.0001,
            10,	-0.01,	40,	-0.0001,
            100,	-0.01,	40,	-0.0001,
            0.0001,	-0.1,	40,	-0.0001,
            0.1,	-0.1,	40,	-0.0001,
            1,	-0.1,	40,	-0.0001,
            10,	-0.1,	40,	-0.0001,
            100,	-0.1,	40,	-0.0001,
            0.0001,	-1,	40,	-0.0001,
            0.1,	-1,	40,	-0.0001,
            1,	-1,	40,	-0.0001,
            10,	-1,	40,	-0.0001,
            100,	-1,	40,	-0.0001
         )
         p_starting <- matrix(p_matrix, length(p_matrix)/4, 4, byrow=TRUE)
         result_matrix <- matrix(NA, nrow(p_starting), 5)
         result_matrix[,1:4] <- p_starting
      }


     if(MODEL == "BM_quadratic"){
         p_matrix <- c( #order here is b, c, a b and a may be negative
             0.000000001,	100,	3,
            0.000000001,	10,	3,
            0.000000001,	1,	3,
            0.000000001,	0.1,	3,
            0.000000001,	0.0000001,	3,
            0.000000001,	-0.1,	3,
            0.000000001,	-1,	3,
            0.000000001,	-10,	3,
            0.000000001,	-100,	3,
            0.000000001,	-1000,	3,
            0.001,	100,	3,
            0.001,	10,	3,
            0.001,	1,	3,
            0.001,	0.1,	3,
            0.001,	0.0000001,	3,
            0.001,	-0.1,	3,
            0.001,	-1,	3,
            0.001,	-10,	3,
            0.001,	-100,	3,
            0.001,	-1000,	3,
            0.01,	100,	3,
            0.01,	10,	3,
            0.01,	1,	3,
            0.01,	0.1,	3,
            0.01,	0.0000001,	3,
            0.01,	-0.1,	3,
            0.01,	-1,	3,
            0.01,	-10,	3,
            0.01,	-100,	3,
            0.01,	-1000,	3,
            0.1,	100,	3,
            0.1,	10,	3,
            0.1,	1,	3,
            0.1,	0.1,	3,
            0.1,	0.0000001,	3,
            0.1,	-0.1,	3,
            0.1,	-1,	3,
            0.1,	-10,	3,
            0.1,	-100,	3,
            0.1,	-1000,	3,
            1,	100,	3,
            1,	10,	3,
            1,	1,	3,
            1,	0.1,	3,
            1,	0.0000001,	3,
            1,	-0.1,	3,
            1,	-1,	3,
            1,	-10,	3,
            1,	-100,	3,
            1,	-1000,	3,
            10,	100,	3,
            10,	10,	3,
            10,	1,	3,
            10,	0.1,	3,
            10,	0.0000001,	3,
            10,	-0.1,	3,
            10,	-1,	3,
            10,	-10,	3,
            10,	-100,	3,
            10,	-1000,	3,
            100,	100,	3,
            100,	10,	3,
            100,	1,	3,
            100,	0.1,	3,
            100,	0.0000001,	3,
            100,	-0.1,	3,
            100,	-1,	3,
            100,	-10,	3,
            100,	-100,	3,
            100,	-1000,	3,
            0.000000001,	100,	1,
            0.000000001,	10,	1,
            0.000000001,	1,	1,
            0.000000001,	0.1,	1,
            0.000000001,	0.0000001,	1,
            0.000000001,	-0.1,	1,
            0.000000001,	-1,	1,
            0.000000001,	-10,	1,
            0.000000001,	-100,	1,
            0.000000001,	-1000,	1,
            0.001,	100,	1,
            0.001,	10,	1,
            0.001,	1,	1,
            0.001,	0.1,	1,
            0.001,	0.0000001,	1,
            0.001,	-0.1,	1,
            0.001,	-1,	1,
            0.001,	-10,	1,
            0.001,	-100,	1,
            0.001,	-1000,	1,
            0.01,	100,	1,
            0.01,	10,	1,
            0.01,	1,	1,
            0.01,	0.1,	1,
            0.01,	0.0000001,	1,
            0.01,	-0.1,	1,
            0.01,	-1,	1,
            0.01,	-10,	1,
            0.01,	-100,	1,
            0.01,	-1000,	1,
            0.1,	100,	1,
            0.1,	10,	1,
            0.1,	1,	1,
            0.1,	0.1,	1,
            0.1,	0.0000001,	1,
            0.1,	-0.1,	1,
            0.1,	-1,	1,
            0.1,	-10,	1,
            0.1,	-100,	1,
            0.1,	-1000,	1,
            1,	100,	1,
            1,	10,	1,
            1,	1,	1,
            1,	0.1,	1,
            1,	0.0000001,	1,
            1,	-0.1,	1,
            1,	-1,	1,
            1,	-10,	1,
            1,	-100,	1,
            1,	-1000,	1,
            10,	100,	1,
            10,	10,	1,
            10,	1,	1,
            10,	0.1,	1,
            10,	0.0000001,	1,
            10,	-0.1,	1,
            10,	-1,	1,
            10,	-10,	1,
            10,	-100,	1,
            10,	-1000,	1,
            100,	100,	1,
            100,	10,	1,
            100,	1,	1,
            100,	0.1,	1,
            100,	0.0000001,	1,
            100,	-0.1,	1,
            100,	-1,	1,
            100,	-10,	1,
            100,	-100,	1,
            100,	-1000,	1,
            0.000000001,	100,	0.1,
            0.000000001,	10,	0.1,
            0.000000001,	1,	0.1,
            0.000000001,	0.1,	0.1,
            0.000000001,	0.0000001,	0.1,
            0.000000001,	-0.1,	0.1,
            0.000000001,	-1,	0.1,
            0.000000001,	-10,	0.1,
            0.000000001,	-100,	0.1,
            0.000000001,	-1000,	0.1,
            0.001,	100,	0.1,
            0.001,	10,	0.1,
            0.001,	1,	0.1,
            0.001,	0.1,	0.1,
            0.001,	0.0000001,	0.1,
            0.001,	-0.1,	0.1,
            0.001,	-1,	0.1,
            0.001,	-10,	0.1,
            0.001,	-100,	0.1,
            0.001,	-1000,	0.1,
            0.01,	100,	0.1,
            0.01,	10,	0.1,
            0.01,	1,	0.1,
            0.01,	0.1,	0.1,
            0.01,	0.0000001,	0.1,
            0.01,	-0.1,	0.1,
            0.01,	-1,	0.1,
            0.01,	-10,	0.1,
            0.01,	-100,	0.1,
            0.01,	-1000,	0.1,
            0.1,	100,	0.1,
            0.1,	10,	0.1,
            0.1,	1,	0.1,
            0.1,	0.1,	0.1,
            0.1,	0.0000001,	0.1,
            0.1,	-0.1,	0.1,
            0.1,	-1,	0.1,
            0.1,	-10,	0.1,
            0.1,	-100,	0.1,
            0.1,	-1000,	0.1,
            1,	100,	0.1,
            1,	10,	0.1,
            1,	1,	0.1,
            1,	0.1,	0.1,
            1,	0.0000001,	0.1,
            1,	-0.1,	0.1,
            1,	-1,	0.1,
            1,	-10,	0.1,
            1,	-100,	0.1,
            1,	-1000,	0.1,
            10,	100,	0.1,
            10,	10,	0.1,
            10,	1,	0.1,
            10,	0.1,	0.1,
            10,	0.0000001,	0.1,
            10,	-0.1,	0.1,
            10,	-1,	0.1,
            10,	-10,	0.1,
            10,	-100,	0.1,
            10,	-1000,	0.1,
            100,	100,	0.1,
            100,	10,	0.1,
            100,	1,	0.1,
            100,	0.1,	0.1,
            100,	0.0000001,	0.1,
            100,	-0.1,	0.1,
            100,	-1,	0.1,
            100,	-10,	0.1,
            100,	-100,	0.1,
            100,	-1000,	0.1,
            0.000000001,	100,	0.001,
            0.000000001,	10,	0.001,
            0.000000001,	1,	0.001,
            0.000000001,	0.1,	0.001,
            0.000000001,	0.0000001,	0.001,
            0.000000001,	-0.1,	0.001,
            0.000000001,	-1,	0.001,
            0.000000001,	-10,	0.001,
            0.000000001,	-100,	0.001,
            0.000000001,	-1000,	0.001,
            0.001,	100,	0.001,
            0.001,	10,	0.001,
            0.001,	1,	0.001,
            0.001,	0.1,	0.001,
            0.001,	0.0000001,	0.001,
            0.001,	-0.1,	0.001,
            0.001,	-1,	0.001,
            0.001,	-10,	0.001,
            0.001,	-100,	0.001,
            0.001,	-1000,	0.001,
            0.01,	100,	0.001,
            0.01,	10,	0.001,
            0.01,	1,	0.001,
            0.01,	0.1,	0.001,
            0.01,	0.0000001,	0.001,
            0.01,	-0.1,	0.001,
            0.01,	-1,	0.001,
            0.01,	-10,	0.001,
            0.01,	-100,	0.001,
            0.01,	-1000,	0.001,
            0.1,	100,	0.001,
            0.1,	10,	0.001,
            0.1,	1,	0.001,
            0.1,	0.1,	0.001,
            0.1,	0.0000001,	0.001,
            0.1,	-0.1,	0.001,
            0.1,	-1,	0.001,
            0.1,	-10,	0.001,
            0.1,	-100,	0.001,
            0.1,	-1000,	0.001,
            1,	100,	0.001,
            1,	10,	0.001,
            1,	1,	0.001,
            1,	0.1,	0.001,
            1,	0.0000001,	0.001,
            1,	-0.1,	0.001,
            1,	-1,	0.001,
            1,	-10,	0.001,
            1,	-100,	0.001,
            1,	-1000,	0.001,
            10,	100,	0.001,
            10,	10,	0.001,
            10,	1,	0.001,
            10,	0.1,	0.001,
            10,	0.0000001,	0.001,
            10,	-0.1,	0.001,
            10,	-1,	0.001,
            10,	-10,	0.001,
            10,	-100,	0.001,
            10,	-1000,	0.001,
            100,	100,	0.001,
            100,	10,	0.001,
            100,	1,	0.001,
            100,	0.1,	0.001,
            100,	0.0000001,	0.001,
            100,	-0.1,	0.001,
            100,	-1,	0.001,
            100,	-10,	0.001,
            100,	-100,	0.001,
            100,	-1000,	0.001,
            0.000000001,	100,	0.000000001,
            0.000000001,	10,	0.000000001,
            0.000000001,	1,	0.000000001,
            0.000000001,	0.1,	0.000000001,
            0.000000001,	0.0000001,	0.000000001,
            0.000000001,	-0.1,	0.000000001,
            0.000000001,	-1,	0.000000001,
            0.000000001,	-10,	0.000000001,
            0.000000001,	-100,	0.000000001,
            0.000000001,	-1000,	0.000000001,
            0.001,	100,	0.000000001,
            0.001,	10,	0.000000001,
            0.001,	1,	0.000000001,
            0.001,	0.1,	0.000000001,
            0.001,	0.0000001,	0.000000001,
            0.001,	-0.1,	0.000000001,
            0.001,	-1,	0.000000001,
            0.001,	-10,	0.000000001,
            0.001,	-100,	0.000000001,
            0.001,	-1000,	0.000000001,
            0.01,	100,	0.000000001,
            0.01,	10,	0.000000001,
            0.01,	1,	0.000000001,
            0.01,	0.1,	0.000000001,
            0.01,	0.0000001,	0.000000001,
            0.01,	-0.1,	0.000000001,
            0.01,	-1,	0.000000001,
            0.01,	-10,	0.000000001,
            0.01,	-100,	0.000000001,
            0.01,	-1000,	0.000000001,
            0.1,	100,	0.000000001,
            0.1,	10,	0.000000001,
            0.1,	1,	0.000000001,
            0.1,	0.1,	0.000000001,
            0.1,	0.0000001,	0.000000001,
            0.1,	-0.1,	0.000000001,
            0.1,	-1,	0.000000001,
            0.1,	-10,	0.000000001,
            0.1,	-100,	0.000000001,
            0.1,	-1000,	0.000000001,
            1,	100,	0.000000001,
            1,	10,	0.000000001,
            1,	1,	0.000000001,
            1,	0.1,	0.000000001,
            1,	0.0000001,	0.000000001,
            1,	-0.1,	0.000000001,
            1,	-1,	0.000000001,
            1,	-10,	0.000000001,
            1,	-100,	0.000000001,
            1,	-1000,	0.000000001,
            10,	100,	0.000000001,
            10,	10,	0.000000001,
            10,	1,	0.000000001,
            10,	0.1,	0.000000001,
            10,	0.0000001,	0.000000001,
            10,	-0.1,	0.000000001,
            10,	-1,	0.000000001,
            10,	-10,	0.000000001,
            10,	-100,	0.000000001,
            10,	-1000,	0.000000001,
            100,	100,	0.000000001,
            100,	10,	0.000000001,
            100,	1,	0.000000001,
            100,	0.1,	0.000000001,
            100,	0.0000001,	0.000000001,
            100,	-0.1,	0.000000001,
            100,	-1,	0.000000001,
            100,	-10,	0.000000001,
            100,	-100,	0.000000001,
            100,	-1000,	0.000000001,
            0.000000001,	100,	-0.001,
            0.000000001,	10,	-0.001,
            0.000000001,	1,	-0.001,
            0.000000001,	0.1,	-0.001,
            0.000000001,	0.0000001,	-0.001,
            0.000000001,	-0.1,	-0.001,
            0.000000001,	-1,	-0.001,
            0.000000001,	-10,	-0.001,
            0.000000001,	-100,	-0.001,
            0.000000001,	-1000,	-0.001,
            0.001,	100,	-0.001,
            0.001,	10,	-0.001,
            0.001,	1,	-0.001,
            0.001,	0.1,	-0.001,
            0.001,	0.0000001,	-0.001,
            0.001,	-0.1,	-0.001,
            0.001,	-1,	-0.001,
            0.001,	-10,	-0.001,
            0.001,	-100,	-0.001,
            0.001,	-1000,	-0.001,
            0.01,	100,	-0.001,
            0.01,	10,	-0.001,
            0.01,	1,	-0.001,
            0.01,	0.1,	-0.001,
            0.01,	0.0000001,	-0.001,
            0.01,	-0.1,	-0.001,
            0.01,	-1,	-0.001,
            0.01,	-10,	-0.001,
            0.01,	-100,	-0.001,
            0.01,	-1000,	-0.001,
            0.1,	100,	-0.001,
            0.1,	10,	-0.001,
            0.1,	1,	-0.001,
            0.1,	0.1,	-0.001,
            0.1,	0.0000001,	-0.001,
            0.1,	-0.1,	-0.001,
            0.1,	-1,	-0.001,
            0.1,	-10,	-0.001,
            0.1,	-100,	-0.001,
            0.1,	-1000,	-0.001,
            1,	100,	-0.001,
            1,	10,	-0.001,
            1,	1,	-0.001,
            1,	0.1,	-0.001,
            1,	0.0000001,	-0.001,
            1,	-0.1,	-0.001,
            1,	-1,	-0.001,
            1,	-10,	-0.001,
            1,	-100,	-0.001,
            1,	-1000,	-0.001,
            10,	100,	-0.001,
            10,	10,	-0.001,
            10,	1,	-0.001,
            10,	0.1,	-0.001,
            10,	0.0000001,	-0.001,
            10,	-0.1,	-0.001,
            10,	-1,	-0.001,
            10,	-10,	-0.001,
            10,	-100,	-0.001,
            10,	-1000,	-0.001,
            100,	100,	-0.001,
            100,	10,	-0.001,
            100,	1,	-0.001,
            100,	0.1,	-0.001,
            100,	0.0000001,	-0.001,
            100,	-0.1,	-0.001,
            100,	-1,	-0.001,
            100,	-10,	-0.001,
            100,	-100,	-0.001,
            100,	-1000,	-0.001,
            0.000000001,	100,	-0.01,
            0.000000001,	10,	-0.01,
            0.000000001,	1,	-0.01,
            0.000000001,	0.1,	-0.01,
            0.000000001,	0.0000001,	-0.01,
            0.000000001,	-0.1,	-0.01,
            0.000000001,	-1,	-0.01,
            0.000000001,	-10,	-0.01,
            0.000000001,	-100,	-0.01,
            0.000000001,	-1000,	-0.01,
            0.001,	100,	-0.01,
            0.001,	10,	-0.01,
            0.001,	1,	-0.01,
            0.001,	0.1,	-0.01,
            0.001,	0.0000001,	-0.01,
            0.001,	-0.1,	-0.01,
            0.001,	-1,	-0.01,
            0.001,	-10,	-0.01,
            0.001,	-100,	-0.01,
            0.001,	-1000,	-0.01,
            0.01,	100,	-0.01,
            0.01,	10,	-0.01,
            0.01,	1,	-0.01,
            0.01,	0.1,	-0.01,
            0.01,	0.0000001,	-0.01,
            0.01,	-0.1,	-0.01,
            0.01,	-1,	-0.01,
            0.01,	-10,	-0.01,
            0.01,	-100,	-0.01,
            0.01,	-1000,	-0.01,
            0.1,	100,	-0.01,
            0.1,	10,	-0.01,
            0.1,	1,	-0.01,
            0.1,	0.1,	-0.01,
            0.1,	0.0000001,	-0.01,
            0.1,	-0.1,	-0.01,
            0.1,	-1,	-0.01,
            0.1,	-10,	-0.01,
            0.1,	-100,	-0.01,
            0.1,	-1000,	-0.01,
            1,	100,	-0.01,
            1,	10,	-0.01,
            1,	1,	-0.01,
            1,	0.1,	-0.01,
            1,	0.0000001,	-0.01,
            1,	-0.1,	-0.01,
            1,	-1,	-0.01,
            1,	-10,	-0.01,
            1,	-100,	-0.01,
            1,	-1000,	-0.01,
            10,	100,	-0.01,
            10,	10,	-0.01,
            10,	1,	-0.01,
            10,	0.1,	-0.01,
            10,	0.0000001,	-0.01,
            10,	-0.1,	-0.01,
            10,	-1,	-0.01,
            10,	-10,	-0.01,
            10,	-100,	-0.01,
            10,	-1000,	-0.01,
            100,	100,	-0.01,
            100,	10,	-0.01,
            100,	1,	-0.01,
            100,	0.1,	-0.01,
            100,	0.0000001,	-0.01,
            100,	-0.1,	-0.01,
            100,	-1,	-0.01,
            100,	-10,	-0.01,
            100,	-100,	-0.01,
            100,	-1000,	-0.01,
            0.000000001,	100,	-0.1,
            0.000000001,	10,	-0.1,
            0.000000001,	1,	-0.1,
            0.000000001,	0.1,	-0.1,
            0.000000001,	0.0000001,	-0.1,
            0.000000001,	-0.1,	-0.1,
            0.000000001,	-1,	-0.1,
            0.000000001,	-10,	-0.1,
            0.000000001,	-100,	-0.1,
            0.000000001,	-1000,	-0.1,
            0.001,	100,	-0.1,
            0.001,	10,	-0.1,
            0.001,	1,	-0.1,
            0.001,	0.1,	-0.1,
            0.001,	0.0000001,	-0.1,
            0.001,	-0.1,	-0.1,
            0.001,	-1,	-0.1,
            0.001,	-10,	-0.1,
            0.001,	-100,	-0.1,
            0.001,	-1000,	-0.1,
            0.01,	100,	-0.1,
            0.01,	10,	-0.1,
            0.01,	1,	-0.1,
            0.01,	0.1,	-0.1,
            0.01,	0.0000001,	-0.1,
            0.01,	-0.1,	-0.1,
            0.01,	-1,	-0.1,
            0.01,	-10,	-0.1,
            0.01,	-100,	-0.1,
            0.01,	-1000,	-0.1,
            0.1,	100,	-0.1,
            0.1,	10,	-0.1,
            0.1,	1,	-0.1,
            0.1,	0.1,	-0.1,
            0.1,	0.0000001,	-0.1,
            0.1,	-0.1,	-0.1,
            0.1,	-1,	-0.1,
            0.1,	-10,	-0.1,
            0.1,	-100,	-0.1,
            0.1,	-1000,	-0.1,
            1,	100,	-0.1,
            1,	10,	-0.1,
            1,	1,	-0.1,
            1,	0.1,	-0.1,
            1,	0.0000001,	-0.1,
            1,	-0.1,	-0.1,
            1,	-1,	-0.1,
            1,	-10,	-0.1,
            1,	-100,	-0.1,
            1,	-1000,	-0.1,
            10,	100,	-0.1,
            10,	10,	-0.1,
            10,	1,	-0.1,
            10,	0.1,	-0.1,
            10,	0.0000001,	-0.1,
            10,	-0.1,	-0.1,
            10,	-1,	-0.1,
            10,	-10,	-0.1,
            10,	-100,	-0.1,
            10,	-1000,	-0.1,
            100,	100,	-0.1,
            100,	10,	-0.1,
            100,	1,	-0.1,
            100,	0.1,	-0.1,
            100,	0.0000001,	-0.1,
            100,	-0.1,	-0.1,
            100,	-1,	-0.1,
            100,	-10,	-0.1,
            100,	-100,	-0.1,
            100,	-1000,	-0.1,
            0.000000001,	100,	-1,
            0.000000001,	10,	-1,
            0.000000001,	1,	-1,
            0.000000001,	0.1,	-1,
            0.000000001,	0.0000001,	-1,
            0.000000001,	-0.1,	-1,
            0.000000001,	-1,	-1,
            0.000000001,	-10,	-1,
            0.000000001,	-100,	-1,
            0.000000001,	-1000,	-1,
            0.001,	100,	-1,
            0.001,	10,	-1,
            0.001,	1,	-1,
            0.001,	0.1,	-1,
            0.001,	0.0000001,	-1,
            0.001,	-0.1,	-1,
            0.001,	-1,	-1,
            0.001,	-10,	-1,
            0.001,	-100,	-1,
            0.001,	-1000,	-1,
            0.01,	100,	-1,
            0.01,	10,	-1,
            0.01,	1,	-1,
            0.01,	0.1,	-1,
            0.01,	0.0000001,	-1,
            0.01,	-0.1,	-1,
            0.01,	-1,	-1,
            0.01,	-10,	-1,
            0.01,	-100,	-1,
            0.01,	-1000,	-1,
            0.1,	100,	-1,
            0.1,	10,	-1,
            0.1,	1,	-1,
            0.1,	0.1,	-1,
            0.1,	0.0000001,	-1,
            0.1,	-0.1,	-1,
            0.1,	-1,	-1,
            0.1,	-10,	-1,
            0.1,	-100,	-1,
            0.1,	-1000,	-1,
            1,	100,	-1,
            1,	10,	-1,
            1,	1,	-1,
            1,	0.1,	-1,
            1,	0.0000001,	-1,
            1,	-0.1,	-1,
            1,	-1,	-1,
            1,	-10,	-1,
            1,	-100,	-1,
            1,	-1000,	-1,
            10,	100,	-1,
            10,	10,	-1,
            10,	1,	-1,
            10,	0.1,	-1,
            10,	0.0000001,	-1,
            10,	-0.1,	-1,
            10,	-1,	-1,
            10,	-10,	-1,
            10,	-100,	-1,
            10,	-1000,	-1,
            100,	100,	-1,
            100,	10,	-1,
            100,	1,	-1,
            100,	0.1,	-1,
            100,	0.0000001,	-1,
            100,	-0.1,	-1,
            100,	-1,	-1,
            100,	-10,	-1,
            100,	-100,	-1,
            100,	-1000,	-1,
            0.000000001,	100,	-3,
            0.000000001,	10,	-3,
            0.000000001,	1,	-3,
            0.000000001,	0.1,	-3,
            0.000000001,	0.0000001,	-3,
            0.000000001,	-0.1,	-3,
            0.000000001,	-1,	-3,
            0.000000001,	-10,	-3,
            0.000000001,	-100,	-3,
            0.000000001,	-1000,	-3,
            0.001,	100,	-3,
            0.001,	10,	-3,
            0.001,	1,	-3,
            0.001,	0.1,	-3,
            0.001,	0.0000001,	-3,
            0.001,	-0.1,	-3,
            0.001,	-1,	-3,
            0.001,	-10,	-3,
            0.001,	-100,	-3,
            0.001,	-1000,	-3,
            0.01,	100,	-3,
            0.01,	10,	-3,
            0.01,	1,	-3,
            0.01,	0.1,	-3,
            0.01,	0.0000001,	-3,
            0.01,	-0.1,	-3,
            0.01,	-1,	-3,
            0.01,	-10,	-3,
            0.01,	-100,	-3,
            0.01,	-1000,	-3,
            0.1,	100,	-3,
            0.1,	10,	-3,
            0.1,	1,	-3,
            0.1,	0.1,	-3,
            0.1,	0.0000001,	-3,
            0.1,	-0.1,	-3,
            0.1,	-1,	-3,
            0.1,	-10,	-3,
            0.1,	-100,	-3,
            0.1,	-1000,	-3,
            1,	100,	-3,
            1,	10,	-3,
            1,	1,	-3,
            1,	0.1,	-3,
            1,	0.0000001,	-3,
            1,	-0.1,	-3,
            1,	-1,	-3,
            1,	-10,	-3,
            1,	-100,	-3,
            1,	-1000,	-3,
            10,	100,	-3,
            10,	10,	-3,
            10,	1,	-3,
            10,	0.1,	-3,
            10,	0.0000001,	-3,
            10,	-0.1,	-3,
            10,	-1,	-3,
            10,	-10,	-3,
            10,	-100,	-3,
            10,	-1000,	-3,
            100,	100,	-3,
            100,	10,	-3,
            100,	1,	-3,
            100,	0.1,	-3,
            100,	0.0000001,	-3,
            100,	-0.1,	-3,
            100,	-1,	-3,
            100,	-10,	-3,
            100,	-100,	-3,
            100,	-1000,	-3
         )
         p_starting <- matrix(p_matrix, length(p_matrix)/3, 3, byrow=TRUE)
         result_matrix <- matrix(NA, nrow(p_starting), 4)
         result_matrix[,1:3] <- p_starting
      }



     if(MODEL == "OU_linear_breakpoint"){
         p_matrix <- c(
	0.0001,	0.000001,	20,	0.000001,	0.1,	0.000001,	0.000001,
	0.1,	0.000001,	20,	0.000001,	0.1,	0.000001,	0.000001,
	1,	0.000001,	20,	0.000001,	0.1,	0.000001,	0.000001,
	10,	0.000001,	20,	0.000001,	0.1,	0.000001,	0.000001,
	100,	0.000001,	20,	0.000001,	0.1,	0.000001,	0.000001,
	0.0001,	0.01,	20,	0.000001,	0.1,	0.000001,	0.000001,
	0.1,	0.01,	20,	0.000001,	0.1,	0.000001,	0.000001,
	1,	0.01,	20,	0.000001,	0.1,	0.000001,	0.000001,
	10,	0.01,	20,	0.000001,	0.1,	0.000001,	0.000001,
	100,	0.01,	20,	0.000001,	0.1,	0.000001,	0.000001,
	0.0001,	1,	20,	0.000001,	0.1,	0.000001,	0.000001,
	0.1,	1,	20,	0.000001,	0.1,	0.000001,	0.000001,
	1,	1,	20,	0.000001,	0.1,	0.000001,	0.000001,
	10,	1,	20,	0.000001,	0.1,	0.000001,	0.000001,
	100,	1,	20,	0.000001,	0.1,	0.000001,	0.000001,
	0.0001,	-0.01,	20,	0.000001,	0.1,	0.000001,	0.000001,
	0.1,	-0.01,	20,	0.000001,	0.1,	0.000001,	0.000001,
	1,	-0.01,	20,	0.000001,	0.1,	0.000001,	0.000001,
	10,	-0.01,	20,	0.000001,	0.1,	0.000001,	0.000001,
	100,	-0.01,	20,	0.000001,	0.1,	0.000001,	0.000001,
	0.0001,	-1,	20,	0.000001,	0.1,	0.000001,	0.000001,
	0.1,	-1,	20,	0.000001,	0.1,	0.000001,	0.000001,
	1,	-1,	20,	0.000001,	0.1,	0.000001,	0.000001,
	10,	-1,	20,	0.000001,	0.1,	0.000001,	0.000001,
	100,	-1,	20,	0.000001,	0.1,	0.000001,	0.000001,
	0.0001,	0.000001,	20,	0.01,	0.1,	0.000001,	0.000001,
	0.1,	0.000001,	20,	0.01,	0.1,	0.000001,	0.000001,
	1,	0.000001,	20,	0.01,	0.1,	0.000001,	0.000001,
	10,	0.000001,	20,	0.01,	0.1,	0.000001,	0.000001,
	100,	0.000001,	20,	0.01,	0.1,	0.000001,	0.000001,
	0.0001,	0.01,	20,	0.01,	0.1,	0.000001,	0.000001,
	0.1,	0.01,	20,	0.01,	0.1,	0.000001,	0.000001,
	1,	0.01,	20,	0.01,	0.1,	0.000001,	0.000001,
	10,	0.01,	20,	0.01,	0.1,	0.000001,	0.000001,
	100,	0.01,	20,	0.01,	0.1,	0.000001,	0.000001,
	0.0001,	1,	20,	0.01,	0.1,	0.000001,	0.000001,
	0.1,	1,	20,	0.01,	0.1,	0.000001,	0.000001,
	1,	1,	20,	0.01,	0.1,	0.000001,	0.000001,
	10,	1,	20,	0.01,	0.1,	0.000001,	0.000001,
	100,	1,	20,	0.01,	0.1,	0.000001,	0.000001,
	0.0001,	-0.01,	20,	0.01,	0.1,	0.000001,	0.000001,
	0.1,	-0.01,	20,	0.01,	0.1,	0.000001,	0.000001,
	1,	-0.01,	20,	0.01,	0.1,	0.000001,	0.000001,
	10,	-0.01,	20,	0.01,	0.1,	0.000001,	0.000001,
	100,	-0.01,	20,	0.01,	0.1,	0.000001,	0.000001,
	0.0001,	-1,	20,	0.01,	0.1,	0.000001,	0.000001,
	0.1,	-1,	20,	0.01,	0.1,	0.000001,	0.000001,
	1,	-1,	20,	0.01,	0.1,	0.000001,	0.000001,
	10,	-1,	20,	0.01,	0.1,	0.000001,	0.000001,
	100,	-1,	20,	0.01,	0.1,	0.000001,	0.000001,
	0.0001,	0.000001,	20,	1,	0.1,	0.000001,	0.000001,
	0.1,	0.000001,	20,	1,	0.1,	0.000001,	0.000001,
	1,	0.000001,	20,	1,	0.1,	0.000001,	0.000001,
	10,	0.000001,	20,	1,	0.1,	0.000001,	0.000001,
	100,	0.000001,	20,	1,	0.1,	0.000001,	0.000001,
	0.0001,	0.01,	20,	1,	0.1,	0.000001,	0.000001,
	0.1,	0.01,	20,	1,	0.1,	0.000001,	0.000001,
	1,	0.01,	20,	1,	0.1,	0.000001,	0.000001,
	10,	0.01,	20,	1,	0.1,	0.000001,	0.000001,
	100,	0.01,	20,	1,	0.1,	0.000001,	0.000001,
	0.0001,	1,	20,	1,	0.1,	0.000001,	0.000001,
	0.1,	1,	20,	1,	0.1,	0.000001,	0.000001,
	1,	1,	20,	1,	0.1,	0.000001,	0.000001,
	10,	1,	20,	1,	0.1,	0.000001,	0.000001,
	100,	1,	20,	1,	0.1,	0.000001,	0.000001,
	0.0001,	-0.01,	20,	1,	0.1,	0.000001,	0.000001,
	0.1,	-0.01,	20,	1,	0.1,	0.000001,	0.000001,
	1,	-0.01,	20,	1,	0.1,	0.000001,	0.000001,
	10,	-0.01,	20,	1,	0.1,	0.000001,	0.000001,
	100,	-0.01,	20,	1,	0.1,	0.000001,	0.000001,
	0.0001,	-1,	20,	1,	0.1,	0.000001,	0.000001,
	0.1,	-1,	20,	1,	0.1,	0.000001,	0.000001,
	1,	-1,	20,	1,	0.1,	0.000001,	0.000001,
	10,	-1,	20,	1,	0.1,	0.000001,	0.000001,
	100,	-1,	20,	1,	0.1,	0.000001,	0.000001,
	0.0001,	0.000001,	20,	-0.01,	0.1,	0.000001,	0.000001,
	0.1,	0.000001,	20,	-0.01,	0.1,	0.000001,	0.000001,
	1,	0.000001,	20,	-0.01,	0.1,	0.000001,	0.000001,
	10,	0.000001,	20,	-0.01,	0.1,	0.000001,	0.000001,
	100,	0.000001,	20,	-0.01,	0.1,	0.000001,	0.000001,
	0.0001,	0.01,	20,	-0.01,	0.1,	0.000001,	0.000001,
	0.1,	0.01,	20,	-0.01,	0.1,	0.000001,	0.000001,
	1,	0.01,	20,	-0.01,	0.1,	0.000001,	0.000001,
	10,	0.01,	20,	-0.01,	0.1,	0.000001,	0.000001,
	100,	0.01,	20,	-0.01,	0.1,	0.000001,	0.000001,
	0.0001,	1,	20,	-0.01,	0.1,	0.000001,	0.000001,
	0.1,	1,	20,	-0.01,	0.1,	0.000001,	0.000001,
	1,	1,	20,	-0.01,	0.1,	0.000001,	0.000001,
	10,	1,	20,	-0.01,	0.1,	0.000001,	0.000001,
	100,	1,	20,	-0.01,	0.1,	0.000001,	0.000001,
	0.0001,	-0.01,	20,	-0.01,	0.1,	0.000001,	0.000001,
	0.1,	-0.01,	20,	-0.01,	0.1,	0.000001,	0.000001,
	1,	-0.01,	20,	-0.01,	0.1,	0.000001,	0.000001,
	10,	-0.01,	20,	-0.01,	0.1,	0.000001,	0.000001,
	100,	-0.01,	20,	-0.01,	0.1,	0.000001,	0.000001,
	0.0001,	-1,	20,	-0.01,	0.1,	0.000001,	0.000001,
	0.1,	-1,	20,	-0.01,	0.1,	0.000001,	0.000001,
	1,	-1,	20,	-0.01,	0.1,	0.000001,	0.000001,
	10,	-1,	20,	-0.01,	0.1,	0.000001,	0.000001,
	100,	-1,	20,	-0.01,	0.1,	0.000001,	0.000001,
	0.0001,	0.000001,	20,	-1,	0.1,	0.000001,	0.000001,
	0.1,	0.000001,	20,	-1,	0.1,	0.000001,	0.000001,
	1,	0.000001,	20,	-1,	0.1,	0.000001,	0.000001,
	10,	0.000001,	20,	-1,	0.1,	0.000001,	0.000001,
	100,	0.000001,	20,	-1,	0.1,	0.000001,	0.000001,
	0.0001,	0.01,	20,	-1,	0.1,	0.000001,	0.000001,
	0.1,	0.01,	20,	-1,	0.1,	0.000001,	0.000001,
	1,	0.01,	20,	-1,	0.1,	0.000001,	0.000001,
	10,	0.01,	20,	-1,	0.1,	0.000001,	0.000001,
	100,	0.01,	20,	-1,	0.1,	0.000001,	0.000001,
	0.0001,	1,	20,	-1,	0.1,	0.000001,	0.000001,
	0.1,	1,	20,	-1,	0.1,	0.000001,	0.000001,
	1,	1,	20,	-1,	0.1,	0.000001,	0.000001,
	10,	1,	20,	-1,	0.1,	0.000001,	0.000001,
	100,	1,	20,	-1,	0.1,	0.000001,	0.000001,
	0.0001,	-0.01,	20,	-1,	0.1,	0.000001,	0.000001,
	0.1,	-0.01,	20,	-1,	0.1,	0.000001,	0.000001,
	1,	-0.01,	20,	-1,	0.1,	0.000001,	0.000001,
	10,	-0.01,	20,	-1,	0.1,	0.000001,	0.000001,
	100,	-0.01,	20,	-1,	0.1,	0.000001,	0.000001,
	0.0001,	-1,	20,	-1,	0.1,	0.000001,	0.000001,
	0.1,	-1,	20,	-1,	0.1,	0.000001,	0.000001,
	1,	-1,	20,	-1,	0.1,	0.000001,	0.000001,
	10,	-1,	20,	-1,	0.1,	0.000001,	0.000001,
	100,	-1,	20,	-1,	0.1,	0.000001,	0.000001,
	0.0001,	0.000001,	20,	0.000001,	0.1,	0.01,	0.01,
	0.1,	0.000001,	20,	0.000001,	0.1,	0.01,	0.01,
	1,	0.000001,	20,	0.000001,	0.1,	0.01,	0.01,
	10,	0.000001,	20,	0.000001,	0.1,	0.01,	0.01,
	100,	0.000001,	20,	0.000001,	0.1,	0.01,	0.01,
	0.0001,	0.01,	20,	0.000001,	0.1,	0.01,	0.01,
	0.1,	0.01,	20,	0.000001,	0.1,	0.01,	0.01,
	1,	0.01,	20,	0.000001,	0.1,	0.01,	0.01,
	10,	0.01,	20,	0.000001,	0.1,	0.01,	0.01,
	100,	0.01,	20,	0.000001,	0.1,	0.01,	0.01,
	0.0001,	1,	20,	0.000001,	0.1,	0.01,	0.01,
	0.1,	1,	20,	0.000001,	0.1,	0.01,	0.01,
	1,	1,	20,	0.000001,	0.1,	0.01,	0.01,
	10,	1,	20,	0.000001,	0.1,	0.01,	0.01,
	100,	1,	20,	0.000001,	0.1,	0.01,	0.01,
	0.0001,	-0.01,	20,	0.000001,	0.1,	0.01,	0.01,
	0.1,	-0.01,	20,	0.000001,	0.1,	0.01,	0.01,
	1,	-0.01,	20,	0.000001,	0.1,	0.01,	0.01,
	10,	-0.01,	20,	0.000001,	0.1,	0.01,	0.01,
	100,	-0.01,	20,	0.000001,	0.1,	0.01,	0.01,
	0.0001,	-1,	20,	0.000001,	0.1,	0.01,	0.01,
	0.1,	-1,	20,	0.000001,	0.1,	0.01,	0.01,
	1,	-1,	20,	0.000001,	0.1,	0.01,	0.01,
	10,	-1,	20,	0.000001,	0.1,	0.01,	0.01,
	100,	-1,	20,	0.000001,	0.1,	0.01,	0.01,
	0.0001,	0.000001,	20,	0.01,	0.1,	0.01,	0.01,
	0.1,	0.000001,	20,	0.01,	0.1,	0.01,	0.01,
	1,	0.000001,	20,	0.01,	0.1,	0.01,	0.01,
	10,	0.000001,	20,	0.01,	0.1,	0.01,	0.01,
	100,	0.000001,	20,	0.01,	0.1,	0.01,	0.01,
	0.0001,	0.01,	20,	0.01,	0.1,	0.01,	0.01,
	0.1,	0.01,	20,	0.01,	0.1,	0.01,	0.01,
	1,	0.01,	20,	0.01,	0.1,	0.01,	0.01,
	10,	0.01,	20,	0.01,	0.1,	0.01,	0.01,
	100,	0.01,	20,	0.01,	0.1,	0.01,	0.01,
	0.0001,	1,	20,	0.01,	0.1,	0.01,	0.01,
	0.1,	1,	20,	0.01,	0.1,	0.01,	0.01,
	1,	1,	20,	0.01,	0.1,	0.01,	0.01,
	10,	1,	20,	0.01,	0.1,	0.01,	0.01,
	100,	1,	20,	0.01,	0.1,	0.01,	0.01,
	0.0001,	-0.01,	20,	0.01,	0.1,	0.01,	0.01,
	0.1,	-0.01,	20,	0.01,	0.1,	0.01,	0.01,
	1,	-0.01,	20,	0.01,	0.1,	0.01,	0.01,
	10,	-0.01,	20,	0.01,	0.1,	0.01,	0.01,
	100,	-0.01,	20,	0.01,	0.1,	0.01,	0.01,
	0.0001,	-1,	20,	0.01,	0.1,	0.01,	0.01,
	0.1,	-1,	20,	0.01,	0.1,	0.01,	0.01,
	1,	-1,	20,	0.01,	0.1,	0.01,	0.01,
	10,	-1,	20,	0.01,	0.1,	0.01,	0.01,
	100,	-1,	20,	0.01,	0.1,	0.01,	0.01,
	0.0001,	0.000001,	20,	1,	0.1,	0.01,	0.01,
	0.1,	0.000001,	20,	1,	0.1,	0.01,	0.01,
	1,	0.000001,	20,	1,	0.1,	0.01,	0.01,
	10,	0.000001,	20,	1,	0.1,	0.01,	0.01,
	100,	0.000001,	20,	1,	0.1,	0.01,	0.01,
	0.0001,	0.01,	20,	1,	0.1,	0.01,	0.01,
	0.1,	0.01,	20,	1,	0.1,	0.01,	0.01,
	1,	0.01,	20,	1,	0.1,	0.01,	0.01,
	10,	0.01,	20,	1,	0.1,	0.01,	0.01,
	100,	0.01,	20,	1,	0.1,	0.01,	0.01,
	0.0001,	1,	20,	1,	0.1,	0.01,	0.01,
	0.1,	1,	20,	1,	0.1,	0.01,	0.01,
	1,	1,	20,	1,	0.1,	0.01,	0.01,
	10,	1,	20,	1,	0.1,	0.01,	0.01,
	100,	1,	20,	1,	0.1,	0.01,	0.01,
	0.0001,	-0.01,	20,	1,	0.1,	0.01,	0.01,
	0.1,	-0.01,	20,	1,	0.1,	0.01,	0.01,
	1,	-0.01,	20,	1,	0.1,	0.01,	0.01,
	10,	-0.01,	20,	1,	0.1,	0.01,	0.01,
	100,	-0.01,	20,	1,	0.1,	0.01,	0.01,
	0.0001,	-1,	20,	1,	0.1,	0.01,	0.01,
	0.1,	-1,	20,	1,	0.1,	0.01,	0.01,
	1,	-1,	20,	1,	0.1,	0.01,	0.01,
	10,	-1,	20,	1,	0.1,	0.01,	0.01,
	100,	-1,	20,	1,	0.1,	0.01,	0.01,
	0.0001,	0.000001,	20,	-0.01,	0.1,	0.01,	0.01,
	0.1,	0.000001,	20,	-0.01,	0.1,	0.01,	0.01,
	1,	0.000001,	20,	-0.01,	0.1,	0.01,	0.01,
	10,	0.000001,	20,	-0.01,	0.1,	0.01,	0.01,
	100,	0.000001,	20,	-0.01,	0.1,	0.01,	0.01,
	0.0001,	0.01,	20,	-0.01,	0.1,	0.01,	0.01,
	0.1,	0.01,	20,	-0.01,	0.1,	0.01,	0.01,
	1,	0.01,	20,	-0.01,	0.1,	0.01,	0.01,
	10,	0.01,	20,	-0.01,	0.1,	0.01,	0.01,
	100,	0.01,	20,	-0.01,	0.1,	0.01,	0.01,
	0.0001,	1,	20,	-0.01,	0.1,	0.01,	0.01,
	0.1,	1,	20,	-0.01,	0.1,	0.01,	0.01,
	1,	1,	20,	-0.01,	0.1,	0.01,	0.01,
	10,	1,	20,	-0.01,	0.1,	0.01,	0.01,
	100,	1,	20,	-0.01,	0.1,	0.01,	0.01,
	0.0001,	-0.01,	20,	-0.01,	0.1,	0.01,	0.01,
	0.1,	-0.01,	20,	-0.01,	0.1,	0.01,	0.01,
	1,	-0.01,	20,	-0.01,	0.1,	0.01,	0.01,
	10,	-0.01,	20,	-0.01,	0.1,	0.01,	0.01,
	100,	-0.01,	20,	-0.01,	0.1,	0.01,	0.01,
	0.0001,	-1,	20,	-0.01,	0.1,	0.01,	0.01,
	0.1,	-1,	20,	-0.01,	0.1,	0.01,	0.01,
	1,	-1,	20,	-0.01,	0.1,	0.01,	0.01,
	10,	-1,	20,	-0.01,	0.1,	0.01,	0.01,
	100,	-1,	20,	-0.01,	0.1,	0.01,	0.01,
	0.0001,	0.000001,	20,	-1,	0.1,	0.01,	0.01,
	0.1,	0.000001,	20,	-1,	0.1,	0.01,	0.01,
	1,	0.000001,	20,	-1,	0.1,	0.01,	0.01,
	10,	0.000001,	20,	-1,	0.1,	0.01,	0.01,
	100,	0.000001,	20,	-1,	0.1,	0.01,	0.01,
	0.0001,	0.01,	20,	-1,	0.1,	0.01,	0.01,
	0.1,	0.01,	20,	-1,	0.1,	0.01,	0.01,
	1,	0.01,	20,	-1,	0.1,	0.01,	0.01,
	10,	0.01,	20,	-1,	0.1,	0.01,	0.01,
	100,	0.01,	20,	-1,	0.1,	0.01,	0.01,
	0.0001,	1,	20,	-1,	0.1,	0.01,	0.01,
	0.1,	1,	20,	-1,	0.1,	0.01,	0.01,
	1,	1,	20,	-1,	0.1,	0.01,	0.01,
	10,	1,	20,	-1,	0.1,	0.01,	0.01,
	100,	1,	20,	-1,	0.1,	0.01,	0.01,
	0.0001,	-0.01,	20,	-1,	0.1,	0.01,	0.01,
	0.1,	-0.01,	20,	-1,	0.1,	0.01,	0.01,
	1,	-0.01,	20,	-1,	0.1,	0.01,	0.01,
	10,	-0.01,	20,	-1,	0.1,	0.01,	0.01,
	100,	-0.01,	20,	-1,	0.1,	0.01,	0.01,
	0.0001,	-1,	20,	-1,	0.1,	0.01,	0.01,
	0.1,	-1,	20,	-1,	0.1,	0.01,	0.01,
	1,	-1,	20,	-1,	0.1,	0.01,	0.01,
	10,	-1,	20,	-1,	0.1,	0.01,	0.01,
	100,	-1,	20,	-1,	0.1,	0.01,	0.01,
	0.0001,	0.000001,	20,	0.000001,	0.1,	1,	1,
	0.1,	0.000001,	20,	0.000001,	0.1,	1,	1,
	1,	0.000001,	20,	0.000001,	0.1,	1,	1,
	10,	0.000001,	20,	0.000001,	0.1,	1,	1,
	100,	0.000001,	20,	0.000001,	0.1,	1,	1,
	0.0001,	0.01,	20,	0.000001,	0.1,	1,	1,
	0.1,	0.01,	20,	0.000001,	0.1,	1,	1,
	1,	0.01,	20,	0.000001,	0.1,	1,	1,
	10,	0.01,	20,	0.000001,	0.1,	1,	1,
	100,	0.01,	20,	0.000001,	0.1,	1,	1,
	0.0001,	1,	20,	0.000001,	0.1,	1,	1,
	0.1,	1,	20,	0.000001,	0.1,	1,	1,
	1,	1,	20,	0.000001,	0.1,	1,	1,
	10,	1,	20,	0.000001,	0.1,	1,	1,
	100,	1,	20,	0.000001,	0.1,	1,	1,
	0.0001,	-0.01,	20,	0.000001,	0.1,	1,	1,
	0.1,	-0.01,	20,	0.000001,	0.1,	1,	1,
	1,	-0.01,	20,	0.000001,	0.1,	1,	1,
	10,	-0.01,	20,	0.000001,	0.1,	1,	1,
	100,	-0.01,	20,	0.000001,	0.1,	1,	1,
	0.0001,	-1,	20,	0.000001,	0.1,	1,	1,
	0.1,	-1,	20,	0.000001,	0.1,	1,	1,
	1,	-1,	20,	0.000001,	0.1,	1,	1,
	10,	-1,	20,	0.000001,	0.1,	1,	1,
	100,	-1,	20,	0.000001,	0.1,	1,	1,
	0.0001,	0.000001,	20,	0.01,	0.1,	1,	1,
	0.1,	0.000001,	20,	0.01,	0.1,	1,	1,
	1,	0.000001,	20,	0.01,	0.1,	1,	1,
	10,	0.000001,	20,	0.01,	0.1,	1,	1,
	100,	0.000001,	20,	0.01,	0.1,	1,	1,
	0.0001,	0.01,	20,	0.01,	0.1,	1,	1,
	0.1,	0.01,	20,	0.01,	0.1,	1,	1,
	1,	0.01,	20,	0.01,	0.1,	1,	1,
	10,	0.01,	20,	0.01,	0.1,	1,	1,
	100,	0.01,	20,	0.01,	0.1,	1,	1,
	0.0001,	1,	20,	0.01,	0.1,	1,	1,
	0.1,	1,	20,	0.01,	0.1,	1,	1,
	1,	1,	20,	0.01,	0.1,	1,	1,
	10,	1,	20,	0.01,	0.1,	1,	1,
	100,	1,	20,	0.01,	0.1,	1,	1,
	0.0001,	-0.01,	20,	0.01,	0.1,	1,	1,
	0.1,	-0.01,	20,	0.01,	0.1,	1,	1,
	1,	-0.01,	20,	0.01,	0.1,	1,	1,
	10,	-0.01,	20,	0.01,	0.1,	1,	1,
	100,	-0.01,	20,	0.01,	0.1,	1,	1,
	0.0001,	-1,	20,	0.01,	0.1,	1,	1,
	0.1,	-1,	20,	0.01,	0.1,	1,	1,
	1,	-1,	20,	0.01,	0.1,	1,	1,
	10,	-1,	20,	0.01,	0.1,	1,	1,
	100,	-1,	20,	0.01,	0.1,	1,	1,
	0.0001,	0.000001,	20,	1,	0.1,	1,	1,
	0.1,	0.000001,	20,	1,	0.1,	1,	1,
	1,	0.000001,	20,	1,	0.1,	1,	1,
	10,	0.000001,	20,	1,	0.1,	1,	1,
	100,	0.000001,	20,	1,	0.1,	1,	1,
	0.0001,	0.01,	20,	1,	0.1,	1,	1,
	0.1,	0.01,	20,	1,	0.1,	1,	1,
	1,	0.01,	20,	1,	0.1,	1,	1,
	10,	0.01,	20,	1,	0.1,	1,	1,
	100,	0.01,	20,	1,	0.1,	1,	1,
	0.0001,	1,	20,	1,	0.1,	1,	1,
	0.1,	1,	20,	1,	0.1,	1,	1,
	1,	1,	20,	1,	0.1,	1,	1,
	10,	1,	20,	1,	0.1,	1,	1,
	100,	1,	20,	1,	0.1,	1,	1,
	0.0001,	-0.01,	20,	1,	0.1,	1,	1,
	0.1,	-0.01,	20,	1,	0.1,	1,	1,
	1,	-0.01,	20,	1,	0.1,	1,	1,
	10,	-0.01,	20,	1,	0.1,	1,	1,
	100,	-0.01,	20,	1,	0.1,	1,	1,
	0.0001,	-1,	20,	1,	0.1,	1,	1,
	0.1,	-1,	20,	1,	0.1,	1,	1,
	1,	-1,	20,	1,	0.1,	1,	1,
	10,	-1,	20,	1,	0.1,	1,	1,
	100,	-1,	20,	1,	0.1,	1,	1,
	0.0001,	0.000001,	20,	-0.01,	0.1,	1,	1,
	0.1,	0.000001,	20,	-0.01,	0.1,	1,	1,
	1,	0.000001,	20,	-0.01,	0.1,	1,	1,
	10,	0.000001,	20,	-0.01,	0.1,	1,	1,
	100,	0.000001,	20,	-0.01,	0.1,	1,	1,
	0.0001,	0.01,	20,	-0.01,	0.1,	1,	1,
	0.1,	0.01,	20,	-0.01,	0.1,	1,	1,
	1,	0.01,	20,	-0.01,	0.1,	1,	1,
	10,	0.01,	20,	-0.01,	0.1,	1,	1,
	100,	0.01,	20,	-0.01,	0.1,	1,	1,
	0.0001,	1,	20,	-0.01,	0.1,	1,	1,
	0.1,	1,	20,	-0.01,	0.1,	1,	1,
	1,	1,	20,	-0.01,	0.1,	1,	1,
	10,	1,	20,	-0.01,	0.1,	1,	1,
	100,	1,	20,	-0.01,	0.1,	1,	1,
	0.0001,	-0.01,	20,	-0.01,	0.1,	1,	1,
	0.1,	-0.01,	20,	-0.01,	0.1,	1,	1,
	1,	-0.01,	20,	-0.01,	0.1,	1,	1,
	10,	-0.01,	20,	-0.01,	0.1,	1,	1,
	100,	-0.01,	20,	-0.01,	0.1,	1,	1,
	0.0001,	-1,	20,	-0.01,	0.1,	1,	1,
	0.1,	-1,	20,	-0.01,	0.1,	1,	1,
	1,	-1,	20,	-0.01,	0.1,	1,	1,
	10,	-1,	20,	-0.01,	0.1,	1,	1,
	100,	-1,	20,	-0.01,	0.1,	1,	1,
	0.0001,	0.000001,	20,	-1,	0.1,	1,	1,
	0.1,	0.000001,	20,	-1,	0.1,	1,	1,
	1,	0.000001,	20,	-1,	0.1,	1,	1,
	10,	0.000001,	20,	-1,	0.1,	1,	1,
	100,	0.000001,	20,	-1,	0.1,	1,	1,
	0.0001,	0.01,	20,	-1,	0.1,	1,	1,
	0.1,	0.01,	20,	-1,	0.1,	1,	1,
	1,	0.01,	20,	-1,	0.1,	1,	1,
	10,	0.01,	20,	-1,	0.1,	1,	1,
	100,	0.01,	20,	-1,	0.1,	1,	1,
	0.0001,	1,	20,	-1,	0.1,	1,	1,
	0.1,	1,	20,	-1,	0.1,	1,	1,
	1,	1,	20,	-1,	0.1,	1,	1,
	10,	1,	20,	-1,	0.1,	1,	1,
	100,	1,	20,	-1,	0.1,	1,	1,
	0.0001,	-0.01,	20,	-1,	0.1,	1,	1,
	0.1,	-0.01,	20,	-1,	0.1,	1,	1,
	1,	-0.01,	20,	-1,	0.1,	1,	1,
	10,	-0.01,	20,	-1,	0.1,	1,	1,
	100,	-0.01,	20,	-1,	0.1,	1,	1,
	0.0001,	-1,	20,	-1,	0.1,	1,	1,
	0.1,	-1,	20,	-1,	0.1,	1,	1,
	1,	-1,	20,	-1,	0.1,	1,	1,
	10,	-1,	20,	-1,	0.1,	1,	1,
	100,	-1,	20,	-1,	0.1,	1,	1,
	0.0001,	0.000001,	20,	0.000001,	0.1,	-0.01,	-0.01,
	0.1,	0.000001,	20,	0.000001,	0.1,	-0.01,	-0.01,
	1,	0.000001,	20,	0.000001,	0.1,	-0.01,	-0.01,
	10,	0.000001,	20,	0.000001,	0.1,	-0.01,	-0.01,
	100,	0.000001,	20,	0.000001,	0.1,	-0.01,	-0.01,
	0.0001,	0.01,	20,	0.000001,	0.1,	-0.01,	-0.01,
	0.1,	0.01,	20,	0.000001,	0.1,	-0.01,	-0.01,
	1,	0.01,	20,	0.000001,	0.1,	-0.01,	-0.01,
	10,	0.01,	20,	0.000001,	0.1,	-0.01,	-0.01,
	100,	0.01,	20,	0.000001,	0.1,	-0.01,	-0.01,
	0.0001,	1,	20,	0.000001,	0.1,	-0.01,	-0.01,
	0.1,	1,	20,	0.000001,	0.1,	-0.01,	-0.01,
	1,	1,	20,	0.000001,	0.1,	-0.01,	-0.01,
	10,	1,	20,	0.000001,	0.1,	-0.01,	-0.01,
	100,	1,	20,	0.000001,	0.1,	-0.01,	-0.01,
	0.0001,	-0.01,	20,	0.000001,	0.1,	-0.01,	-0.01,
	0.1,	-0.01,	20,	0.000001,	0.1,	-0.01,	-0.01,
	1,	-0.01,	20,	0.000001,	0.1,	-0.01,	-0.01,
	10,	-0.01,	20,	0.000001,	0.1,	-0.01,	-0.01,
	100,	-0.01,	20,	0.000001,	0.1,	-0.01,	-0.01,
	0.0001,	-1,	20,	0.000001,	0.1,	-0.01,	-0.01,
	0.1,	-1,	20,	0.000001,	0.1,	-0.01,	-0.01,
	1,	-1,	20,	0.000001,	0.1,	-0.01,	-0.01,
	10,	-1,	20,	0.000001,	0.1,	-0.01,	-0.01,
	100,	-1,	20,	0.000001,	0.1,	-0.01,	-0.01,
	0.0001,	0.000001,	20,	0.01,	0.1,	-0.01,	-0.01,
	0.1,	0.000001,	20,	0.01,	0.1,	-0.01,	-0.01,
	1,	0.000001,	20,	0.01,	0.1,	-0.01,	-0.01,
	10,	0.000001,	20,	0.01,	0.1,	-0.01,	-0.01,
	100,	0.000001,	20,	0.01,	0.1,	-0.01,	-0.01,
	0.0001,	0.01,	20,	0.01,	0.1,	-0.01,	-0.01,
	0.1,	0.01,	20,	0.01,	0.1,	-0.01,	-0.01,
	1,	0.01,	20,	0.01,	0.1,	-0.01,	-0.01,
	10,	0.01,	20,	0.01,	0.1,	-0.01,	-0.01,
	100,	0.01,	20,	0.01,	0.1,	-0.01,	-0.01,
	0.0001,	1,	20,	0.01,	0.1,	-0.01,	-0.01,
	0.1,	1,	20,	0.01,	0.1,	-0.01,	-0.01,
	1,	1,	20,	0.01,	0.1,	-0.01,	-0.01,
	10,	1,	20,	0.01,	0.1,	-0.01,	-0.01,
	100,	1,	20,	0.01,	0.1,	-0.01,	-0.01,
	0.0001,	-0.01,	20,	0.01,	0.1,	-0.01,	-0.01,
	0.1,	-0.01,	20,	0.01,	0.1,	-0.01,	-0.01,
	1,	-0.01,	20,	0.01,	0.1,	-0.01,	-0.01,
	10,	-0.01,	20,	0.01,	0.1,	-0.01,	-0.01,
	100,	-0.01,	20,	0.01,	0.1,	-0.01,	-0.01,
	0.0001,	-1,	20,	0.01,	0.1,	-0.01,	-0.01,
	0.1,	-1,	20,	0.01,	0.1,	-0.01,	-0.01,
	1,	-1,	20,	0.01,	0.1,	-0.01,	-0.01,
	10,	-1,	20,	0.01,	0.1,	-0.01,	-0.01,
	100,	-1,	20,	0.01,	0.1,	-0.01,	-0.01,
	0.0001,	0.000001,	20,	1,	0.1,	-0.01,	-0.01,
	0.1,	0.000001,	20,	1,	0.1,	-0.01,	-0.01,
	1,	0.000001,	20,	1,	0.1,	-0.01,	-0.01,
	10,	0.000001,	20,	1,	0.1,	-0.01,	-0.01,
	100,	0.000001,	20,	1,	0.1,	-0.01,	-0.01,
	0.0001,	0.01,	20,	1,	0.1,	-0.01,	-0.01,
	0.1,	0.01,	20,	1,	0.1,	-0.01,	-0.01,
	1,	0.01,	20,	1,	0.1,	-0.01,	-0.01,
	10,	0.01,	20,	1,	0.1,	-0.01,	-0.01,
	100,	0.01,	20,	1,	0.1,	-0.01,	-0.01,
	0.0001,	1,	20,	1,	0.1,	-0.01,	-0.01,
	0.1,	1,	20,	1,	0.1,	-0.01,	-0.01,
	1,	1,	20,	1,	0.1,	-0.01,	-0.01,
	10,	1,	20,	1,	0.1,	-0.01,	-0.01,
	100,	1,	20,	1,	0.1,	-0.01,	-0.01,
	0.0001,	-0.01,	20,	1,	0.1,	-0.01,	-0.01,
	0.1,	-0.01,	20,	1,	0.1,	-0.01,	-0.01,
	1,	-0.01,	20,	1,	0.1,	-0.01,	-0.01,
	10,	-0.01,	20,	1,	0.1,	-0.01,	-0.01,
	100,	-0.01,	20,	1,	0.1,	-0.01,	-0.01,
	0.0001,	-1,	20,	1,	0.1,	-0.01,	-0.01,
	0.1,	-1,	20,	1,	0.1,	-0.01,	-0.01,
	1,	-1,	20,	1,	0.1,	-0.01,	-0.01,
	10,	-1,	20,	1,	0.1,	-0.01,	-0.01,
	100,	-1,	20,	1,	0.1,	-0.01,	-0.01,
	0.0001,	0.000001,	20,	-0.01,	0.1,	-0.01,	-0.01,
	0.1,	0.000001,	20,	-0.01,	0.1,	-0.01,	-0.01,
	1,	0.000001,	20,	-0.01,	0.1,	-0.01,	-0.01,
	10,	0.000001,	20,	-0.01,	0.1,	-0.01,	-0.01,
	100,	0.000001,	20,	-0.01,	0.1,	-0.01,	-0.01,
	0.0001,	0.01,	20,	-0.01,	0.1,	-0.01,	-0.01,
	0.1,	0.01,	20,	-0.01,	0.1,	-0.01,	-0.01,
	1,	0.01,	20,	-0.01,	0.1,	-0.01,	-0.01,
	10,	0.01,	20,	-0.01,	0.1,	-0.01,	-0.01,
	100,	0.01,	20,	-0.01,	0.1,	-0.01,	-0.01,
	0.0001,	1,	20,	-0.01,	0.1,	-0.01,	-0.01,
	0.1,	1,	20,	-0.01,	0.1,	-0.01,	-0.01,
	1,	1,	20,	-0.01,	0.1,	-0.01,	-0.01,
	10,	1,	20,	-0.01,	0.1,	-0.01,	-0.01,
	100,	1,	20,	-0.01,	0.1,	-0.01,	-0.01,
	0.0001,	-0.01,	20,	-0.01,	0.1,	-0.01,	-0.01,
	0.1,	-0.01,	20,	-0.01,	0.1,	-0.01,	-0.01,
	1,	-0.01,	20,	-0.01,	0.1,	-0.01,	-0.01,
	10,	-0.01,	20,	-0.01,	0.1,	-0.01,	-0.01,
	100,	-0.01,	20,	-0.01,	0.1,	-0.01,	-0.01,
	0.0001,	-1,	20,	-0.01,	0.1,	-0.01,	-0.01,
	0.1,	-1,	20,	-0.01,	0.1,	-0.01,	-0.01,
	1,	-1,	20,	-0.01,	0.1,	-0.01,	-0.01,
	10,	-1,	20,	-0.01,	0.1,	-0.01,	-0.01,
	100,	-1,	20,	-0.01,	0.1,	-0.01,	-0.01,
	0.0001,	0.000001,	20,	-1,	0.1,	-0.01,	-0.01,
	0.1,	0.000001,	20,	-1,	0.1,	-0.01,	-0.01,
	1,	0.000001,	20,	-1,	0.1,	-0.01,	-0.01,
	10,	0.000001,	20,	-1,	0.1,	-0.01,	-0.01,
	100,	0.000001,	20,	-1,	0.1,	-0.01,	-0.01,
	0.0001,	0.01,	20,	-1,	0.1,	-0.01,	-0.01,
	0.1,	0.01,	20,	-1,	0.1,	-0.01,	-0.01,
	1,	0.01,	20,	-1,	0.1,	-0.01,	-0.01,
	10,	0.01,	20,	-1,	0.1,	-0.01,	-0.01,
	100,	0.01,	20,	-1,	0.1,	-0.01,	-0.01,
	0.0001,	1,	20,	-1,	0.1,	-0.01,	-0.01,
	0.1,	1,	20,	-1,	0.1,	-0.01,	-0.01,
	1,	1,	20,	-1,	0.1,	-0.01,	-0.01,
	10,	1,	20,	-1,	0.1,	-0.01,	-0.01,
	100,	1,	20,	-1,	0.1,	-0.01,	-0.01,
	0.0001,	-0.01,	20,	-1,	0.1,	-0.01,	-0.01,
	0.1,	-0.01,	20,	-1,	0.1,	-0.01,	-0.01,
	1,	-0.01,	20,	-1,	0.1,	-0.01,	-0.01,
	10,	-0.01,	20,	-1,	0.1,	-0.01,	-0.01,
	100,	-0.01,	20,	-1,	0.1,	-0.01,	-0.01,
	0.0001,	-1,	20,	-1,	0.1,	-0.01,	-0.01,
	0.1,	-1,	20,	-1,	0.1,	-0.01,	-0.01,
	1,	-1,	20,	-1,	0.1,	-0.01,	-0.01,
	10,	-1,	20,	-1,	0.1,	-0.01,	-0.01,
	100,	-1,	20,	-1,	0.1,	-0.01,	-0.01
         )
         p_starting <- matrix(p_matrix, length(p_matrix)/7, 7, byrow=TRUE)
         result_matrix <- matrix(NA, nrow(p_starting), 8)
         result_matrix[,1:7] <- p_starting
      }

 
      if(MODEL == "BM_linear_profile_par1"){
         A <- c(10, 5, 1, 0.75, 0.5, 0.4, 0.3, 0.2, 0.1, 0.05, 0.01, 0.001, 0.0001, 0.00001,-10, -5, -1, -0.75, -0.5, -0.4, -0.3, -0.2, -0.1, -0.05, -0.01, -0.001, -0.0001, -0.00001)
         NROW <- length(A)
         result_matrix <- matrix(NA, nrow = NROW, 2)
         count <- 1
         for(i in 1:length(A)){
            AA <- A[i]
            result_matrix[count,c(1)] <- c(AA)
            count = count + 1
         }
     }

      if(MODEL == "BM_linear_profile_par2"){ #when par 2 is held constant and par 1 is estimated
         A <- c(0.000001, 0.00001, 0.0001, 0.001, 0.01, 0.1,0.2, 0.3, 0.4, 0.5, 0.75, 1, 1.25, 1.5, 2,3,4,5,6,7,8,9,10,15,20,25,30, 40, 50, 75, 100, 200, 500, 1000)
         NROW <- length(A)
         result_matrix <- matrix(NA, nrow = NROW, 2)
         count <- 1
         for(i in 1:length(A)){
            AA <- A[i]
            result_matrix[count,c(1)] <- c(AA)
            count = count + 1
         }
     }



      if(MODEL == "OU_linear_beta_profile_par1"){
         A <- c(100, 1, 0.1, 0.01, 0.001, -0.01, -0.1, -1)
         B <- c(100, 25, 10, 1, 0.1, 0.01, 0.0001)
        NROW <- length(A) * length(B)
         result_matrix <- matrix(NA, nrow = NROW, 3)
         count <- 1
         for(i in 1:length(A)){
            AA <- A[i]
            for(p in 1:length(B)){
               BB <- B[p]
               result_matrix[count,c(1:2)] <- c(AA, BB)
               count = count + 1
            }
         }
     }

      if(MODEL == "OU_linear_beta_profile_par2"){
         A <- c(100, 25, 10, 1, 0.1, 0.01, 0.0001)
         B <- c(100, 25, 10, 1, 0.1, 0.01, 0.0001)
        NROW <- length(A) * length(B)
         result_matrix <- matrix(NA, nrow = NROW, 3)
         count <- 1
         for(i in 1:length(A)){
            AA <- A[i]
            for(p in 1:length(B)){
               BB <- B[p]
               result_matrix[count,c(1:2)] <- c(AA, BB)
               count = count + 1
            }
         }
     }

      if(MODEL == "OU_linear_beta_profile_par3"){
         A <- c(100, 25, 10, 1, 0.1, 0.01, 0.0001)
         B <- c(100, 1, 0.1, 0.01, 0.001, -0.01, -0.1, -1)
        NROW <- length(A) * length(B)
         result_matrix <- matrix(NA, nrow = NROW, 3)
         count <- 1
         for(i in 1:length(A)){
            AA <- A[i]
            for(p in 1:length(B)){
               BB <- B[p]
               result_matrix[count,c(1:2)] <- c(AA, BB)
               count = count + 1
            }
         }
     }




      if(MODEL == "OU_linear_profile_par2"){
         A <- c(100, 10, 1, 0.1, 0.01)
         B <- c(100, 10, 1, 0.1, 0.01)
         C <- c(100, 0.1, 0.01, 0.001, -0.01, -0.1)
        NROW <- length(A) * length(B) * length(C)
         result_matrix <- matrix(NA, nrow = NROW, 4)
         count <- 1
         for(i in 1:length(A)){
            AA <- A[i]
            for(p in 1:length(B)){
               BB <- B[p]
               for(z in 1:length(C)){
                  CC <- C[z]
                  result_matrix[count,c(1:3)] <- c(AA, BB, CC)
                  count = count + 1
               }
            }
         }
     }

      if(MODEL == "OU_linear_profile_par4"){
         A <- c(10, 1, 0.1, 0.01)
         B <- c(0.1, 0.01, 0.001, -0.01, -0.1)
         C <- c(10, 1, 0.1, 0.01)
        NROW <- length(A) * length(B) * length(C)
         result_matrix <- matrix(NA, nrow = NROW, 4)
         count <- 1
         for(i in 1:length(A)){
            AA <- A[i]
            for(p in 1:length(B)){
               BB <- B[p]
               for(z in 1:length(C)){
                  CC <- C[z]
                  result_matrix[count,c(1:3)] <- c(AA, BB, CC)
                  count = count + 1
               }
            }
         }
     }
   return(result_matrix)
 }



sisterContinuous_logSpace<- function(parameters, model,breakpoint="NULL", DIST, TIME, GRAD, GRAD2 = NULL, meserr1 = 0, meserr2 = 0, transformation_beta="NULL", transformation_alpha="NULL", transformation_beta1 = "NULL", transformation_beta2 = "NULL", transformation_interaction = "NULL", transformation_b = "NULL", transformation_a = "NULL", transformation_alpha1 = "NULL", transformation_alpha2 = "NULL")
 {
  if (model == "BM_null") {
     Cstart_B     <- exp(parameters[1])
     Slope_B      <- 0
     B <- Slope_B * GRAD + Cstart_B
     VAR1 <- B*TIME*2
     if(sum(c(meserr1,  meserr2)) == 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1)^0.5, log = TRUE)
     }
     if(sum(c(meserr1,  meserr2)) != 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1 + meserr1^2 + meserr2^2)^0.5, log = TRUE)
     }
	 negLogL = -sum(kk3)
     if(Cstart_B <= 0.000001) negLogL = 1e20 
     if(is.nan(negLogL)) negLogL = 1e20
  }
  
  if (model == "BM_2rate") {
     c1     <- exp(parameters[1])
     c2      <- exp(parameters[2])
     B <- (c1)*(GRAD <= breakpoint)    +    (c2) * (GRAD > breakpoint)
     VAR1 <- B*TIME*2
     if(sum(c(meserr1,  meserr2)) == 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1)^0.5, log = TRUE)
     }
     if(sum(c(meserr1,  meserr2)) != 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1 + meserr1^2 + meserr2^2)^0.5, log = TRUE)
     }
	 negLogL = -sum(kk3)
    if(is.nan(negLogL)) negLogL = 1e20
    if(min(B) <= 0.000001 | is.nan(min(B))) negLogL = 1e20
  }
  
  else if (model == "BM_linear") {
     Cstart_B     <- exp(parameters[1] )
     if(transformation_beta != "NULL"){
        Slope_B      <- exp(parameters[2]) - transformation_beta
     }
     if(transformation_beta == "NULL"){
        Slope_B      <- exp(parameters[2] )
     }
     B <- Slope_B * GRAD + Cstart_B
     VAR1 <- B*TIME*2
     if(sum(c(meserr1,  meserr2)) == 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1)^0.5, log = TRUE)
     }
     if(sum(c(meserr1,  meserr2)) != 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1 + meserr1^2 + meserr2^2)^0.5, log = TRUE)
     }
	 negLogL = -sum(kk3)
     if(Cstart_B <= 0.000001) negLogL = 1e20 
     if(is.nan(negLogL)) negLogL = 1e20
     if(min(B) <= (0.000001)) negLogL = 1e20
   }

#This allows Beta to vary as a linear function of two continuous variables
#Beta = Cstart_B + GRAD1*Slope1_B + GRAD2*Slope2_B
  else if (model == "BM_linear_2") {
     Cstart_B     <- exp(parameters[1] )
     if(transformation_beta1 != "NULL"){
        Slope1_B      <- exp(parameters[2]) - transformation_beta1
     }
     if(transformation_beta1 == "NULL"){
        Slope1_B      <- exp(parameters[2] )
     }
     if(transformation_beta2 != "NULL"){
        Slope2_B      <- exp(parameters[3]) - transformation_beta2
     }
     if(transformation_beta2 == "NULL"){
        Slope2_B      <- exp(parameters[3] )
     }
     #B <- Slope_B * GRAD + Cstart_B
     B <- Cstart_B + GRAD*Slope1_B + GRAD2*Slope2_B
     VAR1 <- B*TIME*2
     if(sum(c(meserr1,  meserr2)) == 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1)^0.5, log = TRUE)
     }
     if(sum(c(meserr1,  meserr2)) != 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1 + meserr1^2 + meserr2^2)^0.5, log = TRUE)
     }
	 negLogL = -sum(kk3)
     if(Cstart_B <= 0.000001) negLogL = 1e20 
     if(is.nan(negLogL)) negLogL = 1e20
     if(min(B) <= (0.000001)) negLogL = 1e20
   }


#This allows Beta to vary as a lienar function of two continuous variables
#Beta = Cstart_B + L1*Slope1_B + GRAD2*Slope2_B
  else if (model == "BM_linear_3") {
     Cstart_B     <- exp(parameters[1] )
     if(transformation_beta1 != "NULL"){
        Slope1_B      <- exp(parameters[2]) - transformation_beta1
     }
     if(transformation_beta1 == "NULL"){
        Slope1_B      <- exp(parameters[2] )
     }
     if(transformation_beta2 != "NULL"){
        Slope2_B      <- exp(parameters[3]) - transformation_beta2
     }
     if(transformation_beta2 == "NULL"){
        Slope2_B      <- exp(parameters[3] )
     }
     if(transformation_interaction != "NULL"){
        Interaction      <- exp(parameters[4]) - transformation_interaction
     }
     if(transformation_interaction == "NULL"){
        Interaction      <- exp(parameters[4] )
     }
     B <- Cstart_B + GRAD*Slope1_B + GRAD2*Slope2_B + GRAD*GRAD2*Interaction
     VAR1 <- B*TIME*2
     if(sum(c(meserr1,  meserr2)) == 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1)^0.5, log = TRUE)
     }
     if(sum(c(meserr1,  meserr2)) != 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1 + meserr1^2 + meserr2^2)^0.5, log = TRUE)
     }
	 negLogL = -sum(kk3)
     if(Cstart_B <= 0.000001) negLogL = 1e20 
     if(is.nan(negLogL)) negLogL = 1e20
     if(min(B) <= (0.000001)) negLogL = 1e20
   }

  else if (model == "BM_linear_breakpoint") {
     #This backtransforms variables
     c1  <- exp(parameters[1] )     #Cstart_B intercept
     breakpoint <- exp(parameters[3] ) #breakpoint latitude
     if(transformation_beta1 != "NULL"){
        b1      <- exp(parameters[2]) - transformation_beta1
     }
     if(transformation_beta1 == "NULL"){
        b1      <- exp(parameters[2] )
     }
     if(transformation_beta2 != "NULL"){
        b2      <- exp(parameters[4]) - transformation_beta2
     }
     if(transformation_beta2 == "NULL"){
        b2      <- exp(parameters[4] )
     }
     c2 = breakpoint * b1 + c1 - breakpoint * b2
     B <- (b1 * GRAD + c1)*(GRAD <= breakpoint)    +    (b2 * GRAD + c2) * (GRAD > breakpoint)
     VAR1 <- B*TIME*2
     if(sum(c(meserr1,  meserr2)) == 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1)^0.5, log = TRUE)
     }
     if(sum(c(meserr1,  meserr2)) != 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1 + meserr1^2 + meserr2^2)^0.5, log = TRUE)
     }
	 negLogL = -sum(kk3)
     if(c1 < 0) negLogL = 1e20 
     if(is.nan(negLogL)) negLogL = 1e20
     if(min(B) <= (0.000001)) negLogL = 1e20
   }


  else if (model == "BM_quadratic") {
     #This now works well
     #where y = c + bX + aX^2 a > 0 parabola curves upward, a < 0 downward. a != 0
     #This backtransforms variables
     c      <- exp(parameters[1] )     #Cstart_B intercept
     if(transformation_b != "NULL"){
         b      <- exp(parameters[2])  - transformation_b     
     }
     if(transformation_b == "NULL"){
         b      <- exp(parameters[2] )     #coefficient
     }
     if(transformation_a != "NULL"){
         a      <- exp(parameters[3])  - transformation_a     
     }
     if(transformation_a == "NULL"){
         a      <- exp(parameters[3] )     #coefficient
     }
     B <- c + b*GRAD + a*GRAD^2
     VAR1 <- B*TIME*2
     if(sum(c(meserr1,  meserr2)) == 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1)^0.5, log = TRUE)
     }
     if(sum(c(meserr1,  meserr2)) != 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1 + meserr1^2 + meserr2^2)^0.5, log = TRUE)
     }
	 negLogL = -sum(kk3)
     if(c < 0) negLogL = 1e20 
     if(is.nan(negLogL)) negLogL = 1e20
     if(min(B) <= (0.000001)) negLogL = 1e20
   }

  else if (model == "OU_null") {  
    Cstart_B     <- exp(parameters[1] )
    Slope_B      <- 0
    Cstart_A     <- exp(parameters[2] )
    Slope_A      <- 0
    Alpha <- Slope_A * GRAD + Cstart_A
    B     <- Slope_B * GRAD + Cstart_B
     VAR1 <- (B / (Alpha)) * (1-exp(-2*Alpha*TIME))
     if(sum(c(meserr1,  meserr2)) == 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1)^0.5, log = TRUE)
     }
     if(sum(c(meserr1,  meserr2)) != 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1 + meserr1^2 + meserr2^2)^0.5, log = TRUE)
     }
	 negLogL = -sum(kk3)
     if(is.nan(negLogL)) negLogL = 1e20
     if(Cstart_A <= 0.000001) negLogL = 1e20
     if(Cstart_B <= 0.000001) negLogL = 1e20
   }
   
 else if (model == "OU_linear_beta") {  
   #Only Beta changes linearly with latitude
    Cstart_B     <- exp(parameters[1]) 
    Cstart_A     <- exp(parameters[3]) 
    if(transformation_beta != "NULL"){
        Slope_B      <- exp(parameters[2]) - transformation_beta
    }
    if(transformation_beta == "NULL"){
        Slope_B      <- exp(parameters[2] )
    }
    Slope_A      <- 0
     Alpha <- Slope_A * GRAD + Cstart_A
     B     <- Slope_B * GRAD + Cstart_B
     VAR1 <- (B / (Alpha)) * (1-exp(-2*Alpha*TIME))
	 if(sum(c(meserr1,  meserr2)) == 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1)^0.5, log = TRUE)
     }
     if(sum(c(meserr1,  meserr2)) != 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1 + meserr1^2 + meserr2^2)^0.5, log = TRUE)
     }
	 negLogL = -sum(kk3)
     if(is.nan(negLogL)) negLogL = 1e20
     if(Cstart_A <= (0.000001)) negLogL = 1e20
     if(Cstart_B <= (0.000001)) negLogL = 1e20
     if(min(Alpha) <= (0.000001)) negLogL = 1e20
     if(min(B) <= (0.000001)) negLogL = 1e20
   }


 else if (model == "OU_linear_beta_2") {  
   #Only Beta changes linearly with latitude
    Cstart_B     <- exp(parameters[1]) 
    Cstart_A     <- exp(parameters[4]) 
     if(transformation_beta1 != "NULL"){
        Slope1_B      <- exp(parameters[2]) - transformation_beta1
     }
     if(transformation_beta1 == "NULL"){
        Slope1_B      <- exp(parameters[2] )
     }
     if(transformation_beta2 != "NULL"){
        Slope2_B      <- exp(parameters[3]) - transformation_beta2
     }
     if(transformation_beta2 == "NULL"){
        Slope2_B      <- exp(parameters[3] )
     }
     Slope_A      <- 0
     Alpha <- Slope_A * GRAD + Cstart_A
     B <- Cstart_B + GRAD*Slope1_B + GRAD2*Slope2_B
     VAR1 <- (B / (Alpha)) * (1-exp(-2*Alpha*TIME))
     if(sum(c(meserr1,  meserr2)) == 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1)^0.5, log = TRUE)
     }
     if(sum(c(meserr1,  meserr2)) != 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1 + meserr1^2 + meserr2^2)^0.5, log = TRUE)
     }
	 negLogL = -sum(kk3)
     if(is.nan(negLogL)) negLogL = 1e20
     if(Cstart_A <= (0.000001)) negLogL = 1e20
     if(Cstart_B <= (0.000001)) negLogL = 1e20
     if(min(Alpha) <= (0.000001)) negLogL = 1e20
     if(min(B) <= (0.000001)) negLogL = 1e20
   }



 else if (model == "OU_linear_beta_3") {  
   #Only Beta changes linearly with latitude
    Cstart_B     <- exp(parameters[1]) 
    Cstart_A     <- exp(parameters[5]) 
     if(transformation_beta1 != "NULL"){
        Slope1_B      <- exp(parameters[2]) - transformation_beta1
     }
     if(transformation_beta1 == "NULL"){
        Slope1_B      <- exp(parameters[2] )
     }
     if(transformation_beta2 != "NULL"){
        Slope2_B      <- exp(parameters[3]) - transformation_beta2
     }
     if(transformation_beta2 == "NULL"){
        Slope2_B      <- exp(parameters[3] )
     }
     if(transformation_interaction != "NULL"){
        Interaction      <- exp(parameters[4]) - transformation_interaction
     }
     if(transformation_interaction == "NULL"){
        Interaction      <- exp(parameters[4] )
     }
     Slope_A      <- 0
     Alpha <- Slope_A * GRAD + Cstart_A
     B <- Cstart_B + GRAD*Slope1_B + GRAD2*Slope2_B + GRAD*GRAD2*Interaction
     VAR1 <- (B / (Alpha)) * (1-exp(-2*Alpha*TIME))
     if(sum(c(meserr1,  meserr2)) == 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1)^0.5, log = TRUE)
     }
     if(sum(c(meserr1,  meserr2)) != 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1 + meserr1^2 + meserr2^2)^0.5, log = TRUE)
     }
	 negLogL = -sum(kk3)
     if(is.nan(negLogL)) negLogL = 1e20
     if(Cstart_A <= (0.000001)) negLogL = 1e20
     if(Cstart_B <= (0.000001)) negLogL = 1e20
     if(min(Alpha) <= (0.000001)) negLogL = 1e20
     if(min(B) <= (0.000001)) negLogL = 1e20
   }

  else if (model == "OU_linear") {  
    Cstart_B     <- exp(parameters[1]) 
    Cstart_A     <- exp(parameters[3]) 
    if(transformation_beta != "NULL"){
        Slope_B      <- exp(parameters[2]) - transformation_beta
    }
    if(transformation_beta == "NULL"){
        Slope_B      <- exp(parameters[2] )
    }

    if(transformation_alpha != "NULL"){
        Slope_A      <- exp(parameters[4]) - transformation_alpha
    }
    if(transformation_alpha == "NULL"){
        Slope_A      <- exp(parameters[4] )
    }
     Alpha <- Slope_A * GRAD + Cstart_A
     B     <- Slope_B * GRAD + Cstart_B
     VAR1 <- (B / (Alpha)) * (1-exp(-2*Alpha*TIME))
     if(sum(c(meserr1,  meserr2)) == 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1)^0.5, log = TRUE)
     }
     if(sum(c(meserr1,  meserr2)) != 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1 + meserr1^2 + meserr2^2)^0.5, log = TRUE)
     }
	 negLogL = -sum(kk3)
     if(is.nan(negLogL)) negLogL = 1e20
     if(Cstart_A <= (0.000001)) negLogL = 1e20
     if(Cstart_B <= (0.000001)) negLogL = 1e20
     if(min(Alpha) <= (0.000001)) negLogL = 1e20
     if(min(B) <= (0.000001)) negLogL = 1e20
   }


  else if (model == "OU_linear_breakpoint") {
     c1  <- exp(parameters[1] )     #Cstart_B intercept
     breakpoint <- exp(parameters[3] ) #breakpoint latitude
     if(transformation_beta1 != "NULL"){
        b1      <- exp(parameters[2]) - transformation_beta1
     }
     if(transformation_beta1 == "NULL"){
        b1      <- exp(parameters[2] )
     }
     if(transformation_beta2 != "NULL"){
        b2      <- exp(parameters[4]) - transformation_beta2
     }
     if(transformation_beta2 == "NULL"){
        b2      <- exp(parameters[4] )
     }
     c1_alpha  <- exp(parameters[5] )     #Cstart_B intercept
     if(transformation_alpha1 != "NULL"){
        b1_alpha      <- exp(parameters[6]) - transformation_alpha1
     }
     if(transformation_alpha1 == "NULL"){
        b1_alpha      <- exp(parameters[6] )
     }
     if(transformation_alpha2 != "NULL"){
        b2_alpha      <- exp(parameters[7]) - transformation_alpha2
     }
     if(transformation_alpha2 == "NULL"){
        b2_alpha      <- exp(parameters[7] )
     }

     c2 = breakpoint * b1 + c1 - breakpoint * b2
     c2_alpha = breakpoint * b1_alpha + c1_alpha - breakpoint * b2_alpha

     B <- (b1 * GRAD + c1)*(GRAD <= breakpoint)    +    (b2 * GRAD + c2) * (GRAD > breakpoint)                         #Beta  for actual data
     Alpha <- (b1_alpha * GRAD + c1_alpha)*(GRAD <= breakpoint)    +    (b2_alpha * GRAD + c2_alpha) * (GRAD > breakpoint) #Alpha for actual data
     VAR1 <- (B / (Alpha)) * (1-exp(-2*Alpha*TIME))
     if(sum(c(meserr1,  meserr2)) == 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1)^0.5, log = TRUE)
     }
     if(sum(c(meserr1,  meserr2)) != 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1 + meserr1^2 + meserr2^2)^0.5, log = TRUE)
     }
	 negLogL = -sum(kk3)
     if(c1 < 0) negLogL = 1e20 
     if(c1_alpha < 0) negLogL = 1e20 
     if(is.nan(negLogL)) negLogL = 1e20
     if(min(Alpha) <= (0.000001)) negLogL = 1e20
     if(min(B) <= (0.000001)) negLogL = 1e20
   }

  if (model == "OU_2rate") {
     c1     <- exp(parameters[1])
     c2      <- exp(parameters[2])
     c3     <- exp(parameters[3])
     c4      <- exp(parameters[4])
     B <- (c1)*(GRAD <= breakpoint)    +    (c2) * (GRAD > breakpoint)
     Alpha <- (c3)*(GRAD <= breakpoint)    +    (c4) * (GRAD > breakpoint)
     VAR1 <- (B / (Alpha)) * (1-exp(-2*Alpha*TIME))
     if(sum(c(meserr1,  meserr2)) == 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1)^0.5, log = TRUE)
     }
     if(sum(c(meserr1,  meserr2)) != 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1 + meserr1^2 + meserr2^2)^0.5, log = TRUE)
     }
	 negLogL = -sum(kk3)
    if(is.nan(negLogL)) negLogL = 1e20
    if(min(B) <= 0.000001 | is.nan(min(B))) negLogL = 1e20
    if(min(Alpha) <= 0.000001 | is.nan(min(Alpha))) negLogL = 1e20
  }
  
   return(negLogL)
 }




sisterContinuous <- function(parameters, meserr1 = 0, meserr2 = 0, model = c("BM_null", "BM_2rate","BM_linear", "BM_linear_breakpoint",
   "BM_quadratic", "OU_null", "OU_2rate", "OU_linear", "OU_linear_beta", "OU_linear_breakpoint"), breakpoint="NULL", DIST, TIME, GRAD, GRAD2 = NULL)
 {
   #Parameters = a list of starting values for parameter estimates
   #model = "OU" or "BM"
   #range =  a list of the start and endpoints of the gradient over which to calculate rates. These must span the range of values in the dataset.
   #DIST = list of euclidean distance
   #TIM = list of ages of independent contrasts / sister pairs
   #GRAD = list of gradient values
   
   #Code updated 12 Feb 2013 to exclude B and alpha values less than 0 (i.e. "if(min(Alpha) <= 0) negLogL = 1e20")
   #A second update to code by transforming parameters so that search in nlm is done in log parameter space, with parameter estimates back transformed after the nlm search
   #The transofrmation method results in much faster likelihood searches and allows us to find the true MLE much more readily than when not transformed for the OU model

  if (model == "BM_null") {
     Cstart_B     <- parameters[1]
     Slope_B      <- 0
     B <- Slope_B * GRAD + Cstart_B
     VAR1 <- B*TIME*2
     if(sum(c(meserr1,  meserr2)) == 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1)^0.5, log = TRUE)
     }
     if(sum(c(meserr1,  meserr2)) != 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1 + meserr1^2 + meserr2^2)^0.5, log = TRUE)
     }
	 negLogL = -sum(kk3)
     if(Cstart_B <= 0.000001) negLogL = 1e20 
    if(is.nan(negLogL)) negLogL = 1e20
  }

  if (model == "BM_2rate") {
     c1     <- (parameters[1])
     c2      <- (parameters[2])
     B <- (c1)*(GRAD <= breakpoint)    +    (c2) * (GRAD > breakpoint)
      VAR1 <- B*TIME*2
     if(sum(c(meserr1,  meserr2)) == 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1)^0.5, log = TRUE)
     }
     if(sum(c(meserr1,  meserr2)) != 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1 + meserr1^2 + meserr2^2)^0.5, log = TRUE)
     }
	 negLogL = -sum(kk3)
    if(is.nan(negLogL)) negLogL = 1e20
    if(min(B) <= 0.000001 | is.nan(min(B))) negLogL = 1e20
  }
  
  else if (model == "BM_linear") {
     Cstart_B     <- parameters[1] 
     Slope_B      <- parameters[2]
     B <- Slope_B * GRAD + Cstart_B
     VAR1 <- B*TIME*2
     if(sum(c(meserr1,  meserr2)) == 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1)^0.5, log = TRUE)
     }
     if(sum(c(meserr1,  meserr2)) != 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1 + meserr1^2 + meserr2^2)^0.5, log = TRUE)
     }
	 negLogL = -sum(kk3)
     if(Cstart_B <= 0) negLogL = 1e20 
     if(is.nan(negLogL)) negLogL = 1e20
     if(min(B) <= 0.000001) negLogL = 1e20
   }

  else if (model == "BM_linear_2") {
     Cstart_B     <- parameters[1] 
     Slope1_B      <- parameters[2]
     Slope2_B      <- parameters[3]
     B <- Cstart_B + GRAD*Slope1_B + GRAD2*Slope2_B
     VAR1 <- B*TIME*2
     if(sum(c(meserr1,  meserr2)) == 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1)^0.5, log = TRUE)
     }
     if(sum(c(meserr1,  meserr2)) != 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1 + meserr1^2 + meserr2^2)^0.5, log = TRUE)
     }
	 negLogL = -sum(kk3)
     if(Cstart_B <= 0) negLogL = 1e20 
     if(is.nan(negLogL)) negLogL = 1e20
     if(min(B) <= 0.000001) negLogL = 1e20
   }
  else if (model == "BM_linear_3") {
     Cstart_B      <- parameters[1] 
     Slope1_B      <- parameters[2]
     Slope2_B      <- parameters[3]
     Interaction   <- parameters[4]
     B <- Cstart_B + GRAD*Slope1_B + GRAD2*Slope2_B + GRAD*GRAD2*Interaction
     VAR1 <- B*TIME*2
     if(sum(c(meserr1,  meserr2)) == 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1)^0.5, log = TRUE)
     }
     if(sum(c(meserr1,  meserr2)) != 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1 + meserr1^2 + meserr2^2)^0.5, log = TRUE)
     }
	 negLogL = -sum(kk3)
     if(Cstart_B <= 0) negLogL = 1e20 
     if(is.nan(negLogL)) negLogL = 1e20
     if(min(B) <= 0.000001) negLogL = 1e20
   }

  else if (model == "BM_linear_breakpoint") {
     #where y = c + bX + aX^2 a > 0 parabola curves upward, a < 0 downward. a != 0
     #This backtransforms variables
     c1  <- parameters[1]     #Cstart_B intercept
     breakpoint <- parameters[3] #breakpoint latitude
     b1      <- parameters[2]
     b2      <- parameters[4]
     c2 = breakpoint * b1 + c1 - breakpoint * b2
     VAR1 <- B*TIME*2
     if(sum(c(meserr1,  meserr2)) == 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1)^0.5, log = TRUE)
     }
     if(sum(c(meserr1,  meserr2)) != 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1 + meserr1^2 + meserr2^2)^0.5, log = TRUE)
     }
	 negLogL = -sum(kk3)
     if(c1 < 0) negLogL = 1e20 
     if(is.nan(negLogL)) negLogL = 1e20
     if(min(B) <= 0.000001) negLogL = 1e20
   }


  else if (model == "BM_quadratic") {
     #This now works well
     #where y = c + bX + aX^2 a > 0 parabola curves upward, a < 0 downward. a != 0
     #This backtransforms variables
     c      <- parameters[1] 
     b      <- parameters[2]
     a      <- parameters[3] 
     B <- c + b*GRAD + a*GRAD^2
     VAR1 <- B*TIME*2
     if(sum(c(meserr1,  meserr2)) == 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1)^0.5, log = TRUE)
     }
     if(sum(c(meserr1,  meserr2)) != 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1 + meserr1^2 + meserr2^2)^0.5, log = TRUE)
     }
	 negLogL = -sum(kk3)
     #if(a == 0) negLogL = 1e20 
     if(c < 0) negLogL = 1e20 
     if(is.nan(negLogL)) negLogL = 1e20
     if(min(B) <= 0.000001) negLogL = 1e20
   }

  else if (model == "OU_null") {  
    Cstart_B     <- parameters[1]
    Slope_B      <- 0
    Cstart_A     <- parameters[2]
    Slope_A      <- 0
    Alpha <- Slope_A * GRAD + Cstart_A
    B     <- Slope_B * GRAD + Cstart_B
     VAR1 <- (B / (Alpha)) * (1-exp(-2*Alpha*TIME))
     if(sum(c(meserr1,  meserr2)) == 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1)^0.5, log = TRUE)
     }
     if(sum(c(meserr1,  meserr2)) != 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1 + meserr1^2 + meserr2^2)^0.5, log = TRUE)
     }
	 negLogL = -sum(kk3)
     if(is.nan(negLogL)) negLogL = 1e20
     if(Cstart_A <= 0.000001) negLogL = 1e20
     if(Cstart_B <= 0.000001) negLogL = 1e20
   }
   
  else if (model == "OU_linear") {  
    Cstart_B     <- parameters[1]
    Cstart_A     <- parameters[3]
    Slope_B      <- parameters[2]
    Slope_A      <- parameters[4]
     Alpha <- Slope_A * GRAD + Cstart_A
     B     <- Slope_B * GRAD + Cstart_B
     VAR1 <- (B / (Alpha)) * (1-exp(-2*Alpha*TIME))
     if(sum(c(meserr1,  meserr2)) == 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1)^0.5, log = TRUE)
     }
     if(sum(c(meserr1,  meserr2)) != 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1 + meserr1^2 + meserr2^2)^0.5, log = TRUE)
     }
	 negLogL = -sum(kk3)
     if(is.nan(negLogL)) negLogL = 1e20
     if(Cstart_A <= (0.000001)) negLogL = 1e20
     if(Cstart_B <= (0.000001)) negLogL = 1e20
     if(min(Alpha) <= (0.000001)) negLogL = 1e20
     if(min(B) <= (0.000001)) negLogL = 1e20
   }

 else if (model == "OU_linear_beta") {  
   #Only Beta changes linearly with latitude
    Cstart_B     <- parameters[1]
    Cstart_A     <- parameters[3] 
    Slope_B      <- parameters[2]
    Slope_A      <- 0
     Alpha <- Slope_A * GRAD + Cstart_A
     B     <- Slope_B * GRAD + Cstart_B
     VAR1 <- (B / (Alpha)) * (1-exp(-2*Alpha*TIME))
     if(sum(c(meserr1,  meserr2)) == 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1)^0.5, log = TRUE)
     }
     if(sum(c(meserr1,  meserr2)) != 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1 + meserr1^2 + meserr2^2)^0.5, log = TRUE)
     }
	 negLogL = -sum(kk3)
     if(is.nan(negLogL)) negLogL = 1e20
     if(Cstart_A <= (0.000001)) negLogL = 1e20
     if(Cstart_B <= (0.000001)) negLogL = 1e20
     if(min(Alpha) <= (0.000001)) negLogL = 1e20
     if(min(B) <= (0.000001)) negLogL = 1e20
   }


 else if (model == "OU_linear_beta_2") {  
   #Only Beta changes linearly with latitude
    Cstart_B      <- parameters[1] 
    Slope1_B      <- parameters[2]
    Slope2_B      <- parameters[3]
    Cstart_A      <- parameters[4]
    Slope_A      <- 0
     Alpha <- Slope_A * GRAD + Cstart_A
     B <- Cstart_B + GRAD*Slope1_B + GRAD2*Slope2_B
     VAR1 <- (B / (Alpha)) * (1-exp(-2*Alpha*TIME))
     if(sum(c(meserr1,  meserr2)) == 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1)^0.5, log = TRUE)
     }
     if(sum(c(meserr1,  meserr2)) != 0){
	        kk3 <- dnorm(x=DIST, mean = 0, sd = (VAR1 + meserr1^2 + meserr2^2)^0.5, log = TRUE)
     }
	 negLogL = -sum(kk3)
     if(is.nan(negLogL)) negLogL = 1e20
     if(Cstart_A <= (0.000001)) negLogL = 1e20
     if(Cstart_B <= (0.000001)) negLogL = 1e20
     if(min(Alpha) <= (0.000001)) negLogL = 1e20
     if(min(B) <= (0.000001)) negLogL = 1e20
   }

 else if (model == "OU_linear_beta_3") {  
   #Only Beta changes linearly with latitude
    Cstart_B      <- parameters[1] 
    Slope1_B      <- parameters[2]
    Slope2_B      <- parameters[3]
    Interaction   <- parameters[4]
    Cstart_A      <- parameters[5]
    Slope_A      <- 0
     Alpha <- Slope_A * GRAD + Cstart_A
     B <- Cstart_B + GRAD*Slope1_B + GRAD2*Slope2_B + GRAD*GRAD2*