-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
I am interested in using both bnlr and gnlr within a function and I found that a chunk of code that works outside a function, when placed within a function sends an error.
To illustrate this here is a simplified example:
Code outside a function
iniParam <- list(rate = 1)
resp <- rbinom(1, n =70, p = 0.5)
y <- cbind(resp, 1 - resp)
x <- rep(1:7, 10)
res <- gnlm::bnlr(y = y, link = "logit",
mu = ~ exp(-rate * x),
pmu = iniParam)
rm(list = ls())
Code within a function
testFunc <- function(){
iniParam <- list(rate = 1)
resp <- rbinom(1, n =70, p = 0.5)
y <- cbind(resp, 1 - resp)
x <- rep(1:7, 10)
res <- gnlm::bnlr(y = y, link = "logit",
mu = ~ exp(-rate * x),
pmu = iniParam)
return(res)
}
testFunc()
I have tried to solve this problem by setting a new environment within the function or using tccov class object, but in both cases a different error arose.
I would much appreciate any insight you may have about solving this problem.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels