diff --git a/R/get_loglikelihood.R b/R/get_loglikelihood.R index f4611ed2c..f40bf350f 100644 --- a/R/get_loglikelihood.R +++ b/R/get_loglikelihood.R @@ -490,6 +490,13 @@ get_loglikelihood.phyloglm <- get_loglikelihood.phylolm .weighted_sum((get_response(x, as_proportion = TRUE) - 1), w = model_weights) } else if (trans == "sqrt") { .weighted_sum(log(0.5 / sqrt(get_response(x, as_proportion = TRUE))), w = model_weights) + } else if (trans == "inverse") { + # first derivate of 1/x is -1/x^2 - we cannot take the log from negativ + # values, so this won't work here, and we return NULL + NULL + } else if (trans == "power") { + trans_power <- as.numeric(.safe(gsub("\\(|\\)", "", gsub("(.*)(\\^|\\*\\*)\\s*(\\d+|[()])", "\\3", find_terms(x)[["response"]])))) # nolint + .weighted_sum(log(trans_power * (get_response(x, as_proportion = TRUE)^(trans_power - 1))), w = model_weights) # nolint } else if (is.null(model_weights)) { .ll_log_adjustment(x) } else {