Here are 2 approaches:
Use logspline density estimates (logspline package) rather than kernel
density estimates, this can give you a function to pass to integrate
or other tools, the estimates may be a little different from the
kernel density estimates.
If you need to use kernel density estimates
Hello,
Maybe the link below is of some use.
http://stats.stackexchange.com/questions/14061/area-under-the-pdf-in-kernel-density-estimation-in-r
Hope this helps,
Rui Barradas
Em 27-06-2012 01:13, pilaw escreveu:
Hello,
I need density function so that I can find expected value (using
integra
I didn't try out your extensive code, but here's one potentially serious
problem:
You only pass two arguments to f(), alpha and h, but within f you nonetheless
use x1 and y and several other things. This is bad practice, and dangerous:
you should pass all the necessary arguments to f(), not rely o
Sorry that was my poor copying and pasting. Here's the correct R code. The
problem does seem to be with the function I define as f.
# Model selection example in a bayesian framework
# two competiting non-nested models
# M0: y_t = alpha * x1^2 + e_t
# M1: y_t = beta * x1^4 + e_t
# where e_t ~ iidN(
On Dec 3, 2011, at 5:42 PM, napps22 wrote:
Dear R users,
I'm trying to carry out monte carlo integration of a posterior density
function which is the product of a normal and a gamma distribution.
The
problem I have is that the density function always returns 0. How
can I
solve this proble
On Sep 8, 2011, at 19:03 , Albyn Jones wrote:
> Look at
>
>area <- sum(a$y)*(a$x[1]-a$y[2])
>
> The problem appears to be "a$x[1]-a$y[2]"; that is not the length of
> the base of an approximating rectangle, whatever it is :-)
I would assume that that is just a typo for a$x[1]-a$x[2], which
Is your "data" supposed to be observations, or values of the density
of the underlying law?
Also, could you explain the rationale behind :
sum(a$y)*(a$x[1]-a$y[2])
because it is not immediately clear to the reader.
2011/9/8 Gonçalo Ferraz :
> Hi, I have a vector 'data' of 58 probability values (b
Look at
area <- sum(a$y)*(a$x[1]-a$y[2])
The problem appears to be "a$x[1]-a$y[2]"; that is not the length of
the base of an approximating rectangle, whatever it is :-)
albyn
On Thu, Sep 08, 2011 at 11:36:23AM -0400, Gonçalo Ferraz wrote:
> Hi, I have a vector 'data' of 58 probability value
For bounded density estimation look at the logspline package instead of the
regular density function.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-hel
On Aug 31, 2011, at 1:04 PM, alex46...@yahoo.com wrote:
Hi, there,
I found density function cannot work well on UNIX.R
version 2.13.1 (2011-07-08), Platform: i386-pc-solaris2.10 (32-bit)
Here is an example from R doucments which can work well on other
version.
plot(density(c(-20,rep(0,98
Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
From: mailingl...@sturaro.net [mailto:mailingl...@sturaro.net]
On Behalf Of Nicola Sturaro Sommacal (Quantide srl)
Sent: Thursday, November 04, 2010 2:36 AM
To: William Dunlap
Subject: R
--
> > From: r-help-boun...@r-project.org
> > [mailto:r-help-boun...@r-project.org] On Behalf Of Nicola
> > Sturaro Sommacal (Quantide srl)
> > Sent: Wednesday, November 03, 2010 3:34 AM
> > To: Joshua Wiley
> > Cc: r-help@r-project.org
> > Subject: Re: [R] dens
; [mailto:r-help-boun...@r-project.org] On Behalf Of Nicola
> > Sturaro Sommacal (Quantide srl)
> > Sent: Wednesday, November 03, 2010 3:34 AM
> > To: Joshua Wiley
> > Cc: r-help@r-project.org
> > Subject: Re: [R] density() function: differences with S-PLUS
>
Dear Joshua,
first of all, thank you very much for reply. I hoped that someone who's
familiar with both S+ and R can reply to me, because I spent some hours to
looking for a solution.
If someone else would try, this is the SPLUS code and output, while below
there is the R code. I obtain the same
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Nicola
> Sturaro Sommacal (Quantide srl)
> Sent: Tuesday, November 02, 2010 3:05 AM
> To: r-help@r-project.org
> Subject: [R] density() function: differences with S-PLUS
>
> Hel
Dear Nicola,
There are undoubtedly people here who are familiar with both S+ and R,
but they may not always be around or get to every question. In that
case there are (at least) two good options for you:
1) Say what you want mathematically (something of a universal
language) or statistically
2)
16 matches
Mail list logo