Giter VIP home page Giter VIP logo

jointai's People

Contributors

actions-user avatar nerler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jointai's Issues

It is currently not possible to use “contr.poly” for incomplete categorical covariates. I will use “contr.treatment” instead. You can specify (globally) which types of contrasts are used by changing “options('contrasts')”.

Dear Dr Nicole Erler

My whole data has over 30,0000 and 884 columns. Now I just sample 1000 rows for testing using using 'survreg_imp' function. Then it has been running for a whole day and never stops, just with 1000 rows data; I also see the warning:
Warning:
It is currently not possible to use “contr.poly” for incomplete categorical covariates. I will use “contr.treatment” instead. You can specify (globally) which types of contrasts are used by changing “options('contrasts')”.

Here shows the codes:

d<-d[sample(nrow(d), 1000), ]
f<-as.formula(paste('Surv(survival_time,', i,')~',paste(names(d)[!names(d) %in% label_used],collapse='+')))
mod1 <- survreg_imp(f,data = d[!names(d) %in% label_used], n.iter = 250,shrinkage = 'ridge',seed=1,monitor_params = c(analysis_main=TRUE,other_models = TRUE, imps = TRUE))
image

Could you provide some suggestions?

Impute specific values?

Dear Dr. Erler,

Many thanks for this terrific package.

I wonder if it's possible to impute specific values? For example, a coxph_imp class that has some missing independent covariate ordered categories clmm with 4 ordered levels but I'd only want the second & third levels to be imputed, not to impute the reference or the fourth level. Can this be done in the get_MIdat or is it within the _imp function?

Many thanks,
Harry

JM_imp(); example for unbalanced longitudinal multinomial logit models

Hi,

I came across your project and find JM_imp() function that was explained as "joint model for longitudinal and survival data". However, I couldn't execute it on a unbalanced panel data with dependent variable being a 3 categories outcome variable. I appreciate it if you could demonstrate JM_imp() on a similar example (unbalanced longitudinal multinomial logit model).

Thanks.
Erfan

JM_imp() for binary longitudinal data and right-censored multistate survival data

Dear Dr. Nicole Erler,

I am trying to understand if I can use JM_imp() for my study, which investigates the relationship between a time-varying binary variable (exposure) and right-censored survival outcomes with missing values in the binary variable.

I didn't find an example for binary/categorical time-varying covariates and survival data in this paper https://www.jstatsoft.org/article/view/v100i20. Is it possible to do? In addition, is it possible to use JM_imp() for multistate data as JMbayes2 does?

Thanks a lot!

Xin

handling a lot of variables at the same time and do purely imputation

Just have two questions:

  1. Can JointAI package do purely imputation, but no modeling?
  2. I found it has some difficulty handling a large number of covariates? When I give 50 covariates, it's OK, but when I give more than 100, it says
    Error in vapply(x, fun, FUN.VALUE = character(1L), ..., USE.NAMES = TRUE) :
    values must be length 1,
    but FUN(X[[1]]) result is length 2
    In addition: Warning messages:
    1: In gsub(paste0("^", clean_lhs, "[[ ]]*"), "", deparse(x, width.cutoff = 500L)) :
    argument 'pattern' has length > 1 and only the first element will be used
    2: Using formula(x) is deprecated when x is a character vector of length > 1.
    Consider formula(paste(x, collapse = " ")) instead.
    3: Using formula(x) is deprecated when x is a character vector of length > 1.
    Consider formula(paste(x, collapse = " ")) instead.

Thanks a lot!

Get imputation values for survival model

Dear Sir or Madam
I am running the guideline survival models and would like to extract the imputed data. I got a error. Any suggestion? Thanks.

