#' update_trans
#'
#' \code{update_trans} updates \code{trans} once.
#'
#' @export
#' @param num number of chain
#' @param H list of matrix H
#' @return A vector of length 3, the updated paratemter and fval c(v'[k], m'[k], fval)
#'
#' @examples
#' df <- uORF[1:2]
#' X <- H <- list()
#' E <- c()
#' for (i in 1:2){
#' X[[i]] <- df[[i]]$x
#' RNA <- df[[i]]$RNA
#' E[i]=df[[i]]$E; trans=df[[i]]$trans;
#' a=df[[i]]$v; b=df[[i]]$v/df[[i]]$m
#' la <- forwardAlg(X[[i]], RNA, trans, a, b, E[i])
#' lb <- backwardAlg(X[[i]], RNA, trans, a, b, E[i])
#' H[[i]] <- computeH(X[[i]], RNA, trans, a, b, E[i], la, lb)
#' }
#'
#' update_trans(length(df), H)
update_trans <- function(num, H){
sH_it <- c(0,0,0,0,0)
for (i in 1:num){
sH_it <- sH_it + colSums(H[[i]])
}
denom1 <- sum(sH_it[1:3])
denom2 <- sum(sH_it[4:5])
trans <- sH_it[c(2,3,5)]/c(denom1,denom1,denom2)
return(trans)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.