similar to: fisher.test() in ctest or perhaps uniroot() (PR#455)

Displaying 20 results from an estimated 1000 matches similar to: "fisher.test() in ctest or perhaps uniroot() (PR#455)"

2009 Oct 16
1
How odds ratio is computed in fisher.test()?
I'm wondering how odds ratio is computed. I thought that it is (n11/n12)/(n21/n22), but it is not what fisher.test() computes. Could somebody let me know? > n11=3 > n12=1 > n21=1 > n22=3 > > n1_=n11+n12 > n2_=n21+n22 > > n_1=n11+n21 > n_2=n12+n22 > > x=rbind(c(n11,n12),c(n21,n22)) > > threshold=dhyper(n11,n1_,n2_,n_1) >
2012 Jun 22
4
Uniroot error message with in intergration
Dear all I am trying to calculate the value of n using uniroot. Here is the message I am having: <<< Error in uniroot(integ, lower = 0, upper = 1000, n) : 'interval' must be a vector of length 2 >>> Please would you be able to give me an indication on why I am having this error message. Many thanks EXAMPLE BELOW: ## t = statistics test from t -distribution
2003 Aug 30
3
fisher.test() gives wrong confidence interval (PR#4019)
The problem occurs when the sample odds ratio is Inf, such as in the following example. Given the fact that both upper bounds of the two 95% confidence intervals are Inf, I would have expected that the two lower bounds be equal, but they aren't. x <- matrix(c(9,4,0,2),2,2) x # [,1] [,2] #[1,] 9 0 #[2,] 4 2 rbind("two.sided.95CI"=fisher.test(x)$conf.int,
2003 Mar 08
2
Looking for non-central F quantile
Greetings all, I'm trying to figure out how to calculate the inverse CDF (i.e. a quantile) for a non-central F distribution. I could put together a quick numerical solver routine using the CDF, but I wonder if there's a function that I've missed that would be more efficient? Thank-you, Andrew Andrew Robinson Ph: 208 885 7115 Department of Forest Resources Fa: 208 885
2004 Aug 31
2
sample size for t-tests
Dear all, Could any one please tell me the exact formula R uses to calculate the sample size for one-sample and two-sample t-tests? Thanks, Caimiao [[alternative HTML version deleted]]
2001 Jan 09
2
quantile function for noncentral f-distribution
hello R-friends, I'm looking for a quantile function for the noncentral f-distribution in the area of equivalence hypotheses testing. Can somebody help me? Many thanks ----------------------------------------------------------------- Dipl. Inform. J. Hedderich Institut f?r Medizinische Informatik Phone : 0431 / 5973182 und Statistik im Klinikum an der CAU
2006 Mar 02
1
finding ncp for t distribution
Dear R-users, I am wondering whether R implements a function returning the non central parameter of a t distribution (equivalent of the TnoncT function from SAS), given /x/ a value from a t distribution, /df /the degrees of freedom and /p/ the probability of x under this distribution. Thanks a lot, Matthieu -- Matthieu Dubois, /Ph.D/. /Student/ Cognitive Neuroscience Unit, UCL,
2001 May 07
1
qt with ncp?
Does anybody has a function or idea how to calculate qt with a noncentrality parameter? I'm porting a SAS-macro for equivalence (Wellek, 1994 TT2ST) to R and it seems that I need this to calculate tinv (SAS-command, I hope that this is R's qt,...I get the SAS-macro manual next week). thanks Peter -- P.Malewski, Limmerstr.47, 30451 Hannover, 0511-2135008 At work:
2006 Dec 19
3
Bug in rt() ? (PR#9422)
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 <<insert bug report here>> Reproduced on Debian and Windows ... On 2.4.x if you execute set.seed(12345) t.1 <- rt(n = 1000, df = 20) set.seed(12345) t.2 <- rt(n = 1000, df = 20, ncp = 0) all.equal(t.1, t.2) ## Not close to true This appears to be due to the fact that in 2.4.x rt is now rt function (n, df, ncp = 0) { if
2012 Nov 01
1
What does uniroot return when an error occurs
Hi, I'm using the uniroot function, and would like to detect an error which occurs, for instance, when the values at endpoints are not of opposite signs. For example: uniroot( function(x) x^2+1, lower=1, upper=2 ). I want to say something like: if "error in uniroot(...)" return NA else return uniroot$root Thanks a lot! Asaf -- View this message in context:
2011 Apr 03
1
How do I modify uniroot function to return .0001 if error ?
I am calling the uniroot function from inside another function using these lines (last two lines of the function) : d <- uniroot(k, c(.001, 250), tol=.05) return(d$root) The problem is that on occasion there's a problem with the values I'm passing to uniroot. In those instances uniroot stops and sends a message that it can't calculate the root because f.upper * f.lower is greater
2008 Jun 14
1
qt with ncp>37.62
help(qt) states that: "ncp non-centrality parameter delta; currently except for rt(), only for abs(ncp) <= 37.62" so I would expect that calling qt with non-centrality parameter exceeding 37.62 should fail, instead e.g. calling > mapply(function(x) qt(p = 0.9, df = 55, ncp = x),35:45) gives: [1] 40.21448 41.35293 42.49164 43.68862 44.82945 45.97048 47.11170 48.25310 [9]
2011 Apr 02
1
uniroot speed and vectorization?
curiosity---given that vector operations are so much faster than scalar operations, would it make sense to make uniroot vectorized? if I read the uniroot docs correctly, uniroot() calls an external C routine which seems to be a scalar function. that must be slow. I am thinking a vectorized version would be useful for an example such as of <- function(x,a) ( log(x)+x+a ) uniroot( of, c(
2008 Dec 31
1
uniroot() problem
I have a strange problem with uniroot() function. Here is the result : > uniroot(th, c(-20, 20)) $root [1] 4.216521e-05 $f.root [1] 16.66423 $iter [1] 27 $estim.prec [1] 6.103516e-05 Pls forgive for not reproducing whole code, here my question is how "f.root" can be 16.66423? As it is finding root of a function, it must be near Zero. Am I missing something? -- View this message
2012 Apr 07
1
Uniroot error
Dear All I am trying to find a uniroot of a function within another function (see example) but I am getting an error message (f()values at end points not of opposite sign). I was wondering if you would be able to advise how redefine my function so that I can find the solution. In short my first function calculates the intergrale which is function of "t" , I need to find the uniroot of
2011 May 06
1
Uniroot - error
Hi, I have tried to use uniroot to solve a value (value a in my function) that gives f=0, and I repeat this process for 10000 times(stimulations). However error occures from the 4625th stimulation - Error in uniroot(f, c(0, 2), maxiter = 1000, tol = 0.001) : f() values at end points not of opposite sign I have also tried interval of (lower=min(U), upper=max(U)) and it won't work as well.
2011 Dec 14
1
uniroot function question
I have one equation, two unknowns, so I am trying to build the solution set by running through possible values for one unknown, and then using uniroot to solve for the accompanying second solution, then graphing the two vectors. p0 = .36 f = function(x) 0.29 * exp(5.66*(x - p0)) f.integral = integrate(f, p0, 1) p1 = p0 + .01 i = 1 n = (1 - p0)/.01 p1.vector = rep(0,n) p2.vector = rep(0,n) for (i
2007 Mar 29
1
ansari.test.default: bug in call to uniroot?
A recent message on ansari.test() prompted me to play with the examples. This doesn't work for me in R version 2.4.1 R> ansari.test(rnorm(100), rnorm(100, 0, 2), conf.int = TRUE) Error in uniroot(ab, srange, tol = 1e-04, zq = qnorm(alpha/2, lower = FALSE)) : object "ab" not found It looks like there's a small typo in ccia() inside ansari.test.default() in which
2006 Oct 27
1
making uniroot a bit more robust?
Hi, I wonder if it would make sense to make uniroot detect zeros at the endpoints, eg if f(lower)==0, return lower as the root, else if f(upper)==0, return upper as the root, else stop if f(upper)*f(lower) > 0 (currently it stops if >=), else proceed to the algorithm proper. Currently I am using a wrapper function to implement this, and I found it useful. But I didn't want to send a
2018 Aug 13
0
trace in uniroot() ?
I tend to avoid the the trace/verbose arguments for the various root finders and optimizers and instead use the trace function or otherwise modify the function handed to the operator. You can print or plot the arguments or save them. E.g., > trace(ff, print=FALSE, quote(cat("x=", deparse(x), "\n", sep=""))) [1] "ff" > ff0 <- uniroot(ff, c(0, 10))