chr1swallace / coloc

Repo for the R package coloc
144 stars 44 forks source link

coloc.susie: warning about providing sample size #103

Closed nshrine closed 1 year ago

nshrine commented 1 year ago

When I run coloc.susie I always get the following warning:

WARNING: Providing the sample size (n), or even a rough estimate of n, is highly recommended. Without n, the implicit assumption is n is large (Inf) and the effect sizes are small (close to zero).

But I do provide the sample size in the list element N in the two input data sets.

chr1swallace commented 1 year ago

well that shouldn't happen, and doesn't happen for me. so can you show me the str() of the two input datasets?


From: Nick Shrine @.> Sent: 04 November 2022 08:23 To: chr1swallace/coloc @.> Cc: Subscribed @.***> Subject: [chr1swallace/coloc] coloc.susie: warning about providing sample size (Issue #103)

When I run coloc.susie I always get the following warning:

WARNING: Providing the sample size (n), or even a rough estimate of n, is highly recommended. Without n, the implicit assumption is n is large (Inf) and the effect sizes are small (close to zero).

But I do provide the sample size in the list element N in the two input data sets.

— Reply to this email directly, view it on GitHubhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fchr1swallace%2Fcoloc%2Fissues%2F103&data=05%7C01%7Ccew54%40universityofcambridgecloud.onmicrosoft.com%7Caa210269631f49b7feb808dabe3ddc4b%7C49a50445bdfa4b79ade3547b4f3986e9%7C0%7C0%7C638031470142396428%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=2AeRPn1crhnx8Wm0Fh5Sg0LzgyYYgpqZX2J47NyWZPI%3D&reserved=0, or unsubscribehttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAQWR2BPS6BCBBSCIBIIGODWGTBWJANCNFSM6AAAAAARW52PSA&data=05%7C01%7Ccew54%40universityofcambridgecloud.onmicrosoft.com%7Caa210269631f49b7feb808dabe3ddc4b%7C49a50445bdfa4b79ade3547b4f3986e9%7C0%7C0%7C638031470142552670%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=NPLvyaaZbOtJUAEFCZvDafkA671b4AGvmqk%2B4feSVcU%3D&reserved=0. You are receiving this because you are subscribed to this thread.Message ID: @.***>

nshrine commented 1 year ago

str(d1) List of 12 $ snp : chr [1:4299] "12_66122232_A_G" "12_66901409_C_T" "12_65443031_A_G" "12_65985584_C_G" ... $ CHROM : num [1:4299] 12 12 12 12 12 12 12 12 12 12 ... $ POS : num [1:4299] 66122232 66901409 65443031 65985584 65898330 ... $ A1 : chr [1:4299] "A" "T" "A" "C" ... $ A2 : chr [1:4299] "G" "C" "G" "G" ... $ MAF : Named num [1:4299] 0.0671 0.4532 0.0015 0.0378 0.3925 ... ..- attr(, "names")= chr [1:4299] "12_66122232_A_G" "12_66901409_C_T" "12_65443031_A_G" "12_65985584_C_G" ... $ beta : Named num [1:4299] 0 -0.0005 -0.1475 -0.0142 0.0002 ... ..- attr(, "names")= chr [1:4299] "12_66122232_A_G" "12_66901409_C_T" "12_65443031_A_G" "12_65985584_C_G" ... $ varbeta: Named num [1:4299] 3.72e-05 9.00e-06 2.59e-03 6.40e-05 9.61e-06 ... ..- attr(, "names")= chr [1:4299] "12_66122232_A_G" "12_66901409_C_T" "12_65443031_A_G" "12_65985584_C_G" ... $ pvalues: num [1:4299] 0.9953 0.8566 0.00374 0.07668 0.9551 ... $ LD : num [1:4299, 1:4299] 1 1 -0.0169 0.1321 -0.0347 ... ..- attr(, "dimnames")=List of 2 .. ..$ : chr [1:4299] "12_65218142_C_G" "12_65218404_C_G" "12_65219960_A_G" "12_65220367_A_G" ... .. ..$ : chr [1:4299] "12_65218142_C_G" "12_65218404_C_G" "12_65219960_A_G" "12_65220367_A_G" ... $ N : num 247107 $ type : chr "quant"

str(d2) List of 12 $ snp : chr [1:4299] "12_65218142_C_G" "12_65218404_C_G" "12_65219960_A_G" "12_65220367_A_G" ... $ CHROM : int [1:4299] 12 12 12 12 12 12 12 12 12 12 ... $ POS : int [1:4299] 65218142 65218404 65219960 65220367 65220856 65222347 65222654 65224174 65225529 65225605 ... $ A1 : chr [1:4299] "G" "G" "G" "G" ... $ A2 : chr [1:4299] "C" "C" "A" "A" ... $ MAF : Named num [1:4299] 0.0131 0.0122 0.0296 0.3946 0.0314 ... ..- attr(, "names")= chr [1:4299] "12_65218142_C_G" "12_65218404_C_G" "12_65219960_A_G" "12_65220367_A_G" ... $ beta : Named num [1:4299] 0.5062 0.5603 -0.071 0.0732 -0.0328 ... ..- attr(, "names")= chr [1:4299] "12_65218142_C_G" "12_65218404_C_G" "12_65219960_A_G" "12_65220367_A_G" ... $ varbeta: Named num [1:4299] 0.04608 0.04948 0.02209 0.00251 0.01965 ... ..- attr(, "names")= chr [1:4299] "12_65218142_C_G" "12_65218404_C_G" "12_65219960_A_G" "12_65220367_A_G" ... $ pvalues: num [1:4299] 0.0187 0.0121 0.6331 0.1448 0.8153 ... $ LD : num [1:4299, 1:4299] 1 1 -0.0169 0.1321 -0.0347 ... ..- attr(, "dimnames")=List of 2 .. ..$ : chr [1:4299] "12_65218142_C_G" "12_65218404_C_G" "12_65219960_A_G" "12_65220367_A_G" ... .. ..$ : chr [1:4299] "12_65218142_C_G" "12_65218404_C_G" "12_65219960_A_G" "12_65220367_A_G" ... $ N : num 574 $ type : chr "quant"

sessionInfo() R version 4.2.1 (2022-06-23) Platform: x86_64-pc-linux-gnu (64-bit) Running under: CentOS Linux 7 (Core)

Matrix products: default BLAS: /cm/shared/apps/R/4.2.1/lib64/R/lib/libRblas.so LAPACK: /cm/shared/apps/R/4.2.1/lib64/R/lib/libRlapack.so

locale: [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=en_GB.UTF-8
[4] LC_COLLATE=en_GB.UTF-8 LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
[7] LC_PAPER=en_GB.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] sparklyr_1.7.8 coloc_5.1.0.1 forcats_0.5.1 stringr_1.4.0 dplyr_1.0.10 purrr_0.3.4
[7] readr_2.1.2 tidyr_1.2.0 tibble_3.1.8 ggplot2_3.3.6 tidyverse_1.3.2

loaded via a namespace (and not attached): [1] matrixStats_0.62.0 fs_1.5.2 usethis_2.1.6 lubridate_1.8.0 devtools_2.4.3
[6] bit64_4.0.5 httr_1.4.3 rprojroot_2.0.3 tools_4.2.1 backports_1.4.1
[11] utf8_1.2.2 R6_2.5.1 irlba_2.3.5.1 DBI_1.1.3 colorspace_2.0-3
[16] withr_2.5.0 tidyselect_1.2.0 gridExtra_2.3 prettyunits_1.1.1 processx_3.7.0
[21] curl_4.3.2 bit_4.0.4 compiler_4.2.1 cli_3.4.1 rvest_1.0.3
[26] forge_0.2.0 xml2_1.3.3 scales_1.2.0 callr_3.7.0 rappdirs_0.3.3
[31] mixsqp_0.3-43 digest_0.6.29 base64enc_0.1-3 pkgconfig_2.0.3 htmltools_0.5.2
[36] sessioninfo_1.2.2 dbplyr_2.2.1 fastmap_1.1.0 htmlwidgets_1.5.4 rlang_1.0.6
[41] readxl_1.4.1 susieR_0.12.27 rstudioapi_0.13 generics_0.1.3 jsonlite_1.8.0
[46] vroom_1.6.0 config_0.3.1 googlesheets4_1.0.1 magrittr_2.0.3 Matrix_1.4-1
[51] Rcpp_1.0.9 munsell_0.5.0 fansi_1.0.3 viridis_0.6.2 RcppZiggurat_0.1.6 [56] lifecycle_1.0.3 stringi_1.7.6 yaml_2.3.5 pkgbuild_1.3.1 plyr_1.8.7
[61] grid_4.2.1 parallel_4.2.1 crayon_1.5.1 lattice_0.20-45 haven_2.5.0
[66] hms_1.1.1 ps_1.7.1 pillar_1.8.1 pkgload_1.3.0 reprex_2.0.2
[71] glue_1.6.2 data.table_1.14.2 remotes_2.4.2 modelr_0.1.9 vctrs_0.4.2
[76] tzdb_0.3.0 cellranger_1.1.0 gtable_0.3.0 reshape_0.8.9 assertthat_0.2.1
[81] cachem_1.0.6 r2d3_0.2.6 Rfast_2.0.6 broom_1.0.1 googledrive_2.0.0
[86] viridisLite_0.4.0 gargle_1.2.1 memoise_2.0.1 ellipsis_0.3.2

chr1swallace commented 1 year ago

Thank you. That looks right. Could you try with the most recent github version? remotes::install_github("chr1swallace/coloc")

If the problem still persists, would it be possible for you to share with me the lists, because I cannot reproduce the problem with my data.


From: Nick Shrine @.> Sent: 04 November 2022 09:54 To: chr1swallace/coloc @.> Cc: Chris Wallace @.>; Comment @.> Subject: Re: [chr1swallace/coloc] coloc.susie: warning about providing sample size (Issue #103)

str(d1) List of 12 $ snp : chr [1:4299] "12_66122232_A_G" "12_66901409_C_T" "12_65443031_A_G" "12_65985584_C_G" ... $ CHROM : num [1:4299] 12 12 12 12 12 12 12 12 12 12 ... $ POS : num [1:4299] 66122232 66901409 65443031 65985584 65898330 ... $ A1 : chr [1:4299] "A" "T" "A" "C" ... $ A2 : chr [1:4299] "G" "C" "G" "G" ... $ MAF : Named num [1:4299] 0.0671 0.4532 0.0015 0.0378 0.3925 ... ..- attr(, "names")= chr [1:4299] "12_66122232_A_G" "12_66901409_C_T" "12_65443031_A_G" "12_65985584_C_G" ... $ beta : Named num [1:4299] 0 -0.0005 -0.1475 -0.0142 0.0002 ... ..- attr(, "names")= chr [1:4299] "12_66122232_A_G" "12_66901409_C_T" "12_65443031_A_G" "12_65985584_C_G" ... $ varbeta: Named num [1:4299] 3.72e-05 9.00e-06 2.59e-03 6.40e-05 9.61e-06 ... ..- attr(, "names")= chr [1:4299] "12_66122232_A_G" "12_66901409_C_T" "12_65443031_A_G" "12_65985584_C_G" ... $ pvalues: num [1:4299] 0.9953 0.8566 0.00374 0.07668 0.9551 ... $ LD : num [1:4299, 1:4299] 1 1 -0.0169 0.1321 -0.0347 ... ..- attr(, "dimnames")=List of 2 .. ..$ : chr [1:4299] "12_65218142_C_G" "12_65218404_C_G" "12_65219960_A_G" "12_65220367_A_G" ... .. ..$ : chr [1:4299] "12_65218142_C_G" "12_65218404_C_G" "12_65219960_A_G" "12_65220367_A_G" ... $ N : num 247107 $ type : chr "quant"

str(d2) List of 12 $ snp : chr [1:4299] "12_65218142_C_G" "12_65218404_C_G" "12_65219960_A_G" "12_65220367_A_G" ... $ CHROM : int [1:4299] 12 12 12 12 12 12 12 12 12 12 ... $ POS : int [1:4299] 65218142 65218404 65219960 65220367 65220856 65222347 65222654 65224174 65225529 65225605 ... $ A1 : chr [1:4299] "G" "G" "G" "G" ... $ A2 : chr [1:4299] "C" "C" "A" "A" ... $ MAF : Named num [1:4299] 0.0131 0.0122 0.0296 0.3946 0.0314 ... ..- attr(, "names")= chr [1:4299] "12_65218142_C_G" "12_65218404_C_G" "12_65219960_A_G" "12_65220367_A_G" ... $ beta : Named num [1:4299] 0.5062 0.5603 -0.071 0.0732 -0.0328 ... ..- attr(, "names")= chr [1:4299] "12_65218142_C_G" "12_65218404_C_G" "12_65219960_A_G" "12_65220367_A_G" ... $ varbeta: Named num [1:4299] 0.04608 0.04948 0.02209 0.00251 0.01965 ... ..- attr(, "names")= chr [1:4299] "12_65218142_C_G" "12_65218404_C_G" "12_65219960_A_G" "12_65220367_A_G" ... $ pvalues: num [1:4299] 0.0187 0.0121 0.6331 0.1448 0.8153 ... $ LD : num [1:4299, 1:4299] 1 1 -0.0169 0.1321 -0.0347 ... ..- attr(, "dimnames")=List of 2 .. ..$ : chr [1:4299] "12_65218142_C_G" "12_65218404_C_G" "12_65219960_A_G" "12_65220367_A_G" ... .. ..$ : chr [1:4299] "12_65218142_C_G" "12_65218404_C_G" "12_65219960_A_G" "12_65220367_A_G" ... $ N : num 574 $ type : chr "quant"

sessionInfo() R version 4.2.1 (2022-06-23) Platform: x86_64-pc-linux-gnu (64-bit) Running under: CentOS Linux 7 (Core)

Matrix products: default BLAS: /cm/shared/apps/R/4.2.1/lib64/R/lib/libRblas.so LAPACK: /cm/shared/apps/R/4.2.1/lib64/R/lib/libRlapack.so

locale: [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=en_GB.UTF-8 [4] LC_COLLATE=en_GB.UTF-8 LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 [7] LC_PAPER=en_GB.UTF-8 LC_NAME=C LC_ADDRESS=C [10] LC_TELEPHONE=C LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] sparklyr_1.7.8 coloc_5.1.0.1 forcats_0.5.1 stringr_1.4.0 dplyr_1.0.10 purrr_0.3.4 [7] readr_2.1.2 tidyr_1.2.0 tibble_3.1.8 ggplot2_3.3.6 tidyverse_1.3.2

loaded via a namespace (and not attached): [1] matrixStats_0.62.0 fs_1.5.2 usethis_2.1.6 lubridate_1.8.0 devtools_2.4.3 [6] bit64_4.0.5 httr_1.4.3 rprojroot_2.0.3 tools_4.2.1 backports_1.4.1 [11] utf8_1.2.2 R6_2.5.1 irlba_2.3.5.1 DBI_1.1.3 colorspace_2.0-3 [16] withr_2.5.0 tidyselect_1.2.0 gridExtra_2.3 prettyunits_1.1.1 processx_3.7.0 [21] curl_4.3.2 bit_4.0.4 compiler_4.2.1 cli_3.4.1 rvest_1.0.3 [26] forge_0.2.0 xml2_1.3.3 scales_1.2.0 callr_3.7.0 rappdirs_0.3.3 [31] mixsqp_0.3-43 digest_0.6.29 base64enc_0.1-3 pkgconfig_2.0.3 htmltools_0.5.2 [36] sessioninfo_1.2.2 dbplyr_2.2.1 fastmap_1.1.0 htmlwidgets_1.5.4 rlang_1.0.6 [41] readxl_1.4.1 susieR_0.12.27 rstudioapi_0.13 generics_0.1.3 jsonlite_1.8.0 [46] vroom_1.6.0 config_0.3.1 googlesheets4_1.0.1 magrittr_2.0.3 Matrix_1.4-1 [51] Rcpp_1.0.9 munsell_0.5.0 fansi_1.0.3 viridis_0.6.2 RcppZiggurat_0.1.6 [56] lifecycle_1.0.3 stringi_1.7.6 yaml_2.3.5 pkgbuild_1.3.1 plyr_1.8.7 [61] grid_4.2.1 parallel_4.2.1 crayon_1.5.1 lattice_0.20-45 haven_2.5.0 [66] hms_1.1.1 ps_1.7.1 pillar_1.8.1 pkgload_1.3.0 reprex_2.0.2 [71] glue_1.6.2 data.table_1.14.2 remotes_2.4.2 modelr_0.1.9 vctrs_0.4.2 [76] tzdb_0.3.0 cellranger_1.1.0 gtable_0.3.0 reshape_0.8.9 assertthat_0.2.1 [81] cachem_1.0.6 r2d3_0.2.6 Rfast_2.0.6 broom_1.0.1 googledrive_2.0.0 [86] viridisLite_0.4.0 gargle_1.2.1 memoise_2.0.1 ellipsis_0.3.2

— Reply to this email directly, view it on GitHubhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fchr1swallace%2Fcoloc%2Fissues%2F103%23issuecomment-1303193378&data=05%7C01%7Ccew54%40universityofcambridgecloud.onmicrosoft.com%7Cfa927986bcf6417c3bb108dabe4aab4f%7C49a50445bdfa4b79ade3547b4f3986e9%7C0%7C0%7C638031525151596621%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=3h6E0s5FwJesd4M7JEbeNiORN410A6ZcUpKJKBKAQW4%3D&reserved=0, or unsubscribehttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAQWR2DUUNU5TH57BMRU5LLWGTMODANCNFSM6AAAAAARW52PSA&data=05%7C01%7Ccew54%40universityofcambridgecloud.onmicrosoft.com%7Cfa927986bcf6417c3bb108dabe4aab4f%7C49a50445bdfa4b79ade3547b4f3986e9%7C0%7C0%7C638031525151752843%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=B6wbMvnOQHpFYXFHXn327FGcgHUwTZUclhWHFvNDIwQ%3D&reserved=0. You are receiving this because you commented.Message ID: @.***>

nshrine commented 1 year ago

Yes that's fixed it, of course I should have tried the latest version first, sorry!

chr1swallace commented 1 year ago

No problem, glad that fixed it 🙂


From: Nick Shrine @.> Sent: 04 November 2022 11:52 To: chr1swallace/coloc @.> Cc: Chris Wallace @.>; Comment @.> Subject: Re: [chr1swallace/coloc] coloc.susie: warning about providing sample size (Issue #103)

Yes that's fixed it, of course I should have tried the latest version first, sorry!

— Reply to this email directly, view it on GitHubhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fchr1swallace%2Fcoloc%2Fissues%2F103%23issuecomment-1303321518&data=05%7C01%7Ccew54%40universityofcambridgecloud.onmicrosoft.com%7C26b09c62193949c6277008dabe5b1bf5%7C49a50445bdfa4b79ade3547b4f3986e9%7C0%7C0%7C638031595759214566%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=cJFGvUmmboTdWMZ%2FWYEf3%2BmJUb%2BCwHzo1%2B58eMTrBxc%3D&reserved=0, or unsubscribehttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAQWR2G66EOIZHM4LRKE2PTWGT2JJANCNFSM6AAAAAARW52PSA&data=05%7C01%7Ccew54%40universityofcambridgecloud.onmicrosoft.com%7C26b09c62193949c6277008dabe5b1bf5%7C49a50445bdfa4b79ade3547b4f3986e9%7C0%7C0%7C638031595759214566%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=ModVXYMRiWlH5Kk6rw29OymyCJ%2BQWzwK%2BvjVgUg1WRQ%3D&reserved=0. You are receiving this because you commented.Message ID: @.***>

nshrine commented 1 year ago

It looks like the code you introduced to add the sample size to the susie arguments has a bug i.e. this code in susie.R:

 while(!converged) {
    message("running max iterations: ",maxit)
    ## at 0.12.6 susieR introduced need for n = sample size
    susie_args=c(list(n=d$N), susie_args)
    res=do.call(susie_rss,
                c(list(z=z, R=LD, max_iter=maxit), susie_args))
    converged=res$converged; #s_init=res; maxit=maxit*2
    message("\tconverged: ",converged)
    if(!converged && repeat_until_convergence==FALSE)
      stop("susie_rss() did not converge in ",maxit," iterations. Try running with run_until_convergence=TRUE")
    if(!converged)
      maxit=maxit * 100 # no point in half measures!
  }

The line

    susie_args=c(list(n=d$N), susie_args)

needs to be outside the while loop otherwise if susie_rss does not converge the first time then next time round the loop another n gets appended to the susie_args and susie bombs out with this error:

Error in (function (z, R, n, bhat, shat, var_y, z_ld_weight = 0, estimate_residual_variance = FALSE,  : 
  formal argument "n" matched by multiple actual arguments

So any dataset that doesn't converge on the first set of iterations fails.

I wondered why I was getting so few results back.

chr1swallace commented 1 year ago

thank you, should be fixed now

https://chr1swallace.github.io


From: Nick Shrine @.> Sent: 10 November 2022 22:46 To: chr1swallace/coloc @.> Cc: Chris Wallace @.>; State change @.> Subject: Re: [chr1swallace/coloc] coloc.susie: warning about providing sample size (Issue #103)

It looks like the code you introduced to add the sample size to the susie arguments has a bug i.e. this code in susie.R:

while(!converged) { message("running max iterations: ",maxit)

at 0.12.6 susieR introduced need for n = sample size

susie_args=c(list(n=d$N), susie_args)
res=do.call(susie_rss,
            c(list(z=z, R=LD, max_iter=maxit), susie_args))
converged=res$converged; #s_init=res; maxit=maxit*2
message("\tconverged: ",converged)
if(!converged && repeat_until_convergence==FALSE)
  stop("susie_rss() did not converge in ",maxit," iterations. Try running with run_until_convergence=TRUE")
if(!converged)
  maxit=maxit * 100 # no point in half measures!

}

The line

susie_args=c(list(n=d$N), susie_args)

needs to be outside the while loop otherwise if susie_rss does not converge the first time then next time round the loop another n gets appended to the susie_args and susie bombs out with this error:

Error in (function (z, R, n, bhat, shat, var_y, z_ld_weight = 0, estimate_residual_variance = FALSE, : formal argument "n" matched by multiple actual arguments

So any dataset that doesn't converge on the first set of iterations fails.

I wondered why I was getting so few results back.

— Reply to this email directly, view it on GitHubhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fchr1swallace%2Fcoloc%2Fissues%2F103%23issuecomment-1310995902&data=05%7C01%7Ccew54%40universityofcambridgecloud.onmicrosoft.com%7C75df62496d944ab7004708dac36d8290%7C49a50445bdfa4b79ade3547b4f3986e9%7C1%7C0%7C638037172350048379%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=bGtkHxxl6Jw8thJk3t%2B5hdpmcCSjI21iTfkk0tA0kaE%3D&reserved=0, or unsubscribehttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAQWR2GUEWMYXENYDY3QHT3WHV3NDANCNFSM6AAAAAARW52PSA&data=05%7C01%7Ccew54%40universityofcambridgecloud.onmicrosoft.com%7C75df62496d944ab7004708dac36d8290%7C49a50445bdfa4b79ade3547b4f3986e9%7C1%7C0%7C638037172350048379%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=WTnJjsbDevT0tnZ0c%2B%2FWkAuPuKCW4QvyIMNWdT5NGBc%3D&reserved=0. You are receiving this because you modified the open/close state.Message ID: @.***>