library(JointAI)
mod6a <- survreg_imp(Surv(futime, status != "alive") ~ age + sex +
copper + trig, models = c(copper = "lognorm", trig = "lognorm"),
data = subset(PBC, day == 0), n.iter = 250,monitor_params = c(analysis_main=TRUE, imp=TRUE))
|| 100%
Warning message:
In readChar(modelfile, file.info(modelfile)$size) :
can only read in bytes in a non-UTF-8 MBCS locale
impDF <- get_MIdat(mod6a, m = 10, seed = 2019)
Error:
I cannot find imputed values for “copper”. Did you monitor them?
mod6b <- coxph_imp(Surv(futime, status != "alive") ~ age + sex +
copper + trig,# models = c(copper = "lognorm", trig = "lognorm"),
data = subset(PBC, day == 0), n.iter = 250,monitor_params = c(analysis_main=TRUE, imp=TRUE))
|
| 100%
Warning message:
In readChar(modelfile, file.info(modelfile)$size) :
can only read in bytes in a non-UTF-8 MBCS locale
impDF <- get_MIdat(mod6b, m = 10, seed = 2019)
Error:
I cannot find imputed values for “copper”. Did you monitor them?

image

Error in is.nan(data[, k]) : default method not implemented for type 'list'

Dear Dr. Erler,
I get this error when running the following commands:
model.cox<-coxph_imp(Surv(surv_time,incidenceDM)~BMI_1+ageyr14_1+tg1_1+sbp_1+dbp_1+

  • hdl1_1+chol1_1+ifcvd1_1,
  • data=data,x=T,model=TRUE,n.iter=200)
    Error in is.nan(data[, k]) :
    default method not implemented for type 'list'

fit.lm1<-lme_imp(log(TSH_)~time ,random= ~time | code,data=dataLong,n.iter=200)
Error in is.nan(data[, k]) :
default method not implemented for type 'list'
Many thank you for your guidance,
Alireza

Error when passing tibble

I'm getting the following error when passing a tibble. I'm guessing this is the same problem that was reported in Issue #8.

Example

library(dplyr)
library(JointAI)

set.seed(284397)
lm_imp(y ~ x,
       data = tibble(y = rnorm(100),
                     x = c(rnorm(99), NA)))

## Error in is.nan(data[, k]) : 
##  default method not implemented for type 'list'

Work around

Convert tibbles to data.frames:

lm_imp(y ~ x,
       data = tibble(y = rnorm(100),
                     x = c(rnorm(99), NA)) %>%
         as.data.frame())

## Note: No MCMC sample will be created when n.iter is set to 0.
## 
## Call:
## lm_imp(formula = y ~ x, data = tibble(y = rnorm(100), x = c(rnorm(99), 
##     NA)) %>% as.data.frame())
## 
## (The object does not contain an MCMC sample.)

Error in 'is.nan().

Here is the error:

|.................... | 39% [unnamed-chunk-5] Error in is.nan():
! default method not implemented for type 'list'
Backtrace:

  1. JointAI::lme_imp(...)
  2. JointAI (local) <fn>(...)
  3. JointAI:::check_data(data, fixed, random, auxvars, timevar, mess)
  4. JointAI:::convert_variables(...)
  5. tibble:::[<-.tbl_df(*tmp*, is.nan(data[, k]), k, value = <lgl>)

Here is the code: lmimp1<- lme_imp(phqtotal~time_25 + treat + treat:time_25 + PHQBL + time_25:PHQBL+nonwhite +(1|id)
+(1|cohort), data =rostlong1r)

Here is the result of lapply for my dataset:

View(rostlong1r)
lapply(rostlong1r, class)
$id
[1] "numeric"

$phqtotal
[1] "numeric"

$time_25
[1] "numeric"

$treat
[1] "numeric"

$PHQBL
[1] "numeric"

$nonwhite
[1] "numeric"

$cohort
[1] "numeric"

JointAI glm_imp() stops working if logistf package is loaded

Hi!

Thank you for an excellent package!

I have come across an issue when performing logistic regression with JointAI, and thought to report it since JointAI asks me to report bugs each time I load the package :)

If the logistf package is loaded in Rstudio, the glm_imp function returns the following error: Error in terms.formula(formula) : invalid term in model formula.

The only fix that have worked for me is closing Rstudio completely, restarting and do analyses with JointAI before loading logistf. Detatching logistf or running code as JointAI::glm_imp() did not work.

Best regards,
Silje

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.