search for: ncp1

Displaying 2 results from an estimated 2 matches for "ncp1".

Did you mean: cp1
2012 Jun 22
4
Uniroot error message with in intergration
...h 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 [-Inf,Inf] ## df == degree of freedom ###p <- p value diff <- 0.5 y <- function(t,n){ df <- 2*n-2 ncp1 <- sqrt((diff^2*n)/2) p <- 1- pt(t,df=df1) test <- qt((1-p),df=df1,ncp=ncp1)*(1/sqrt(2)) return(test) } integ <- function(t,n){ 1-integrate(y,lower=0,upper=3.6,n)$value -0.5 } uniroot(integ,lower=0,upper=1000) -- View this message in context: http://r.789695.n4.nabble.com/Uniroot...
2006 Jul 01
1
noncentral F-distributed random numbers (PR#9055)
...n, df1, df2)) else rchisq(n, df1, ncp = ncp)/rchisq(n, df2) } <environment: namespace:stats> where I believe both the numerator and the denominator should be divided by their corresponding degrees of freedom. My suggested (slighly augmented) version is: > rf= function (n, df1, df2, ncp1 = 0, ncp2=0) { if (ncp1 == 0 && ncp2==0) .Internal(rf(n, df1, df2)) else if (ncp2==0) (rchisq(n, df1, ncp = ncp1)/df1)/(rchisq(n, df2)/df2) else (rchisq(n, df1, ncp = ncp1)/df1)/(rchisq(n, df2, ncp=ncp2)/df2) } which incorporated both singly and doubly no...