za                <- qnorm(alpha/2)                       # quantile of alpha
t                 <- tabla                                # contingency table
n                 <- sum(tabla)                           # total units
tm                <- addmargins(t)                        # with margins
res$Tabla         <- tm                                   # table with margins
f                 <- t/n                                  # frequencies 
fm                <- addmargins(f)                        # with margins
res$Frecuencias   <- round(fm,3)                          # table with margins
# risks                
risk              <- fm[3,1]/fm[3,3]                      # factor risk
rI_T              <- fm[1,1]/fm[1,3]                      # risk for treatment
rI_N              <- fm[2,1]/fm[2,3]                      # risk fro no treatment 
RD                <- rI_T-rI_N                            # risks difference
SRD               <- sqrt(rI_T*(1-rI_T)/tm[1,3] + rI_N*(1-rI_N)/tm[2,3]) # standard error
CID               <- c(RD+SRD*za,RD-SRD*za)               # confidence interval
RR                <- rI_T/rI_N                            # risks ratio
LRR               <- log(RR)                              # its log 
SRR               <- sqrt((1-rI_T)/tm[1,1]+(1-rI_N)/tm[2,1]) # standard error
CIL               <- c(LRR+SRR*za,LRR-SRR*za)             # log confidence interval
CIR               <- exp(CIL)                             # confidence interval
# odds                 
Odd               <- fm[3,1]/fm[3,2]                      # odd
OddI_T            <- fm[1,1]/fm[1,2]                      # odd for treatment
OddI_N            <- fm[2,1]/fm[2,2]                      # odd for no treatment
OR                <- OddI_T/OddI_N                        # odds ratio
LOR               <- log(OR)                              # its log 
SEO               <- sqrt(sum((tm[1:2,1:2])^(-1)))        # its std error
CIO               <- c(LOR+SEO*za,LOR-SEO*za)             # confidence interval
CIM               <- exp(CIO)                             # odds ratio confidence interval
