Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8520285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:29:28+00:00 2026-06-11T06:29:28+00:00

I am using the mice package to obtain completed data. I believe the problem

  • 0

I am using the mice package to obtain completed data.
I believe the problem is that I am not doing imputations for all the data, and so some of them have NAs. (some variables with missing data are used simply to predict missingness in others so I don’t want to impute those.

I can duplicate the problem with this code:

require(mice)
impute <- mice(
    nhanes, 
    imputationMethod = c(
        "",        # age
        "pmm",     # bmi
        "pmm",  # hyp
        ""         # chl
    ),
    seed = 101)
x11()
densityplot(impute)

Error in density.default(x = c(NA_real_, NA_real_, NA_real_, NA_real_,  : 
  need at least 2 points to select a bandwidth automatically

How can I get the densityplots ? If I replace the "" with "pmm" for chl or just run impute <- mice(nhanes) then it will work with this example, to produce this:
enter image description here

but I can’t do that with my own data, so I’m looking for another way….just to get the
density plots for bmi and hyp, after running mice with my code above which does not impute values for chl

Edit:
I know I can use the methods in the answer to my earlier question using ggplot, but in this case I really need to work with densityplot

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T06:29:30+00:00Added an answer on June 11, 2026 at 6:29 am

    You will still have a large number of missing data in the ‘chl’-column. You could use the pkg:mice function complete to pull together the original non-missing and the imputed values. But the densityplot.mids function will do it if you reverse the roles of data and formula as (eventually) described in the Details of the help page.

    densityplot( x=impute , data= ~ bmi+hyp)
    

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Android TelephonyManager an application can obtain the state of data activity over the
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using the Redis info command, I am able to get all the stats of
I'm using this TCanvas to draw cursors for my mice Canv := TCanvas.Create; Canv.Handle
Using mercurial, I've run into an odd problem where a line from one committer
The problem I am facing is that I have a glx based application that
Using Qt Creator, I have set a QWidget's background property to black. However, some
Using report builder 3.0, I have a report that queries a cube. How do
Using Entity Framework CodeFirst, how do I create a created datetime column that gets
Using ASP.NET MVC there are situations (such as form submission) that may require a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.