You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tbl_regression will work for a geeglm model if the splines are manually created, but if the function rcspline.eval is included in the formula, tbl_regression gives an error
library(tidyverse)
library(gtsummary)
# Creating model with manually-calculated splinesgee_manualsplines<-geepack::geeglm(
#we are interested in the relationship between weight and time
as.formula("weight ~ Time + sp2Time + sp3Time"),
data=ChickWeight %>%
#we need to add spline terms for Time
left_join(
Hmisc::rcspline.eval(ChickWeight$Time, nk=4, inclx=TRUE, norm=0) %>%
as_tibble(.name_repair="unique") %>%
set_names("Time", "sp2Time", "sp3Time") %>%
unique(),
by= c("Time")
),
family=gaussian,
#we have multiple of weight over time for each chickid=Chick,
corstr="exchangeable"
)
#> New names:#> * `` -> ...2#> * `` -> ...3#> New names:#> * `` -> ...2#> * `` -> ...3#> New names:#> * `` -> ...2#> * `` -> ...3#> New names:#> * `` -> ...2#> * `` -> ...3gee_manualsplines %>%
tbl_regression()
# Creating model with rcspline.eval in formulagee_with_splines<-geepack::geeglm(
#we are interested in the relationship between weight and time
as.formula("weight ~ Diet + rcspline.eval(Time, nk = 4, inclx = TRUE, norm = 0)"),
data=ChickWeight,
family=gaussian,
#we have multiple of weight over time for each chickid=Chick,
corstr="exchangeable"
)
gee_with_splines %>%
tbl_regression()
#> Warning: non-unique value when setting 'row.names': 'rcspline.eval(Time, nk = 4,#> inclx = TRUE, norm = 0)'#> Error in `.rowNamesDF<-`(x, value = value): duplicate 'row.names' are not allowed
related to #337. This error occurs because of a failure in tidy(). When the name are not unique, the geepack() summary function also errors causing the tidy() error.
tbl_regression will work for a geeglm model if the splines are manually created, but if the function rcspline.eval is included in the formula, tbl_regression gives an error
Created on 2020-01-09 by the reprex package (v0.3.0)
The text was updated successfully, but these errors were encountered: