From b8414e953d5160d4008baf66c8ed37629e4fc810 Mon Sep 17 00:00:00 2001
From: Clare <chorscroft@users.noreply.github.com>
Date: Sun, 12 Jul 2020 03:29:16 +0100
Subject: [PATCH] Edit to final test

---
 tests/testthat/test-create_LDprofile.R | 48 +++++++++++++++-----------
 1 file changed, 27 insertions(+), 21 deletions(-)

diff --git a/tests/testthat/test-create_LDprofile.R b/tests/testthat/test-create_LDprofile.R
index 051ae0d..27a5878 100644
--- a/tests/testthat/test-create_LDprofile.R
+++ b/tests/testthat/test-create_LDprofile.R
@@ -243,31 +243,37 @@ test_that("create_LDprofile calculates the LD profile correctly with missing val
 #Tested manually
 
 ## Test the function when beta estimation doesn't work the first try
-x1<-matrix(c(1,1,1,2,1,2,1,1,1,2,1,2,2,2,2,
-             1,1,1,2,1,2,2,2,2,1,1,2,1,1,2,
-             1,2,1,2,1,1,1,2,1,1,2,1,2,2,2,
-             1,2,1,2,1,1,2,1,2,2,1,2,2,1,2,
-             1,2,1,2,1,2,1,2,1,2,1,1,2,1,2,
-             1,2,2,1,1,2,1,2,2,1,2,1,1,1,2,
-             1,1,2,2,1,1,2,1,2,2,2,1,1,1,2,
-             1,1,2,1,1,1,2,2,1,2,2,1,1,1,2,
-             1,1,1,1,1,2,2,2,2,1,2,1,2,2,2,
-             1,2,2,2,2,1,2,1,2,1,2,2,2,1,2,
-             1,2,1,1,1,1,2,1,1,1,2,1,1,2,2,
-             1,1,1,2,2,1,2,1,2,1,1,2,2,1,2,
-             1,1,1,1,1,1,1,2,2,2,1,2,2,1,2,
-             1,2,2,1,2,1,1,1,2,1,2,1,2,1,2,
-             1,1,2,1,1,1,2,2,2,1,1,1,2,1,2),byrow=TRUE,nrow=15)
+x1<-matrix(c(1,1,2,1,2,1,1,2,1,2,2,1,2,1,2,
+             1,1,1,1,1,2,2,2,2,1,1,1,2,2,2,
+             1,1,1,1,1,1,2,1,2,2,2,1,1,2,2,
+             1,2,2,1,1,2,1,1,2,1,1,2,1,2,2,
+             1,2,2,1,2,1,1,2,2,1,2,2,1,2,2,
+             1,2,2,2,2,1,2,1,1,1,1,1,1,1,2,
+             1,2,2,1,1,1,1,2,2,2,2,2,1,1,2,
+             1,2,1,2,1,1,1,2,1,1,1,2,2,2,2,
+             1,2,2,2,1,1,2,1,1,1,2,2,2,1,2,
+             1,1,2,1,2,1,1,1,1,1,2,1,2,1,2,
+             1,1,1,2,1,2,2,1,2,1,1,1,2,1,2,
+             1,2,2,2,2,2,1,2,1,2,1,1,1,1,2,
+             1,2,1,2,1,1,1,1,2,2,2,1,2,1,2,
+             1,2,1,2,2,1,2,1,2,1,2,1,2,1,2,
+             1,2,2,2,2,1,2,2,1,1,2,2,2,2,2,
+             1,1,2,2,2,1,2,2,1,1,1,1,1,2,2,
+             1,2,1,2,2,2,1,2,2,1,1,1,1,2,2,
+             1,2,1,2,1,2,2,2,1,2,1,2,2,1,2,
+             1,1,1,2,1,2,2,2,1,2,2,2,1,2,2,
+             1,1,1,2,2,2,1,1,1,2,1,2,2,1,2),byrow=TRUE,nrow=20)
 test_that("create_LDprofile calculates the LD profile correctly when beta calculation fails on first attempt", {
-  expect_equal(create_LDprofile(dist = rep(0,15), x = x1, bin_size = 0.001, max_dist = 0.001, beta_params = TRUE),
+  expect_equal(create_LDprofile(dist = rep(0,20), x = x1, bin_size = 0.001, beta_params = TRUE),
                data.frame(
                  bin=c(0),
-                 rsq=c(0.0754751721676325),
-                 sd=c(0.0928525038706074),
-                 Beta_a=c(0.795140679587351),
-                 Beta_b=c(9.0658860153924),
-                 n=c(105)
+                 rsq=c(0.0665701124504383),
+                 sd=c(0.0932577303343809),
+                 Beta_a=c(0.641838135131359),
+                 Beta_b=c(8.47114586606102),
+                 n=c(190)
                ),tolerance=0.0001)
 })
 
 ## Test the function when beta estimation doesn't work on the second try
+## Tested manually
-- 
GitLab