R/mc_updatedBeta.R

Defines functions mc_updateBeta

Documented in mc_updateBeta

#' @title Updated regression parameters
#' @author Wagner Hugo Bonat
#'
#' @description This function update a list of regression parameters. It
#'     will be useful only inside the fitting algorithm.
#'
#' @param list_initial A list of initial values.
#' @param betas A vector with actual regression parameters values.
#' @param information A list with information about the number of
#'     parameters in the model. In general the output from
#'     \link{mc_getInformation}.
#' @keywords internal
#' @param n_resp A numeric specyfing the number of response variables.
#' @return A list with updated values of the regression parameters.

mc_updateBeta <- function(list_initial, betas, information, n_resp) {
    cod <- rep(1:n_resp, information$n_betas)
    temp <- data.frame(beta = betas, cod)
    for (k in 1:n_resp) {
        list_initial$regression[[k]] <-
            temp[which(temp$cod == k), ]$beta
    }
    return(list_initial)
}

Try the mcglm package in your browser

Any scripts or data that you put into this service are public.

mcglm documentation built on Sept. 16, 2022, 1:06 a.m.