## Introduction of the function ## # The 'fn_GetBeta()' function computes the values of parameters that are identifiable in a case-control study without any additional assumption. ## Input Variables ## # rctr/rcas: the control/case cell probabilities (Order {GE: 00, 01, 10, 11}). They can also be control/case cell counts if necessary. ## Output ## # a vector of (\beta_{e}, \beta_{g}, \beta_{eg}) fn_GetBeta <- function(rctr, rcas) { rctr <- rctr/sum(rctr) rcas <- rcas/sum(rcas) lrctr <- log(rctr) lrcas <- log(rcas) beta0 <- lrcas[1]-lrctr[1] beta1 <- lrcas[2]-lrctr[2]-beta0 beta2 <- lrcas[3]-lrctr[3]-beta0 beta3 <- lrcas[4]-lrctr[4]-beta0-beta1-beta2 return( c(beta1 = beta1, beta2 = beta2, beta3 = beta3) ) } ## Introduction of the function ## # The 'fn_LambdaToTheta()' function computes the value(s) of \theta given the case-control cell probabilities and the G-E odds ratio in the source population. ## Input Variables ## # rctr/rcas: the control/case cell probabilities (Order {GE: 00, 01, 10, 11}). They can also be control/case cell counts if necessary. # rho: the GE odds ratio in the source population, with the default being 1 (the GEI assumption) ## Output ## # a list containing zero, one, or two values of \theta. fn_LambdaToTheta <- function(rctr, rcas, rho=1) { rctr <- rctr/sum(rctr) rcas <- rcas/sum(rcas) rdif <- rcas-rctr a <- rdif[1]*rdif[4]-rho*rdif[2]*rdif[3] b <- rdif[1]*rctr[4]-rho*rdif[2]*rctr[3]+rdif[4]*rctr[1]-rho*rdif[3]*rctr[2] c <- rctr[1]*rctr[4]-rho*rctr[2]*rctr[3] d <- b*b-4*a*c ThetaList <- list() if(a==0) { theta <- -c/b; if((00) { theta <- (-b+sqrt(d))/(2*a) if((00) { theta <- (-b+sqrt(d))/(2*a) if((0