Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

I tried to use the Kernel Density plot method from Hayfield and Racine (2008) np package for my own data, but somehow ended up with different type of plots and I have no idea what the difference is between my data and the example data provided by the package.

I used the Italy GDP example that is provided in the np package and described in Racine's primer. The example itself worked well and I ended up with a nice 3D plot.

When I used it with my own data I just got two 2D plots instead of one 3D plot. Why is that? Do I miss something content wise (that's what I think and it's the reason being why I guess this is rather a CV than a SO question) or is it a syntax problem?

# get a bandwith object
  bw2 <- npcdensbw(formula=mydf$values~ordered(mydf$datefield), tol=.1, ftol=.1) 
  str(mydf)
# returns
  data.frame':  780 obs. of  2 variables:
  $ datefield: Ord.factor w/ 104 levels "1984-04-01"<"1984-07-01"<..: 1 1 1 1 1 1 1 1 1     1 ...
      $ values : num  50.7 58.5 56.1 55.5 62.7 ...
tables(mydf$datefield)
# shows that I have 13 entries per quarter.

quartz()
plot(bw2)
npplot(bw2)
# same 2D plot for both :(

all of these properties are exactly in line with the example data. Still I get only 2D plots instead of a 3D plot. I do have three dimensions: quarters,values and conditional density. What's wrong?

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.