Comments (4)
The root cause of the problem is the artificial offset
induced when fitting group-updated models, which will trigger the wrong data pull with in cv.bh
at line 136.
Line 136 in ac76cec
To examine, we follow the previous example code and show group-updated models introduce artificial offset
with the follows
is.null(mdl_joint$offset) #TRUE
#> Error in eval(expr, envir, enclos): object 'mdl_joint' not found
is.null(mdl_group$offset) #FALSE
#> Error in eval(expr, envir, enclos): object 'mdl_group' not found
Created on 2022-01-03 by the reprex package (v2.0.1)
from bhglm.
Suggested solution:
We can re-assign the correct offset after fitting coxph
internally. For example, we can add a line of code
fit$offset<- offset
at bcoxph.r
line 436
Line 436 in ac76cec
Technically, there is a correction of offset implemented in bcoxph
with on Line 266
Line 266 in ac76cec
However, it doesn't work when offsets are 0.
from bhglm.
This bug does not have an impact on prediction via predict
function. Specifically, predict.coxph
in the survival
package, check attributes to decide if offset should be included in prediction,
has.offset <- !is.null(attr(Terms, 'offset')) if (is.null(object[['x']]) || has.weights || has.offset || # the remaining code is omited
In our case, the Terms are corrected via
Line 260 in ac76cec
To demonstrate there is no impact on prediction, here is the example (following previous code)
is.null(attr(mdl_joint, "offset")) #TRUE
is.null(attr(mdl_group, "offset")) #TRUE
is.null(attr(mdl_joint$terms, "offset")) #TRUE
is.null(attr(mdl_group$terms, "offset")) #TRUE
## Examination of prediction
cor(
data.frame(
joint_mdl = predict(mdl_joint, type="expected"),
group_mdl = predict(mdl_group, type="expected")
)
) # Correlation is 0.99
from bhglm.
The problem resolved via f0f80cc
from bhglm.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bhglm.