search for: pmvnorm

Displaying 20 results from an estimated 33 matches for "pmvnorm".

Did you mean: rmvnorm
2004 Sep 04
5
R question
....1782 and 2.1783.) I write about this R program as follows but I don¡¦t know how to get the value of x which is between 2.1782 and 2.1783. library(mvtnorm) value<-array(1000) a<-array(1000) a<-seq(2,3,by=0.001) for(i in 1000) { x<-a[i] value[i]<-2*(pmvnorm(lower=-Inf, upper=-x, mean=0, sigma=1)+ pmvnorm(lower=c(-x,-Inf),upper=c(x,-x),mean=0,corr=diag(2)*sqrt(0.5))) if(value[i]-0.05<0.001) print(x) } --------------------------------- [[alternative HTML version deleted]]
2005 May 14
1
pmvnorm
Hi there, pmvnorm(lo=c(-Inf,-Inf), up=c(Inf,Inf), mean=c(0,0) ) should give me "1", right? But it doens't - it giver me "0". Would someone help me, please? [[alternative HTML version deleted]]
2006 Sep 30
1
error from pmvnorm
Hi all, Can anyone tell me what the following error message means? " Error in mvt(lower = lower, upper = upper, df = 0, corr = corr, delta = mean, : NA/NaN/Inf in foreign function call (arg 6)" It was generated when I used the 'pmvnorm' function in the 'mvtnorm' package. Thanks a lot. Yonghai Li
2017 Oct 02
0
Issues with 'Miwa' algorithm in mvtnorm package
..., 1.854*10^-8, 9.358*10^-3) > A <- matrix(x, nrow=3, byrow = TRUE) > > y <- c(9.358*10^-3, 1.854*10^-8, -1.689*10^-8, > 1.854*10^-8, 9.358*10^-3, -8.165*10^-3, > -1.689*10^-8, -8.165*10^-3, 9.358*10^-3) > > B <- matrix(x, nrow=3, byrow = TRUE) > > pmvnorm( > mean = rep(0, 3), > lower = rep(-Inf, 3), > upper = rep(0, 3), > sigma = A, > algorithm = 'Miwa' > ) [1] > > # -10.76096 <-- this is the output from the above command > > pmvnorm( > mean = rep(0, 3), > lower = rep(-Inf, 3), &gt...
2002 Mar 02
1
pmvnorm?
Dear all, The MASS library provides a mvrnorm function to generate random numbers from a multivariate normal distribution, similar to S-Plus's rmvnorm, but is there an R-equivalent to pmvnorm, which generates probabilities from a multivariate normal? With thanks, John Field -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]sub...
2017 Oct 02
5
Issues with 'Miwa' algorithm in mvtnorm package
Currently doing some work on local maxima on a random field and have encountered an issue with the Miwa algorithm used with the pmvnorm function in the mvtnorm R package. Based on recommendations by Mi et al., we ran the mvtnorm package using the Miwa algorithm, since we have a maximum of 4 dimensions with non-singular matrices. However, running the estimation procedure in this way, we obtained inconsistent results. For example, u...
2009 Apr 19
1
help with this code
...ks! library(mvtnorm) f2 <- function(n, rho) { var <- matrix(c(1,rho,rho,1), nrow=2, ncol=2, byrow=T) beta <- seq(0, 1, length.out=n+1) alpha <- sort (sapply(1-beta, qnorm)) x <- array(0, dim=c(n, n)) for (s in 1:n) { for (t in 1:n){ if (s>=t) x[s,t] <- pmvnorm(lower=c(alpha[s], alpha[t]),upper=c(alpha[s+1], alpha[t+1]), mean=c(0,0), corr=var)/(s*(s+1)) else x[s,t] <- pmvnorm(lower=c(alpha[s], alpha[t]),upper=c(alpha[s+1], alpha[t+1]), mean-c(0,0), corr=var)/(t*(t+1)) } } n*beta[2]-(n-1)*pmvnorm(lower=c(alpha[n-1],alpha[n-1]),...
2017 Oct 02
0
Issues with 'Miwa' algorithm in mvtnorm package
...eley Breathed in his "Bloom County" comic strip ) On Mon, Oct 2, 2017 at 5:16 AM, Hollie Johnson (PGR) < h.a.johnson at newcastle.ac.uk> wrote: > Currently doing some work on local maxima on a random field and have > encountered an issue with the Miwa algorithm used with the pmvnorm function > in the mvtnorm R package. > > Based on recommendations by Mi et al., we ran the mvtnorm package using > the Miwa algorithm, since we have a maximum of 4 dimensions with > non-singular matrices. However, running the estimation procedure in this > way, we obtained inconsi...
2003 Nov 04
3
interfacing C into R and R packages
Hi, I would like to interface a C code into R. Is it possible to use in the C code, functions from a R package (for instance, to use pmvnorm within loops in the C code and to call the result in a R function)? Nathalie
2007 May 09
2
pvmnorm, error message
Hello there! My operating system is Windows XP, my version of R is the latest (R-2.5.0). Recently I have downloaded the package "mvtnorm" and a problem with the command "pmvnorm" occured. Trying to enter the lines ... A <- diag(3) A[1,2] <-0.5 A[1,3] <- 0.25 A[2,3] <- 0.5 pvmnorm(lower=c(-Inf,-Inf,-Inf), upper=c(2,2,2),mean = c(0,0,0), corr=A) I got the following error message: .Fortran("mvtdst", N = as.integer(n), NU=as.integer(df), lower = a...
2012 Apr 19
3
Bivariate normal integral
...<- function(rho,x1){ m1 <- length(x1)-1 integral <- matrix(0,ncol=m1,nrow=m1) for (i in c(1:m1)){ for (j in c(1:m1)){ integral[i,j] <- pmvnorm(lower=c(x1[i],x1[j]), upper=c( x1[c(i+1)], x1[c(j+1)]), corr=matrix(c(1,rho,rho,1),ncol=2)) } } return(integral)} integral(rho,x) I need all these values separated as in my calculation, but currently it's much too slow... Has a...
2017 Oct 02
0
Issues with 'Miwa' algorithm in mvtnorm package
...*10^-3, 1.854*10^-8, -1.689*10^-8, 1.854*10^-8, 9.358*10^-3) A <- matrix(x, nrow=3, byrow = TRUE) y <- c(9.358*10^-3, 1.854*10^-8, -1.689*10^-8, 1.854*10^-8, 9.358*10^-3, -8.165*10^-3, -1.689*10^-8, -8.165*10^-3, 9.358*10^-3) B <- matrix(x, nrow=3, byrow = TRUE) pmvnorm( mean = rep(0, 3), lower = rep(-Inf, 3), upper = rep(0, 3), sigma = A, algorithm = 'Miwa' ) [1] # -10.76096 <-- this is the output from the above command pmvnorm( mean = rep(0, 3), lower = rep(-Inf, 3), upper = rep(0, 3), sigma = B, algorithm = 'Miwa...
2010 Jun 18
1
question in R
...a=var)$quantile} else {cc_z[i] <- qmvnorm((k*(k-1))/((m-i+k)*(m-i+k-1))*alpha, tail="upper", sigma=var)$quantile} } After the critical constants cc_z is calculated, I wanted to check whether they are correct. > ##check whether cc_z is correct > pmvnorm(lower=c(cc_z[1], cc_z[1]), upper=Inf,sigma=var)-(k*(k-1))/(n*(n-1)) [1] 0.001111025 attr(,"error") [1] 1e-15 attr(,"msg") [1] "Normal Completion" > pmvnorm(lower=c(cc_z[3], cc_z[3]), upper=Inf,sigma=var)-(k*(k-1))/((n-1)*(n-2)) [1] 0.001388974 attr(,"error&qu...
2007 Jul 07
2
No convergence using ADAPT
I am trying calculate a probability using numerical integration. The first program I ran spit out an answer in a very short time. The program is below: ## START PROGRAM trial <- function(input) { pmvnorm(lower = c(0,0), upper = c(2, 2), mean = input, sigma = matrix(c(.1, 0, 0, .1), nrow = 2, ncol = 2, byrow = FALSE)) } require(mvtnorm) require(adapt) bottomB <- -5*sqrt(.1) topB <- 2 + 5*sqrt(.1) areaB <- (topB - bottomB)^2 unscaled.Po.in.a <- adapt(2, lo = c(bottomB, bottomB), up =...
2012 Mar 14
2
Maximization problem in the optim function
Dear R Users I am maximizing a user defined log likelihood function. It includes variance parameter (sigma). I used R function optim with BFGS maximization method. However, it stops before the solution saying ?sqrt(sigma): NaNs produced? Could anybody know a proper transformation for sigma which can be passed in the function? For the correlation parameter I used Fishers? transformation so it
2009 Nov 20
2
Problem with Numerical derivatives (numDeriv) and mvtnorm
...0.784263100 ssigma[2,4] <- 0.374065025 ssigma[3,4] <- 0.799238700 ssigma[2,1] <- ssigma[1,2] ssigma[3,1] <- ssigma[1,3] ssigma[4,1] <- ssigma[1,4] ssigma[3,2] <- ssigma[2,3] ssigma[4,2] <- ssigma[2,4] ssigma[4,3] <- ssigma[3,4] pp1 <- pmvnorm(lower=c(-Inf,-Inf,-Inf,-Inf),upper=c(thetac,thetae,thetab,thetao),corr=ssigma) return(pp1)} xx <- -0.6675762 If I compute several times the probability PP1, i obtain some slightly different numbers but I suppose this is ok: > PP1(xx) [1] 0.1697787 attr(,"error") [1] 0.000840...
2005 Sep 28
1
R-code for binormla distribution
Dear users, does any one have a code (S or R) to compute the binormal distribution (or the upper its quadrant area) other than the pmvnorm. Thanks -- Nabil Channouf etudiant en Ph.D. Bureau 3733 Departement d'Informatique et de Recherche Operationnelle (D.I.R.O.) Universite de Montreal, C.P. 6128, succ. Centre-Ville, Montreal, H3C 3J7 Tel.: (514) 343-6111, poste 1796 Fax.: (514) 343-5834 courriel: channoun at iro.umontreal.ca
2012 Feb 10
0
clustering and the region of integration
...NA11994 NA12044 NA12056 NA12057 NA12891 NA12892 1.668749e+01 1.588963e+01 5.913443e+00 2.924297e+01 1.765777e+01 7.935129e+00 Next, what I would like to do is to calculate the pvalue for each point, which was assigned to particular cluster. In order to do this i'm using pmvnorm function, but I found it difficult to set the region of integration. As I understand to get the probability of cluster membership I should define how 'far' from the cluster mean is my point. However, I've got 2d dataset and my mean is also 2d: [1,] [2,] 1.348992 1.2695...
2008 Oct 01
2
Bivariate normal
Package mvtnorm provides dmvnorm, pmvnorm that can be used to compute Pr(X=x,Y=y) and Pr(X<x,Y<y) for a bivariate normal. Are there functions that would compute Pr(X<x,Y=y)? I'm currently using "integrate" with dmvnorm but it is too slow.
2012 Jul 27
3
bivariate normal
Dear list members I need a function that calculates the bivariate normal distribution for each observation. It is part of a likelihood function and I have 1000's of cases. As I understand it I cannot use packages like "mvtnorm" because it requres a covariance matrix of the same dimension as the number of observations. Basically what I need is a function that takes as arguments a