search for: gmin

Displaying 20 results from an estimated 22 matches for "gmin".

Did you mean: gmfn
2007 Nov 10
1
polr() error message wrt optim() and vmmin
Hi, I'm getting an error message using polr(): Error in optim(start, fmin, gmin, method = "BFGS", hessian = Hess, ...) : initial value in 'vmmin' is not finite The outcome variable is ordinal and factored, and the independant variable is continuous. I've checked the source code for both polr() and optim() and can't find any variable called...
2005 Feb 20
1
logistic regression and 3PL model
...binomial logistic regression presented in MASS$ (p. 445): logitreg <- function(x, y, wt=rep(1, length(y)), intercept = T, start=rep(0,p), ...) { fmin <- function (beta, X, y, w){ p <- plogis(X %*% beta) -sum(2 * w * ifelse(y, log(p), log(1-p))) } gmin <- function (beta, X, y, w) { eta <- X %*% beta; p <- plogis(eta) -2 * (w *dlogis(eta) * ifelse(y, 1/p, -1/(1-p))) %*% X } if(is.null(dim(x))) dim(x) <- c(length(x), 1) dn <- dimnames(x)[[2]] if(!length(dn)) dn <- paste("Var", 1:nc...
2008 Sep 28
0
constrained logistic regression: Error in optim() with method = "L-BFGS-B"
...#print(-sum(2*w*ifelse(y, log(p), log(1-p)))) } #----------------------------------------------------------------------# # A function to return the gradient for the "BFGS", "L-BFGS-B" methods # #----------------------------------------------------------------------# gmin <- function(beta, X, y, w) { eta <- X %*% beta; p <- plogis(eta) -2*matrix(w*dlogis(eta)*ifelse(y, 1/p, -1/(1-p)), 1) %*% X # Gradient #print(-2*matrix(w*dlogis(eta)*ifelse(y, 1/p, -1/(1-p)), 1) %*% X) } if(is.null(dim(x))) dim(x) <- c(length(x), 1) dn <- di...
2008 Sep 29
0
Logistic Regression using optim() give "L-BFGS-B" error, please help
...hood Ratio] print(-sum(2*w*ifelse(y, log(p), log(1-p)))) } #----------------------------------------------------------------------# # A function to return the gradient for the "BFGS", "L-BFGS-B" methods # #----------------------------------------------------------------------# gmin <- function(beta, X, y, w) { eta <- X %*% beta; p <- plogis(eta) #p <- ifelse(1-p < 1e-6, 1-1e-6, p) -2*matrix(w*dlogis(eta)*ifelse(y, 1/p, -1/(1-p)), 1) %*% X # Gradient print(-2*matrix(w*dlogis(eta)*ifelse(y, 1/p, -1/(1-p)), 1) %*% X) } if(is.null(dim(x))) dim(x) <-...
2003 Jan 22
3
Error when using polr() in MASS
...when I use polr() in MASS. These are my data: skugg grupp frekv 4 1 gr3 0 5 2 gr3 3 6 3 gr3 6 10 1 gr5 1 11 2 gr5 12 12 3 gr5 1 > > summary(polr(skugg ~ grupp, weights=frekv, data= skugg.cpy1.dat)) Error in optim(start, fmin, gmin, method = "BFGS", hessian = Hess, ...) : non-finite value supplied by optim Does this depend on the very few observations in skugg 1 - the proportional-odds assumption doesn't hold (p 231, MASS 3ed)? If so, I would be happy for a recommendation on another approach. And I al...
2009 Apr 05
1
[cucumber] Nested resource in paths.rb
Hello Rspec Users, I was wondering how you specify a nested resource in cucumber. So for example: Given I have a blogpost titled Question For Nice Rspec Users When I am on the list of comments for Question For Nice Rspec Users Then I should see "Answer" Now, as one might expect, blogpost has_many :comments, so my question is this: How should I write the "when-case" for
2007 Aug 02
1
proportional odds model
...ing formula: response ~ 1), I have: Residual Deviance: 368.2387 AIC: 372.2387 How can I test if the model fits well? How can I check that the independent variable effectively explains the model? Is there any test? Moreover, sendig summary(polr.out) I get this error: Error in optim(start, fmin, gmin, method = "BFGS", hessian = Hess, ...) : initial value in 'vmmin' is not finite Something to do with the optimitation procedure... but, how can I fix it? Any help would be greatly appreciated. Thanks.
2007 Aug 02
1
proportional odds model in R
...ing formula: response ~ 1), I have: Residual Deviance: 368.2387 AIC: 372.2387 How can I test if the model fits well? How can I check that the independent variable effectively explains the model? Is there any test? Moreover, sendig summary(polr.out) I get this error: Error in optim(start, fmin, gmin, method = "BFGS", hessian = Hess, ...) : initial value in 'vmmin' is not finite Something to do with the optimitation procedure... but, how can I fix it? Any help would be greatly appreciated. Thanks.
2006 Mar 14
1
Ordered logistic regression in R vs in SAS
I tried the following ordered logistic regression in R: mod1 <- polr(altitude~sp + wind_dir + wind_speed + hr, data=altioot) But when I asked The summary of my regression I got the folloing error message: > summary (mod1) Re-fitting to get Hessian Error in optim(start, fmin, gmin, method = "BFGS", hessian = Hess, ...) : the initial value of 'vmin' is not finished. I decided to try it in SAS with the following program: PROC LOGISTIC DATA=altioot; CLASS sp wind_dir ; title "mod1"; output out=mod1; MODEL altitude = sp wind_dir wind_speed...
2004 Oct 08
1
polr and optim question
...l using the polr function from MASS. When I run model.loan.ordinal <- polr(loancat~age + sex + racgp + yrseduc + needlchg + gallery + sniffball + smokeball + sniffher + smokeher + nicocaine + inject + poly(year.of.int,3) + druginj + inj.years) I get an error Error in optim(start, fmin, gmin, method = "BFGS", hessian = Hess, ...) : non-finite value supplied by optim I checked in the MASS book, and in John Fox's book An R and S-Plus Companion to Applied Regression, I also checked in R-help, where a similar problem was solved by using as.ordered, but that did no...
2002 Feb 22
1
Logit / ms
Hello, I am looking for a routine to do a logistic regression. In the book "Modern Applied Statistics with S-PLUS" a function is described which uses the 'ms' command. Is there an analogue for R, or an alternative approach that can accomplish the same thing? Thanks, John. -- ========================================== John Janmaat Department of Economics Acadia
2005 Mar 22
1
error with polr()
...0515 18 1 1 0 3.2e+02 2.50515 19 2 1 1 1.0e+03 3.00000 20 2 1 1 1.0e+03 3.00000 When I try, > polr(y~lx,data=ord.dat) I gives me a output, which is the same as that from SAS. But when I try, > summary(polr(y~lx,data=ord.dat)) Re-fitting to get Hessian Error in optim(start, fmin, gmin, method = "BFGS", hessian = Hess, ...) : initial value in vmmin is not finite And the weird thing is that it's fine if I use "x" instead of "lx", where lx=log10(x). thanks Sincerely, cahn
2005 Sep 05
1
convergence for proportional odds model
...ot;) dose.resp #> dose.resp # resp dose # [1,] 1 2 # [2,] 1 2 # [3,] 1 3 # [4,] 1 3 # [5,] 2 4 # [6,] 2 4 # [7,] 2 5 # [8,] 3 4 # [9,] 3 5 #[10,] 3 5 polr( factor(resp, ordered=T)~dose, data=dose.resp) #Error in optim(start, fmin, gmin, method = "BFGS", hessian = Hess, ...) : # initial value in 'vmmin' is not finite #In addition: Warning message: #fitted probabilities numerically 0 or 1 occurred in: #glm.fit(X, y1, wt, family = binomial(), offset = offset) in SAS NOTE: PROC LOGISTIC is fitting the cumulativ...
2002 Jul 22
1
"New" problem with polr (or optim, or ...)
...because the beetles haven't read Cochran and Cox, the design is messy, with all sorts of confounding. Now, when I run the analysis I get this: > ModelF <- polr(Ext ~ Habitat+Edge+Grids+SE+NH+Size+Wings+Grids:SE + Grids:NH + Habitat:Edge , na.action=na.omit) Error in optim(start, fmin, gmin, method = "BFGS", hessian = Hess) : non-finite value supplied by optim Which is presumably because the data is unbalanced. This would be (sort-of) OK, except that this particular model is the optimal one I found when I ran it last time, using a previous version of R (and no, I...
2011 Feb 16
1
error in optim, within polr(): "initial value in 'vmmin' is not finite"
...ables (all continuous). My first stab at it was this: pomod <- polr(Npf ~ o_stddev + o_skewness + o_kurtosis + o_acl_1e + dispersal, rlc, Hess=TRUE) And that worked; I got a good model fit. However, a variety of other things that I've tried give me this error: Error in optim(s0, fmin, gmin, method = "BFGS", ...) : initial value in 'vmmin' is not finite This occurs, for example, when I try to use the method="probit" option of polr(). It also occurs when I try a regression involving interactions, such as: pomod <- polr(Npf ~ o_stddev * o_skewness...
2010 Nov 03
2
bugs and misfeatures in polr(MASS).... fixed!
In polr.R the (several) functions gmin and fmin contain the code > theta <- beta[pc + 1L:q] > gamm <- c(-100, cumsum(c(theta[1L], exp(theta[-1L]))), 100) That's bad. There's no reason to suppose beta[pc+1L] is larger than -100 or that the cumulative sum is smaller than 100. For practical datasets th...
2011 Apr 15
3
GLM output for deviance and loglikelihood
...oglikelihood(saturated model)) and this can be calculated by (or at least usually is); D = -2(loglikelihood(model)) As is done so in the code for 'polr' by Brian Ripley (in the package 'MASS') where the -loglikehood is minimised using optim; res <- optim(s0, fmin, gmin, method = "BFGS", hessian = Hess, ...) . . . deviance <- 2 * res$value If so, why is it that; > x = rnorm(10) > y = rpois(10,lam=exp(1 + 2*x)) > test = glm(formula = y ~ x, family = poisson) > deviance(test) [1] 5.483484 > -2*logLik(test) [1] 36.86335...
2006 Apr 16
3
second try; writing user-defined GLM link function
I apologize for my earlier posting that, unbeknownst to me before, apparently was not in the correct format for this list. Hopefully this attempt will go through, and no-one will hold the newbie mistake against me. I could really use some help in writing a new glm link function in order to run an analysis of daily nest survival rates. I've struggled with this for weeks now, and can at least
2004 Feb 19
0
polr warning message optim
...sers, I am using polr function in library(MASS). The code I use is the following: polr(as.ordered(q23p)~.,data=as.data.frame(datapr2)) where datapr2 is a matrix of 63 columns (together with the dependent variable) and 1665 rows. But I am receiving the warning message Error in optim(start, fmin, gmin, method = "BFGS", hessian = Hess, ...) I would be very greatfull if anyone could suggest something. Thank you
2008 Mar 13
0
help with summary(polr_model)
..."probit" > ) I get > Warning in eval(expr, envir, enclos) : > non-integer #successes in a binomial glm Then when I try to summarize the model, in order to use xtable > summary(base.op) > Re-fitting to get Hessian > Errore in optim(start, fmin, gmin, method = "BFGS", hessian = > Hess, ...) : > valore iniziale in 'vmmin' non finito that freely translated to english means "starting value in 'vmmin' not finished (or finite, more likely)" what does this mean? How can I have my summary? Thank you...