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
I am a new user, and I'm having an issue with a model that I fit in one environment and need to use ciTools in another environment. My general use case is illustrated by the reprex below:
set.seed(5)
library(ciTools)
#> ciTools version 0.6.1 (C) Institute for Defense Analyses
library(tidyverse)
my_data<-data.frame(
counts=c(18,17,15,20,10,20,25,13,12),
outcome=rep(1:3, 3),
treatment=rep(1:3, each=3)
)
fit_my_data<-function(my_data_in_the_function) {
link<-"log"glm.D93<- glm(counts~outcome+treatment, data=my_data_in_the_function, family=gaussian(link=link))
glm.D93
}
my_model<- fit_my_data(my_data)
# Works because it is not using `update()`my_new_data<-my_data %>%
add_ci(fit=my_model)
# Fails because `link` is not set in the current environment (it is only set in# the function environment)my_new_data<-my_data %>%
add_ci(fit=my_model, type="boot")
#> Error in gaussian(link = link): object 'link' not found# Works because now the call doesn't rely on the link from the current# environment; the link comes from the model family.my_model_update<-my_modelmy_model_update$call$family<-my_model$familymy_new_data<-my_data %>%
add_ci(fit=my_model_update, type="boot")
#> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == :#> prediction from a rank-deficient fit may be misleading
Thank you for the wonderful package!
I am a new user, and I'm having an issue with a model that I fit in one environment and need to use ciTools in another environment. My general use case is illustrated by the reprex below:
Created on 2021-05-17 by the reprex package (v2.0.0)
The text was updated successfully, but these errors were encountered: