@@ -218,25 +218,45 @@ r2_coxsnell.svycoxph <- function(model, ...) {
218218
219219# ' @export
220220r2_coxsnell.multinom <- function (model , ... ) {
221- l_base <- insight :: get_loglikelihood(stats :: update(model , ~ 1 , trace = FALSE ))
221+ l_base <- insight :: get_loglikelihood(stats :: update(
222+ model ,
223+ ~ 1 ,
224+ trace = FALSE ,
225+ data = insight :: get_data(model , source = " mf" )
226+ ))
222227 .r2_coxsnell(model , l_base )
223228}
224229
225230# ' @export
226231r2_coxsnell.clm2 <- function (model , ... ) {
227- l_base <- insight :: get_loglikelihood(stats :: update(model , location = ~ 1 , scale = ~ 1 ))
232+ l_base <- insight :: get_loglikelihood(stats :: update(
233+ model ,
234+ location = ~ 1 ,
235+ scale = ~ 1 ,
236+ data = insight :: get_data(model , source = " mf" )
237+ ))
228238 .r2_coxsnell(model , l_base )
229239}
230240
231241# ' @export
232242r2_coxsnell.bayesx <- function (model , ... ) {
233- junk <- utils :: capture.output(l_base <- insight :: get_loglikelihood(stats :: update(model , ~ 1 ))) # nolint
243+ junk <- utils :: capture.output(
244+ l_base <- insight :: get_loglikelihood(stats :: update(
245+ model ,
246+ ~ 1 ,
247+ data = insight :: get_data(model , source = " mf" )
248+ ))
249+ )
234250 .r2_coxsnell(model , l_base )
235251}
236252
237253# ' @export
238254r2_coxsnell.clm <- function (model , ... ) {
239- l_base <- insight :: get_loglikelihood(stats :: update(model , ~ 1 ))
255+ l_base <- insight :: get_loglikelihood(stats :: update(
256+ model ,
257+ ~ 1 ,
258+ data = insight :: get_data(model , source = " mf" )
259+ ))
240260 # if no loglik, return NA
241261 if (length(as.numeric(l_base )) == 0 ) {
242262 return (NULL )
0 commit comments