Code Monkey home page Code Monkey logo

Comments (9)

alexanderrobitzsch avatar alexanderrobitzsch commented on September 26, 2024

Please provide with an example in order to check whether my code or your input is the problem (as usual for requesting help for R packages). Otherwise, I am not able to fix the possible problem.

from miceadds.

santsang avatar santsang commented on September 26, 2024

Thanks for offering help. The data are from a RCT trial. I will be in trouble if I post it online. Will giving you the str() output be okay?

Sandro

from miceadds.

alexanderrobitzsch avatar alexanderrobitzsch commented on September 26, 2024

Or could you send me a subdataset which replicates the problem via email? str does not seem to be sufficient.

from miceadds.

santsang avatar santsang commented on September 26, 2024

Thanks Alex for offering help. I have sent a subset of pseudo data to the email address you stated in the vignette. I bet it would be okay to discuss the reason to benefit everyone here. I guess the reason is about setting factor... and so.

from miceadds.

santsang avatar santsang commented on September 26, 2024

Hi Alex

Here are the settings:

(ini <- mice(dat, maxit = 0)) 
(pred<-ini$pred)
(pred[,]<-0)
pred[,"id"]<-(-2)
pred["outcome","id"]<-(-2)
pred["outcome",-c(1,3)]<-1
pred["outcome",c("strataIV","time")]<-0
(meth<-ini$meth)
meth[c("outcome")] <- "2l.pmm"

BTW, you may also be interested to know that parlmice() "could not found" mice.impute.2l.pmm. I then resolved the problem with doRNG.

Many thanks for your help.

Sandro

from miceadds.

alexanderrobitzsch avatar alexanderrobitzsch commented on September 26, 2024

I still do not see a model which includes the method mice.impute.bygroup which was meant to cause a problem. Please provide a full script and complete information. It is important to minimize the amount of time for coping with possible problems by always giving the information as requested. This means code, data (or some subdataset) should be provided which EXACTLY reproduces the bug for which you are requesting help.

BTW, you may also be interested to know that parlmice() "could not found" mice.impute.2l.pmm. I
then resolved the problem with doRNG.

I think that is unrelated to mice.impute.2l.pmm. Again, provide a reproducible example if you think that is really an issue.

from miceadds.

santsang avatar santsang commented on September 26, 2024

Hi Alex

Thank you very much for you reply.

According to the documentation, I would imagine that the rest of the codes should be:

meth["outcome"] <- "bygroup"
# by initial specification of meth become redundant
group <- list( "outcome"="strataIV" )
imputationFunction <- list("outcome"="2l.pmm" )

imp <- mice::mice( dat, meth=meth, pred=pred,
            m=20, maxit=24, group=group, imputationFunction=imputationFunction )

Perhaps you may direct me the right coding...

Sandro

from miceadds.

alexanderrobitzsch avatar alexanderrobitzsch commented on September 26, 2024

I think that the issue was a mixture of problems. The warning message was caused by the fact that the grouping variable was not included in the predictorMatrix with a 1 entry. I changed this requirement in the recent update. Moreover, make sure that you do not include multicollinear predictors. The syntax now runs with the recent miceadds version.

dat <- utils::read.table( "miceGroup.csv", sep=";", dec=".", header=TRUE)

ini <- mice(dat, maxit = 0)
pred<-ini$pred
(pred[,]<-0)
pred[,"id"]<-(-2)
pred["outcome","id"]<-(-2)
pred["outcome",-c(1,3)]<-1
pred["outcome",c("strataIV","time")]<-0
meth<-ini$meth
meth["outcome"] <- "bygroup"
group <- list( "outcome"="strataIV" )
imputationFunction <- list("outcome"="2l.pmm" )
# remove these columns to avoid multocollinearity of variables
pred[, c("gender","TX")] <- 0
# impute
imp <- mice::mice(dat, method=meth, predictorMatrix=pred, imputationFunction=imputationFunction,
                group=group, m=1, maxit=2)

from miceadds.

santsang avatar santsang commented on September 26, 2024

from miceadds.

Related Issues (20)

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.