similar to: Question on density values obtained from kde2d() from package MASS

Displaying 20 results from an estimated 200 matches similar to: "Question on density values obtained from kde2d() from package MASS"

2007 Aug 10
1
kde2d error message
Hello! I am trying to do a smooth with the kde2d function, and I'm getting an error message about NAs. Does anyone have any suggestions? Does this function not do well with NAs in general? fit <- kde2d(X, Y, n=100,lims=c(range(X),range(Y))) Error in if (from == to || length.out < 2) by <- 1 : missing value where TRUE/FALSE needed Thanks in advance!! Jen [[alternative
2009 Dec 02
2
Joint density kde2d works improperly?
Dear all, Please, look at the following code: attach(geyser) f1 <- kde2d(duration, waiting, n = 5) a <- 0 for (i in 1:5){ for (j in 1:5){ a <- a + f1$z[i,j] } } As far as I understood from Help kde2d returns matrix elements of which are values of joint probability mass function Pr(X=x,Y=y) therefore, sum of its elements should sum to 1. Which is not the case from my check. Where is
2008 Oct 04
0
difference between sm.density() and kde2d()
Dear R users, I used sm.density function in the sm package and kde2d() in the MASS package to estimate the bivariate density. Then I calculated the Kullback leibler divergence meassure between a distribution and the each of the estimated densities, but the asnwers are different. Is there any difference between the kde2d and sm.density estimates? if there is a difference, then which is the best
2005 Jan 14
1
kde2d and borders
Hallo, I want to use kde2d to visualize data on a sphere given in spherical coordinates. Now the problem is, that "phi == 2*pi = 0", so in principal I have to connect (in a graphical view) the left and right border of my plot (and the bottom and top). Has anyone any idea how to do that ? Thanks, Manuel -- ------------------------------------- Manuel Metz Sternwarte der
2006 Jan 19
2
function kde2d
Good evening, I am Marta Colombo, student at Milan's Politecnico. Thank you very much for your kindness, this mailing list is really useful. I am using the function kde2d for two-dimensional kernel density estimation and I'd like to know something more about this kind of density estimator. In particular I'd like to know: what bandwidth is used ? Thank you in advance for your attention
2007 Jun 07
0
How to get the number of modes using kde2d
Hi, The silverman's paper introduction offer how to find a mode for one dimensional data based on software http://www.stanford.edu/~kasparr/software/silverman.r, for two dimensional data I use kde2d to smooth it out first, then I get a matrix of densities for all the X(one dimension) cross Y(another dimension). I sort X and Y first before I pass the values to kde2d(x, y, c(hx, hy)), the
2007 May 04
1
Partitioning a kde2d into equal probability areas
Hi, I'd like to partition a 2d probability density function into regions of equal probability. It is straightforward in the 1d case, like qnorm(seq(0,1,length=5)) but for 2d I'd need more constraints. Any suggestions for how to approach this? Is seems like a spatial sampling problem but I'm not sure where to look. Thanks for your time, Dave -- Dr. David Forrest drf at
2012 Nov 03
6
Parámetros iniciales para ajustes no lineales
Hola a todos estoy aplicando la función polinómica de Hossfeld [1], y algunos otros modelos no lineales para tratar de ajustarlos a un grupo de datos forestales,   [1] Y= b*t*exp(c)/(t*exp(c)+a) Al colocar la función en R con parámetros estimados, me devuelve los siguiente: ## model1 <- nls(ho ~ (b*edad*exp(c)/(edad*exp(c)+a)), data=nigra,     start=list(a=0.005,b=0.08,c=-0.00006),
2011 Apr 10
5
Question about levels/as.numeric
Hi, I am still new to R and this is my first post on this mailing-list. I have two .csv (each one being a column of real numbers) coming from the same database (the first one is just longer than the second) and I read them in R the following way: returns <- read.csv("test.csv", header = FALSE) returns2 <- read.csv("test2.csv", header = FALSE) However, the two
2008 Jun 06
2
Why doesn't formatC( x, digits=2, format="g") doesn't always give 2 sig figs?
Hi all I am not a C programmer, but I am trying to understand formatC to get consistent printing of reals to a given number of significant digits. Can someone please explain this to me? These first three give what I expect on reading ?formatC: > formatC(0.0059999, digits=2,format="fg",flag="#") [1] "0.0060" > formatC(0.59999,
2006 Jun 14
1
Estimate region of highest probabilty density
Estimate region of highest probabilty density Dear R-community I have data consisting of x and y. To each pair (x,y) a z value (weight) is assigned. With kde2d I can estimate the densities on a regular grid and based on this make a contour plot (not considering the z-values). According to an earlier post in the list I adjusted the kde2d to kde2d.weighted (see code below) to estimate the
2004 Dec 02
1
Arrow and text on a 3d plot
I am currently working on surface plots (with R 2.0.1) and I want to improve the aspect of them. Having a typical 'cow-boy hat' surface [source: Spector (1994), p. 206]: pts <- seq(from = -8, to = 8, length = 50) cow <- function(x, y) { z <- sqrt(x^2+y^2) sin(z)/z } out <- outer(pts, pts, cow) sur <- persp(x=pts, y=pts, z=out, theta=45, phi=30) What I exactly wanted is:
2012 Apr 18
1
ggplot2 stat_density2d issue.
Hello, I'd be very grateful for help with some ggplot2's stat_density2d issues. First issue is with data limits. xlim() and ylim() doesn't seem to work; instead, estimates (and plotting) seems to be constrained to range(x), range(y) no matter what i do. The documentation says i can pass in kde2d's parameters to ... but pussing kde2d's "lims" parameter achieves
2006 Apr 23
3
bivariate weighted kernel density estimator
Is there code for bivariate kernel density estimation? For bivariate kernels there is kde2d in MASS kde2d.g in GRASS KernSur in GenKern (list probably incomplete) but none of them seems to accept a weight parameter (like density does since R 2.2.0) -- Erich Neuwirth, University of Vienna Faculty of Computer Science Computer Supported Didactics Working Group Visit our SunSITE at
2010 Feb 15
4
density estimates for fixed points
Problem: Based on a n x 2 data matrix i want a kernel estimate of the bivariate density. However, i also wish to specify wich points the density should be calculated at. I can offcourse just write the full kernel density estimate as a R-code, but surely there must already exist some package for this operation? The package density(), seems to create a new matrix (depending on n), where the
2007 May 04
2
Get the difference between two matrices with different length
Hello, I have got two matrices with different length. The matrices have 3 columuns. The first two are coordinates. The third is a measurement. Now I want to get a subtraction between every single value of the third column (between matrix1 and matrix2), but only if the two first coordinates in matrix1 and matrix2 are the same. I tried "FUN=?" in aggregate and ave, but I don't know
2008 Jun 25
1
confidence bounds using contour plot
Hello I'm trying to calculate 2d confindence bounds into a scatterplot using the function "kde2d" (package MASS) and a contour plot. I found a similar post providing a solution - unfortunatly I do not realy understand which data I have to use to calculated the named "quantile": Post URL: http://tolstoy.newcastle.edu.au/R/help/03b/5384.html > (...) > >> Is
2007 Nov 26
2
2d Joint Density Plot
Hi all, I'm fairly new to R, so I'm still trying to feel out what is available to me. I would like to be able to plot joint density in a two dimensional plot where density is indicated by color or darkness gradients, like a 2d color coded topographic map. Ideally, the output would be something I could then plot other points or lines on. Currently, I'm calculating joint density with
2015 Aug 22
2
a lld linker script bug
Hi, Thanks for your patch, Huang. It looks good to me. Just one comment: can you write a testcase, similar to the others used for linker script testing, with your example? Alternatively, you can modify lld/test/elf/linkerscript/sections-with-wildcards.test to test your case. This will make your patch complete and ready for commit, and will ensure we do not regress on this bug if this code is ever
2008 Oct 04
3
How to plot countours with fixted densities?
Hello, I used the following codes to generate bivariate normal dependence structure with unit Frechet margins. Sigma <- matrix(c(1,.5*sqrt(1),.5*sqrt(1),1),2,2) # generate y <- mvrnorm(Nsam, c(0,0), Sigma) # random v <- cbind(pnorm(y[,1],mean = 0, sd = 1), pnorm(y[,2],mean = 0, sd = 1)) z <- cbind(-1/log(v[,1]),-1/log(v[,2])) z1 <- z[,1] z2 <- z[,2] And to