[R] dagitty library : NULL response

varin sacha v@r|n@@ch@ @end|ng |rom y@hoo@|r
Thu Mar 31 20:25:11 CEST 2022


Dear Rui,

Great, many thanks !







Le jeudi 31 mars 2022, 13:48:07 UTC+2, Rui Barradas <ruipbarradas using sapo.pt> a écrit : 





Hello,

You have spaces in the method = " holm " argument. Remove them and have 
the error function return the error to see the error.


tryCatch ({
  r <- localTests(g1, d)
  p.dagitty.param.correct <- min(p.adjust(r$p.value , method = " holm "))
}, error = function(e) {e})
#<simpleError in match.arg(method): 'arg' should be one of “holm”, 
#“hochberg”, “hommel”, “bonferroni”, “BH”, “BY”, “fdr”, “none”>


tryCatch ({
  r <- localTests(g1, d)
  p.dagitty.param.correct <- min(p.adjust(r$p.value , method = "holm"))
}, error = function(e) {e})
#Warning message:
#In min(p.adjust(r$p.value, method = "holm")) :
#  no non-missing arguments to min; returning Inf

p.dagitty.param.correct
#[1] Inf


Hope this helps,

Rui Barradas

Às 10:58 de 31/03/2022, varin sacha via R-help escreveu:
> Dear R-experts,
> 
> Here below my R code (toy example). No message error but I would like to know why I get NULL as a response and what does it mean ?
> 
> Many thanks.
> 
> #############################################
> library(dagitty)
> 
> x1=c(23,54,34,55,61,56,57,65,63,78,34,23,12,54,94)
> x2=c(98,76,67,89,34,56,78,99,89,120,98,67,56,54,87)
> x3=c(12,13,14,21,11,16,54,23,12,13,22,11,33,23,21)
> x4=c(34,35,45,36,65,45,55,53,51,56,57,64,34,35,45)
> 
> X=x1+x2+x3
> Y=x4
> d <- data.frame (x1,x2,x3,x4, X=X, Y=Y)
> type = c ( " cont " , " cont " , " cont " , " cont " , " cont " , " cont ")
> 
> g1 <- dagitty ( " dag {
> x1 -> x2
> x1 -> x3
> x1 -> x4
> x2 -> x3
> x2 -> x4
> x3 -> x4
> X-> Y
> x1-> X
> x2-> X
> x3-> X
> x4-> X
> x1-> Y
> x2-> Y
> x3-> Y
> x4-> Y
> } " )
> tryCatch ({
> r = localTests ( g1 , d ) ;
> p.dagitty.param.correct [ i ] = min ( p.adjust ( r$p.value , method = " holm " ) ) ;
> } , error = function( e ) {}) ;
> #############################################
> 
>  
> 
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list