martinig / Fitness-and-dispersal-MA

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

how to convert linear regression #10

Closed martinig closed 11 months ago

martinig commented 1 year ago
itchyshin commented 1 year ago

Need to give a good example here

Otherwise the function in the file - func.R


#adjusting for continuous n and assumed balanced design
est_se_b<- function(est, se, N){ # n2 = higher/larger group
  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 <- t/sqrt(t^2+ n12 -2)

  r_b <- r_pb*(sqrt(p*q)/dnorm(qnorm(p)))
  r_b #r_b = r
}
martinig commented 1 year ago

What if the estimate does not have SE with it?

Examples:

estimate = -0.0012 N = 70

or

estimate = 5.18 N = 164 p-value = 0.023

martinig commented 1 year ago

If it only has estimate and N, this cannot be used.