Displaying 20 results from an estimated 12000 matches similar to: "R-beta: S Compatibility (again)"
2011 Jan 16
3
rootogram for normal distributions
Using R-2.12.1 and latticeExtra-0.6-14, I would like to understand
why a rootogram displaying samples from the Poisson distribution looks like I
expected it, whereas a rootogram using the normal distribution does not:
library(latticeExtra)
rootogram(~rpois(1000, lambda = 50), dfun = function(x) dpois(x, lambda = 50))
rootogram(~rnorm(1000), dfun = function(x) dnorm(x,mean(x),sd(x)))
I
2005 Dec 23
2
convolution of the double exponential distribution
Is there any R function that computes the convolution of the double
exponential distribution?
If not, is there a good way to integrate ((q+x)^n)*exp(-2x) over x from
0 to Inf for any value of q and for any positive integer n? I need to
perform the integration within a function with q and n as arguments. The
function integrate() is giving me this message:
"evaluation of function gave a
2011 May 30
1
Error in minimizing an integrand using optim
Hi,
Am not sure if my code itself is correct. Here's what am trying to do:
Minimize integration of a function of gaussian distributed variable 'x' over
the interval qnorm(0.999) to Inf by changing value of parameter 'mu'. mu is
the shift in mean of 'x'.
Code:
# x follows gaussian distribution
# fx2 to be minimized by changing values of mu
# integration to be done over
2008 Aug 21
1
pnmath compilation failure; dylib issue?
(1) ...need to speed up a monte-carlo sampling...any suggestions about
how I can get R to use all 8 cores of a mac pro would be most useful
and very appreciated...
(2) spent the last few hours trying to get pnmath to compile under os-
x 10.5.4...
using gcc version 4.2.1 (Apple Inc. build 5553) as downloaded from
CRAN, xcode 3.0...
...xcode 3.1 installed over top of above after
2007 Jan 12
1
incorrect result of deriv (PR#9449)
Full_Name: Joerg Polzehl
Version: 2.3.1
OS: x86_64, linux-gnu
Submission from: (NULL) (62.141.176.22)
I observed an incorrect behavior of function deriv when evaluating arguments of
dnorm
deriv(~dnorm(z,0,s),"z")
expression({
.value <- dnorm(z, 0, s)
.grad <- array(0, c(length(.value), 1), list(NULL, c("z")))
.grad[, "z"] <- -(z * dnorm(z))
2007 Oct 26
5
help
hello,
please can anyone help me out. Am a new user of R
program. Am having problem
with this code below, not getting the expected
results.
1. Each m, the cumulative sum should be 1.000 but the
2nd and 3rd m returned 2.000 and 3.000
instead of 1.000.
2. to get the LCL(m) and UCL(m) for each m base on
these instructions
if out.cum > 0.025 then LCL(m)= y-1
if out.cum >0.975
2002 Aug 06
1
Questions about lexical scope
Dear R-users,
The numerical integration example given in Gentleman and Ihaka (2000),
"Lexical Scope and Statistical Computing," JCGS, 9, 491-508,
is very interesting and helpful in understanding how lexical scope
is about.
However, I got some questions that I just can't figure out.
First all, allow me to copy the two functions given by the authors:
midpoint <- function(f, a,
2006 Jul 02
1
workaround for numeric problems
Dear R-people,
I have to compute
C - -(pnorm(B)*dnorm(B)*B + dnorm(B)^2)/pnorm(B)^2
This expression seems to be converging to -1 if B approaches to -Inf
(although I am unable to prove it). R has no problems until B equals
around -28 or less, where both numerator and denominator go to 0 and
you get NaN. A simple workaround I did was
C <- ifelse(B > -25,
-(pnorm(B)*dnorm(B)*B
2007 Sep 13
2
Reciprocal Mill's Ratio
I believe that this may be more appropriate here in r-devel than in r-help.
The normal hazard function, or reciprocal Mill's Ratio, may be obtained
in R as dnorm(z)/(1 - pnorm(z)) or, better, as dnorm(z)/pnorm(-z) for
small values of z. The latter formula breaks dowm numerically for me
(running R 2.4.1 under Windows XP 5.1 SP 2) for values of z near 37.4
or greater.
Looking at the pnorm
2010 Jun 13
2
help with R
Hi all,
I want to solve the following equation for x with rho <- 0.5
pnorm(-x)*pnorm((rho*dnorm(x)/pnorm(x)-x)/sqrt(1-rho^2))==0.05
Is there a function in R to do this?
Thank you very much!
Hannah
[[alternative HTML version deleted]]
2004 May 05
4
Discontinuities in a simple graph (machine precision?)
Hi,
I've got an ugly but fairly simple function:
mdevstdev <- function(a){
l <- dnorm(a)/(1-pnorm(a))
integrand <- function(z)(abs(z-l)*dnorm(z))
inted <- integrate(integrand, a, Inf)
inted[[1]]/((1- pnorm(a))*sqrt((1 + a*l - l^2)))
}
I wanted to quickly produce a graph of this over the range [-3,3] so I
used:
plotit <-function(x=seq(-3,3,0.01),...){
2007 Jan 21
5
Integration + Normal Distribution + Directory Browsing Processing Questions
Hi everyone,
I am new to R, but it's really great and helped me a lot!
But now I have 2 questions. It would be great, if someone can help me:
1. I want to integrate a normal distribution, given a median and sd.
The integrate function works great BUT the first argument has to be a
function
so I do integrate(dnorm,0,1) and it works with standard m. and sd.
But I have the m and sd given.
2002 Feb 13
3
pnorm, relative accuracy in the tails
Dear R people
The function below should be decreasing, convex, and tend to zero when x
tends to infinity.
curve((1-pnorm(x))/dnorm(x),from=0, to=9)
>From the plot we see that for x between 8.0 and 8.3 the function is
fluctuating.
As far as I understand, this is due to the function pnorm() not being
sufficiently accurate in the tails.
I am using pnorm() in a way that has probably not been
2013 Jan 30
2
Integration of mixed normal distribution
Hi,
I already found a conversation on the integration of a normal
distribution and two
suggested solutions
(https://stat.ethz.ch/pipermail/r-help/2007-January/124008.html):
1) integrate(dnorm, 0,1, mean = 0, sd = 1.2)
and
2) pnorm(1, mean = 0, sd = 1.2) - pnorm(0, mean = 0, sd = 1.2)
where the pnorm-approach is supposed to be faster and with higher precision.
I want to integrate a mixed
2010 Nov 11
2
Kolmogorov Smirnov Test
I'm using ks.test (mydata, dnorm) on my data. I know some of my
different variable samples (mydata1, mydata2, etc) must be normally
distributed but the p value is always < 2.0^-16 (the 2.0 can change
but not the exponent).
I want to test mydata against a normal distribution. What could I be
doing wrong?
I tried instead using rnorm to create a normal distribution: y = rnorm
2003 Mar 31
2
point-biserial correlation
Dear list,
has anyone written a package/function in R for computing a point-
biserial resp. biserial correlation?
Thanks in advance
Bernd
2006 Jan 25
4
D(dnorm...)?
Can someone help me understand the following:
> D(expression(dnorm(x, mean)), "mean")
[1] 0
> sessionInfo()
R version 2.2.1, 2005-12-20, i386-pc-mingw32
attached base packages:
[1] "methods" "stats" "graphics" "grDevices" "utils" "datasets"
[7] "base"
By my computations, this should be
2004 Jul 08
1
(PR#7070)
> version
_
platform i686-pc-linux-gnu
arch i686
os linux-gnu
system i686, linux-gnu
status
major 1
minor 7.1
year 2003
month 06
day 16
language R
Bug:
integrate(f,lower,upper,extra_args)
where
f <- function(x,extra_args)
{
body
}
integrate doesn't pass the extra arguments when calling f.
As a first check of this finding I integrated dnorm from
2010 Nov 12
4
dnorm and qnorm
Hello all,
I have a question about basic statistics. Given a PDF value of 0.328161,
how can I find out the value of -0.625 in R? It is like reversing the dnorm
function but I do not know how to do it in R.
> pdf.xb <- dnorm(-0.625)
> pdf.xb
[1] 0.328161
> qnorm(pdf.xb)
[1] -0.444997
> pnorm(pdf.xb)
[1] 0.628605
Many thanks,
Edwin
--
View this message in context:
2011 Nov 23
2
How to increase precision to handle very low P-values
Hello, Rlisters
I have to compute p-values that are on the tail of the distribution,
P-values < 10^-20.
However, my current implementations enable one to estimate P-values up to
10^-12, or so.
A typical example is found below, where t is my critical value.
########### example - code adapted from Rassoc #######################
rho01 = 0.5
rho105 = 0.5
rho005 = 0.5
t = 8
z = 2