Giter VIP home page Giter VIP logo

Comments (3)

NErler avatar NErler commented on August 12, 2024

Thank you for your post. This is indeed a bug. The wrong elements of the data matrix are set to be monitored. I will look into fixing this. In the meantime, you can "solve" the issue by specifying the correct elements to be monitored via the "other" argument of monitor_params.

library("JointAI")

# modelspecification without actually running it
mod0 <- survreg_imp(Surv(futime, status != "alive") ~ age + sex +
                       copper + trig, models = c(copper = "lognorm", trig = "lognorm"),
                     data = subset(PBC, day == 0), n.adapt = 0)

# indices of the column and rows of the data matrix containing the variable "copper"
col <- which(colnames(mod0$data_list$M_lvlone) == "copper")
rows <- which(is.na(mod0$data_list$M_lvlone[, "copper"]))

# node to be monitored
imp_copper <- paste0("M_lvlone[", rows, ",", col, "]")

# run the model
mod6a <- update(mod0, n.adapt = 100, n.iter = 250,
                monitor_params = list(imps = TRUE, other = imp_copper))

# extract the imputed values
impDF <- get_MIdat(mod6a, m = 10, seed = 2019)

from jointai.

bbb801 avatar bbb801 commented on August 12, 2024

Thank you! Dr NErler. I am not sure of the meaning of this solution and I would like to use it on my own data with over 300000 rows and 80 columns. Is it possible to use survreg_imp/coxph_imp for multil-class (like in competing risk model) or multi-label classification? Is it possible to training survreg_imp/coxph_imp model and then use this model to impute the missing value for another dataset (like the testing set)? Thank you!

from jointai.

NErler avatar NErler commented on August 12, 2024

It is not yet possible to fit competing risk models in JointAI.
There is no out-of-the-box solution for imputing values in another dataset using the parameter estimates from the first dataset.
Missing values in covariates are imputed from their full-conditional posterior distributions, which are derived within JAGS from the joint distribution that JointAI specifies.
Imputing values in a new dataset based on the parameters from the original data would require you to do this sampling in R, using, for instance, a Metropolis-Hastings sampler because the imputation models will usually not have a closed-form.

from jointai.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.