發表文章

目前顯示的是 7月, 2023的文章

Ratio vars

  Rank-based methods: Instead of directly analyzing the ratio variable, you can consider converting the data into ranks and perform analyses based on the ranks. Rank-based methods, such as the Wilcoxon signed-rank test or the Mann-Whitney U test, do not depend on means and variances and can be suitable for analyzing variables without defined moments. 2. Non-parametric tests: Non-parametric tests, such as the Kruskal-Wallis test or the Jonckheere-Terpstra test, can be used to assess differences or trends across groups without relying on specific distributional assumptions. These tests compare medians or rank-based statistics, making them applicable even when means and variances are not well-defined. 3. Data transformation: While I previously mentioned logarithmic transformation, which assumes the existence of moments, other data transformations may be appropriate for certain types of ratio variables. Investigate whether alternative transformations, such as reciprocal or power transf...

Using Bayesian Methods to Augment the Interpretation of Critical Care Trials. An Overview of Theory and Example Reanalysis of the Alveolar Recruitment for Acute Respiratory Distress Syndrome Trial 20

#### Bayesian priors #### ##### LOAD PACKAGES #### library(tidyverse)  library(insight) library(bayestestR) library(cowplot) library(brms) library(broom) library(parameters) ####Analysis for ART — LR and Flat Prior#### #Traditional LR: db$dead<-as.factor(ifelse(db$death==”yes”,1,0)) art.lr<-glm(dead~group,family=”binomial”,data=db) summary(art.lr) exp(confint(art.lr)) #Flat prior analysis flat_prior<-prior(normal(0,1000), class = “b”) art.flat <- brm( dead ~ group, data = db, prior = flat_prior, family = “bernoulli”, seed = 123 # Adding a seed makes results reproducible. ) #Uses insight package to sample posteriors posteriors <- insight::get_parameters(art.flat,iterations=10^5) #Summarizes the flat prior analysis art.flat.summary<-summary(art.flat) mean_eff<-art.flat.summary$fixed[2,1] mean_sd<-art.flat.summary$fixed[2,2] #Some summaries using for plot legend any_harm<-sum(posteriors$b_groupART>0)/nrow(posteriors) severe_harm<-sum(posteriors$b_group...

When Evidence and Significance Collide

 bf10_ <- function(x, se, mu, tau, alternative = "two.sided") {   bfUncorrect <- stats::dnorm(x = x, mean = mu, sd = sqrt(se^2 + tau^2))/     stats::dnorm(x = x, mean = 0, sd = se)   if (alternative == "two.sided") {     bf <- bfUncorrect   } else {     postVar <- 1/(1/se^2 + 1/tau^2)     postMean <- (x/se^2 + mu/tau^2)*postVar     if (alternative == "greater") {       bf <- bfUncorrect*pnorm(q = postMean/sqrt(postVar))/pnorm(q = mu/tau)     } else if (alternative == "less") {       bf <- bfUncorrect*pnorm(q = -postMean/sqrt(postVar))/pnorm(q = -mu/tau)     } else {       bf <- NaN     }   }   return(bf) } bf10 <- Vectorize(FUN = bf10_) ## make a nice contour plot ## ----------------------------------------------------------------------------- ## compute contours formatBF <- function(BF) ifelse(BF < 1,...

Comment on “Bayesian additional evidence for decision making under small sample uncertainty”

  ## reproduce BAE calculations from Sondhi et al. (2021) ## ----------------------------------------------------------------------------- ## data from Sondhi et al. (2021) hr <- 0.42 hrCI <- c ( 0.14 , 1.23 ) x <- log ( hr ) za <- qnorm ( p = 0.975 ) se <- ( log ( hrCI )[ 2 ] - log ( hrCI )[ 1 ]) / ( 2 * za ) p <- 2 * pnorm ( q = abs ( x ) / se , lower.tail = FALSE ) ## prior evidence from Innocenti et al. (2019) hr2 <- 0.13 hr2CI <- c ( 0.06 , 0.30 ) x2 <- log ( 0.13 ) se2 <- ( log ( hr2CI [ 2 ]) - log ( hr2CI [ 1 ])) / ( 2 * za ) ## Bayesian additional evidence based on effect size and standard error baeES <- function ( x , se , alpha ) { bae <- sign ( x ) * sqrt ( 2 ) * qnorm ( p = 1 - alpha / 2 ) * se - x return ( bae ) } ## Bayesian additional evidence based on confidence interval limits baeCI <- function ( L , U ) { x <- mean ( c ( L , U )) ...