Re: [R] Getting a cdf equal to 1 from a variable kernel density estimation

2015-05-27 Thread Daniel Nordlund
On 5/27/2015 2:43 AM, Lionel Delmas wrote: When I integrate the variable kernel density estimation of a sample from -inf to inf, I should get 1. But it is not what I get with my code below. I find a value higher than 2. How can I fix this? n<-1000 df <- data.frame(x=unlist(lapply(1, function(i)

[R] Getting a cdf equal to 1 from a variable kernel density estimation

2015-05-27 Thread Lionel Delmas
When I integrate the variable kernel density estimation of a sample from -inf to inf, I should get 1. But it is not what I get with my code below. I find a value higher than 2. How can I fix this? n<-1000 df <- data.frame(x=unlist(lapply(1, function(i) rnorm(n, 0,sd=1 df<-as.data.frame(df[orde