Skip to content

Commit

Permalink
changes in the computation of pvals
Browse files Browse the repository at this point in the history
  • Loading branch information
sara-fallet committed Oct 16, 2024
1 parent 46a75a0 commit 866719c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions R/cit_asymp.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,17 @@ cit_asymp <- function(Y, X, Z = NULL, space_y = FALSE, number_y = length(unique(
decomp <- eigen(Sigma, symmetric=TRUE, only.values=TRUE)

# computing the pvalue ----
pval <- survey::pchisqsum(test_stat, lower.tail = FALSE, df = rep(1, ncol(Sigma)),
a = decomp$values, method = "saddlepoint")
pval <- try(survey::pchisqsum(test_stat, lower.tail = FALSE, df = rep(1, ncol(Sigma)),
a = decomp$values, method = "saddlepoint"),
silent=TRUE)
if(inherits(pval, "try-error")){
pval <- try(survey::pchisqsum(test_stat, lower.tail = FALSE, df = rep(1, ncol(Sigma)),
a = decomp$values, method = "satterthwaite"),
silent=TRUE)
if(inherits(pval, "try-error")){
pval <- NA
}
}

return(data.frame("raw_pval" = pval, "Stat" = test_stat))

Expand Down

0 comments on commit 866719c

Please sign in to comment.