martinig / Fitness-and-dispersal-MA

https://martinig.github.io/Fitness-and-dispersal-MA/
0 stars 0 forks source link

how to convert t-test #8

Closed martinig closed 6 months ago

martinig commented 10 months ago
itchyshin commented 10 months ago

It is in the func.R file I gave you

martinig commented 9 months ago

Does it matter if it is one-tailed or two-tailed?

Example: one-tailed t-test t-value = -0.86 n1 = 125.5 n2 = 125.5

# t values
t_vals <- function(t, n1, n2){ # n2 = higher/larger group
  n12 <- n1 + n2
  #h <- n12/n1 + n12/n2
  p <- n1/n12 # prop for n1
  q <- n2/n12 # prop for n2
  #t <- est/se
  r_pb <- t/sqrt(t^2+ n12 -2)

  r_b <- r_pb*(sqrt(p*q)/dnorm(qnorm(p)))
  r_b #r_b = r
}

From this, r_b = -0.06820476

martinig commented 9 months ago

It does NOT matter if it is one-tailed or two-tailed.