martinig / Fitness-and-dispersal-MA

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

how to convert chi-square #6

Closed martinig closed 6 months ago

martinig commented 10 months ago
itchyshin commented 10 months ago

As long as you have N - you can use F value formula

martinig commented 9 months ago

As an example, if this is what I have: Chi-square value = 8.14 N1=1012 N2=103

Then the formula to use would be:

# F values (sign required)
F_vals <- function(F_val, n1, n2, reverse = FALSE){ # m2 = 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 <- sqrt(F_val)/sqrt(F_val + n12 -2)

  r_b <- r_pb*(sqrt(p*q)/dnorm(qnorm(p)))
  if(reverse == TRUE){
  r_b = r_b*(-1)}
  r_b
}

And, in this case r_b = 0.1490257?

What does the reverse=false vs true mean?

martinig commented 9 months ago

If there is only one N value (because it's a gradient), do I use this instead:

#adjusting for continuous n and assumed balanced design
F_vals_b <- function(F_val, N, reverse = FALSE){
  n12 <- N
  n1 <- N/2
  n2 <- N/2
  #h <- n12/n1 + n12/n2
  p <- n1/n12 # prop for n1
  q <- n2/n12 # prop for n2
  #t <- est/se
  r_pb <- sqrt(F_val)/sqrt(F_val + n12 -2)

  r_b <- r_pb*(sqrt(p*q)/dnorm(qnorm(p)))
  if(reverse == TRUE){
    r_b = r_b*(-1)}
  r_b
}
martinig commented 9 months ago

For the <0.8 example, can assume it is 0.799.