R/backward_transform_param.R

Defines functions backward_transform_param

Documented in backward_transform_param

#' Calculates the backward transformation of the parameter
#'
#' @inheritParams avg_effect
#'
#' @returns the parameter after applying the backward transformation
#' @keywords internal
#' @importFrom ohenery  smax
#' @importFrom pracma   sigmoid
backward_transform_param = function(param){
  if(names(param)[length(param)]=="beta"){
    transformed_parm = param
    transformed_parm[1:(length(param)-1)] =
      ohenery::smax(c(-sum(transformed_parm[1:(length(param)-1)]),
                      transformed_parm[1:(length(param)-1)]))[-1]
    transformed_parm[length(param)] =
      pracma::sigmoid(transformed_parm[length(param)])
  } else{
    transformed_parm = ohenery::smax(c(-sum(param), param))[-1]
  }

  return(transformed_parm)
}

Try the scov package in your browser

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

scov documentation built on March 18, 2026, 5:08 p.m.