similar to: Maximization problem in the optim function

Displaying 20 results from an estimated 300 matches similar to: "Maximization problem in the optim function"

2002 Jul 01
1
Substitutions in strings.
Hi all, Sorry to bother you with the potentially not too bright question, but since I cannot get it to work, I'll have to ask someone.. I've got this vector: > token [1] sal skal skal bak b_r d_ gal kal l_r n_r pak p_r [13] sal sl_r sn_r spak sp_r st_r s_ bak d_ gal l_r pak [25] p_r sak sl_r sp_r t_ kal n_r s_ st_r sak kal
2004 Sep 04
5
R question
Hi, Would you help me solve the following question? Thanks. Question: If I try to set the probability=0.05 and find the approximate x. (The answer should be somewhere between 2.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)
2012 Oct 03
2
Error in if (any(ch)) { : missing value where TRUE/FALSE needed
Can someone please help with the error message below? thanks! Start: AIC=-Inf value ~ 1 + Core_CPI__ + GDP_change + Unemployment + housing + interest + S_P + d1 + d2 + d3 Error in if (any(ch)) { : missing value where TRUE/FALSE needed In addition: Warning message: attempting model selection on an essentially perfect fit is nonsense
2000 Aug 31
2
Problem with R INSTALL locfit on DEC alphaev56-dec-osf4.0d
Dear all, usually I work under linux, but I tried to install R-1.1.1 on our alpha's which worked well. However, installation of the locfit package produced the following warning: ---------%<---------------- Installing package `locfit' ... libs /vol/bin/gcc -I/vol/math/R/include -I/usr/local/include -mieee -g -O2 -c S_e nter.c -o S_enter.o S_enter.c: In function `basis':
2017 Oct 02
0
Issues with 'Miwa' algorithm in mvtnorm package
Good point. Now this returns 0.04062184. Hmmm..... On Mon, Oct 2, 2017 at 6:30 PM, Hollie Johnson (PGR) < h.a.johnson at newcastle.ac.uk> wrote: > Hi Eric, > > > Thanks for having a look into this. I think you have a small typo... > > B <- matrix(x, nrow=3, byrow = TRUE) should read B <- matrix(y, nrow=3, > byrow = TRUE) > > > Regards, Hollie >
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
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]]
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
2017 Oct 02
0
Issues with 'Miwa' algorithm in mvtnorm package
Rather specialized. As this appears to be primarily a statistical, not an R programming question, you may do better posting on a statistical site like http://stats.stackexchange.com/ if you don't get a satisfactory reply here . Alternativey, if you think this is a package bug, perhaps contact the package maintainer directly, as (s)he may not monitor this list. -- Bert Bert Gunter
2009 Apr 19
1
help with this code
Hi, can anyone help me with the following code? Thanks! 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],
2012 Apr 19
3
Bivariate normal integral
hello, I'm trying to improve the speed of my calculation but didn't get to a satisfying result. It's about the numerical Integration of a bivariate normal distribution. The code I'm currently using x <- qnorm(seq(.Machine$double.xmin,c(1-2*.Machine$double.eps),by=0.01), mean=0,sd=1) rho <- 0.5 integral <- function(rho,x1){
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
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 <-
2009 Nov 20
2
Problem with Numerical derivatives (numDeriv) and mvtnorm
I'm trying to obtain numerical derivative of a probability computed with mvtnorm with respect to its parameters using grad() and jacobian() from NumDeriv. To simplify the matter, here is an example: PP1 <- function(p){ thetac <- p thetae <- 0.323340333 thetab <- -0.280970036 thetao <- 0.770768082 ssigma <- diag(4) ssigma[1,2] <- 0.229502120
2012 Oct 09
1
why does R stepAIC keep unsignificant variables?
Ran a bunch of variables in R and the final result of StepAIC is as below: Why are the first 5 variables kept in the stepwise result?? Are the last 4 variables finally chosen after Stepwise? Thanks Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1.315e-01 2.687e-01 0.490 0.63611 Core_CPI__ 1.290e-02 7.496e-03 1.721 0.11927 GDP_change -3.482e-03 2.075e-03 -1.678 0.12767
2010 Jun 18
1
question in R
Dear all, I am trying to calculate certain critical values from bivariate normal distribution (please see the function below). m <- 10 rho <- 0.1 k <- 2 alpha <- 0.05 ## calculate critical constants cc_z <- numeric(m) var <- matrix(c(1,rho,rho,1), nrow=2, ncol=2, byrow=T) for (i in 1:m){ if (i <= k) {cc_z[i] <- qmvnorm((k*(k-1))/(m*(m-1))*alpha,
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
2008 Feb 19
1
recursive function help
I'm trying to implement a recursive function using integrate, and I suspect I need a Vectorize somewhere, but I can't suss it out. Any help would be appreciated. I've tried traceback() and various debugging ideas to no avail (most likely due to my inexperience with these tools.) Here's what I have. Nk <- function(m, C) { if (length(m) > 1) { rho <- C[1, -1]
2006 Aug 21
2
polychor error
Hi. Does anyone know whether the following error is a result of a bug or a feature? I can eliminate the error by making ML=F, but I would like to see the values of the cut-points and their variance. tmp.vec<-c(0, 0, 0 , 0 ,0 , 1, 0, 2, 0 , 0, 5 ,5 ,3 ,1, 0 , 1, 5, 10, 27, 20, 9, 0, 1, 1, 12, 29, 57, 34, 0, 0, 1, 2, 11, 31, 32) tmp.mat<-matrix(tmp.vec, nrow=7)