Skip to content
Snippets Groups Projects
Commit b8414e95 authored by Clare's avatar Clare
Browse files

Edit to final test

parent 01685bbc
No related branches found
No related tags found
No related merge requests found
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment