similar to: workaround for numeric problems

Displaying 20 results from an estimated 6000 matches similar to: "workaround for numeric problems"

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
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]]
2009 May 16
1
maxLik pakage
Hi all; I recently have been used 'maxLik' function for maximizing G2StNV178 function with gradient function gradlik; for receiving this goal, I write the following program; but I have been seen an error  in calling gradient  function; The maxLik function can't enter gradlik function (definition of gradient function); I guess my mistake is in line ******** ,that the vector  ‘h’ is
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
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),...){
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
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
2010 Jul 05
3
data.frame: adding a column that is based on ranges of values in another column
Dear List, I've been looking tirelessly for a solution to this dilemma but without success. Perhaps someone has an idea that will guide me in the right direction. Suppose I have the following data.frame: DF = data.frame(X = c(114.5508, 114.6468, 114.6596, 114.6957, 114.6828, 114.8903, 114.9519, 114.8842, 114.8579, 114.8489), Y = c(47.14094, 46.98874, 46.91235, 46.88265, 46.80584, 46.67022,
2009 Aug 07
1
Gauss-Laguerre using statmod
I believe this may be more related to analysis than it is to R, per se. Suppose I have the following function that I wish to integrate: ff <- function(x) pnorm((x - m)/sigma) * dnorm(x, observed, sigma) Then, given the parameters: mu <- 300 sigma <- 50 m <- 250 target <- 200 sigma_i <- 50 I can use the function integrate as: > integrate(ff, lower= -Inf, upper=target)
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 Apr 20
1
What to do with positive likelihoods
Hi all, I'll preface this with saying I've gone through the archives, and am still in need of some help. I've been using this likelihood model with mean = 0 and s.d. = sqrt( (c + ( 1 / N1 ) + ( 1 / N2 ) ) * x * ( 1 - x )), where c is a genetic drift parameter (usually very small, like between .005 - .001), N1 and N2 are my population sizes (~200), and x is a value between 0 and 1.
2013 Jan 01
1
Behavior or as.environment in function arguments/call (and force() behaviors...)
Happy 2013! Can someone with more knowledge of edge case scoping/eval rules explain what is happening below? Happens in all the versions of R I have on hand. Behavior itself is confusing, but ?as.environment also provides no clue. The term used in that doc is 'search list', which is ambiguous, but the see also section mentions search(), so I would *think* that is what is intended.
2006 Jun 22
2
weights in lm, glm (PR#9023)
Full_Name: James Signorovitch Version: 2.2.1 OS: WinXP Submission from: (NULL) (134.174.182.203) In the code below, fn1() and fn2() fail with the messages given in the comments. Strangely, fn2() fails for all data sets I've tried except for those with 100 rows. The same errors occur if glm() is used in place of lm(), or if R 2.1.1 is used on a unix system. Thanks for looking into this.
2005 Mar 09
3
problem using uniroot with integrate
Hi, I'm trying to calculate the value of the variable, dp, below, in the argument to the integral of dnorm(x-dp) * pnorm(x)^(m-1). This corresponds to the estimate of the sensitivity of an observer in an m-alternative forced choice experiment, given the probability of a correct response, Pc, a Gaussian assumption for the noise and no bias. The function that I wrote below gives me an error:
2008 Apr 23
3
[LLVMdev] Compile units in debugging intrinsics / globals
I have a question about the llvm debugging records, especially wrt compile units. In the non-LLVM sense, a compile unit is essentially everything contained within a single .o file, and it is derived from one or more source and header files. Included in a compile unit are functions and global data. Dwarf records refer to compile units in the same way: a compile unit record has children which
2011 May 09
2
Vectorizing a function: what does it mean?
Dear all, I would really appreciate if somebody can help me to understand what does the phrase "Vectorize your function" mean? And what is the job of Vectorize() function in doing that? I have read many threads where experts suggest to Vectorize the function, which will speed up entire calculation (and more elegant ofcourse.) I used to think that vectorizing function means, to create a
2008 Apr 24
0
[LLVMdev] Compile units in debugging intrinsics / globals
Hi, > Suppose I have the following source: > > file1: > #include "file2" > #include "file3" > int fn1(void) ... > > file2: > int a; > > file3: > int fn2(void) ... > > then fn1, along with all the base types etc appear to be in compile unit > "file1", the variable a appears to be in compile unit
2016 Dec 15
2
distinct DISubprograms hindering sharing inlined subprogram descriptions
On Thu, Dec 15, 2016 at 1:30 PM Teresa Johnson <tejohnson at google.com> wrote: On Thu, Dec 15, 2016 at 11:38 AM, David Blaikie <dblaikie at gmail.com> wrote: On Thu, Dec 15, 2016 at 11:26 AM Teresa Johnson <tejohnson at google.com> wrote: Trying to wrap my brain around this, so a few questions below. =) Sure thing - sorry, did assume a bit too much arcane context here.
2016 Dec 16
0
distinct DISubprograms hindering sharing inlined subprogram descriptions
On Thu, Dec 15, 2016 at 2:08 PM, David Blaikie <dblaikie at gmail.com> wrote: > On Thu, Dec 15, 2016 at 1:30 PM Teresa Johnson <tejohnson at google.com> > wrote: > > On Thu, Dec 15, 2016 at 11:38 AM, David Blaikie <dblaikie at gmail.com> > wrote: > > > > On Thu, Dec 15, 2016 at 11:26 AM Teresa Johnson <tejohnson at google.com> > wrote: >