similar to: optim not giving correct minima

Displaying 20 results from an estimated 300 matches similar to: "optim not giving correct minima"

2009 Jan 05
2
Sweave data-figure coupling
Hi, With the following Sweave minimal file: ---<--------------------cut here---------------start------------------->--- \documentclass{article} \usepackage{Sweave} \begin{document} <<binom-sim>>= thetas <- seq(0, 1, by=0.001) prior <- rep(1, length(thetas)) / length(thetas) lik <- dbinom(1, 1, thetas) lik.p <- prior * lik post <- lik.p / sum(lik.p)
2005 Oct 16
2
Animated lissajous
Here's some code to make lissajous dance. I've attached a small sample GIF. Cheers, Rob Steele robsteele at yahoo dot com plot.lissajous = function(omega.x, omega.y, delta = 0, num.thetas = 200) { thetas = seq(0, 2 * pi, length = num.thetas) xs = sin(omega.x * thetas + delta) ys = cos(omega.y * thetas) plot(xs, ys, type = 'l', lwd = 3, ann = FALSE, axes = FALSE) }
2010 May 22
1
How to find all single minima, i.e. only each one within each next part of analyzed vector (table)
Dear R users, How to find all single minima within each next part of analyzed vector (table) Select all minima (mass_value=min & mass_value<2) (many) in vector(table), BUT first put mask on table in order to select within one window mask (5 elements) only one local minimum, and next to search within the next time window mask the second minimum (only one local along second mask)
2013 Mar 20
0
unexpected local minima/maxima with surf.gls
Hi there, I use the surf.gls() function to fit a variable measured over a surface. When I plot the predicted surface, there are local minima/maxima in almost every coordinate where data were measured, which seems aberrant. For instance: ?? x <- c(343,293,343,243,293,343,443,543,593,243,293,343,393,443,493,543,593,143,193,243,293,343,393,443,
2005 Jun 15
1
Finding local minima and maxima
I have data in the form of (x,y) pairs and would like to find local minima and maxima (typically the zeros of the 2nd derivative) of the y values. I looked at numericDeriv, but I don't have an "expression" per se. I looked at optim, also, but it looks like it will find only one "global" max or min. I can code up my own piecewise derivatives, but wondered if there is
2011 May 25
0
approximate function and find local peaks (Maxima or Minima)
Hi, I have a data-matrix: > CB                    Zeit                Low 2   2011-05-02 08:05:05 7596.0 3   2011-05-02 08:10:06 7593.5 4   2011-05-02 08:15:11 7594.5 5   2011-05-02 08:20:15 7597.5 6   2011-05-02 08:25:18 7595.0 7   2011-05-02 08:30:20 7593.5 8   2011-05-02 08:35:21 7593.0 9   2011-05-02 08:40:21 7593.0 10  2011-05-02 08:45:25 7599.0 11  2011-05-02 08:50:34 7596.0 12 
2009 Nov 03
2
1 dimensional optimization with local minima
I am using numerical optimization to fit a 1 parameter model, in which the input parameter is bounded. I am currently using optimize(), however, the problem turns out to have local minima, and optimize does not always seem to find the global minimum. I could to write a wrapping function that tries multiple intervals or starting values, but I would prefer a package that has built-in methods to make
2002 Sep 29
2
Problem on minima
2010 Nov 03
3
optim works on command-line but not inside a function
Dear all, I am trying to optimize a logistic function using optim, inside the following functions: #Estimating a and b from thetas and outcomes by ML IRT.estimate.abFromThetaX <- function(t, X, inits, lw=c(-Inf,-Inf), up=rep(Inf,2)){ optRes <- optim(inits, method="L-BFGS-B", fn=IRT.llZetaLambdaCorrNan, gr=IRT.gradZL, lower=lw, upper=up, t=t, X=X)
2001 Oct 20
1
Animating a persp plot: non-constant scaling?
Hi all, I'm making an animation of a rotating persp plot of some data. It's easy, really: I just plot the persp in a loop over the theta parameter, saving each plot, and then chain them together with ImageMagick (as suggested on Paul Johnson's R-tips page). But... when you run the animation, because each graph is individually re-scaled, the image is not the same size in each
2013 Jan 10
2
Determining sample size from power function
Hello, I am trying to get the power function to report the sample size rather than the power. My goal is to input a variety of values for theta and then for the power function to report the corresponding sample sizes. I haven't had much luck trying to create my own function, something along the lines of: f <- function (x) {
2009 Mar 25
0
constrOptim workaround for "L-BFGS-B" or Box Constraints
This is not so much a question as a contribution, but comments are welcome. Comments: 1) thank you very much to Paul Smith in the post https://stat.ethz.ch/pipermail/r-help/2008-March/157249.html This is intended to build on that example with something more complex than a 2x2 set of constraints 2) "L-BFGS-B" does not appear to work in optimConst Problem: let's
2007 Sep 12
1
enquiry
Dear R-help, I am trying to estimate a Cox model with nested effects basing on the minimization of the overall AIC; I have two frailties terms, both gamma distributed. There is a error message (theta2 argument misses) and I don?t understand why. I would like to know what I have wrong. Thank you very much for your time. fitM7 <- coxph(Surv(lifespan,censured) ~ south + frailty(id,
2012 Jul 02
0
Fit circle with R
Dear Researchers, I wrote two function to fit a circle using noisy data. 1- the fitCircle() is derived from MATLAB code of * zhak Bucher* from the link http://www.mathworks.com/matlabcentral/fileexchange/5557-circle-fit/content/circfit.m 2- the CircleFitByPratt() from MATLAB code of *Nikolai Chernov *from the link
2005 May 19
1
R 2.1.0 RH Linux Built from Source Segmentation Fault
Background: I administer a cluster of RedHat EWS 3U4 Linux workstations at a university. I built R 2.1.0 from source: ./configure \ --prefix=/sscc/opt/R-2.1.0 \ --with-blas=no \ 2>&1 \ | tee NUInstall.configure R is now configured for i686-pc-linux-gnu Source directory: . Installation directory: /sscc/opt/R-2.1.0 C compiler:
2008 Apr 22
2
optimization setup
Hi, here comes my problem, say I have the following functions (example case) #------------------------------------------------------------ function1 <- function (x, theta) {a <- theta[1] ( 1 - exp(-theta[2]) ) * theta[3] ) b <- x * theta[1] / theta[3]^2 return( list( a = a, b = b )) } #----------------------------------------------------------- function2<-function (x, theta) {P
2011 Jul 09
3
Confusing piece of R code
m0<-epxression((4*theta1*theta2-theta3^2)/(2*x*theta3^2)-0.5*theta1*x) params<-all.vars(m0) this reads all the params from m0 so theta1,2 and 3 correct? params<-params[-which(params=="x")] checks which params are multiplied by x? np<-length(params) for(i in 1:6){ esp<-get(sprintf("m%d",i-1))
2007 Sep 05
0
New R package plink for separate calibration IRT linking
The first version of the package plink has been uploaded to CRAN. plink is a package for conducting unidimensional IRT scaling and chain linking for multiple groups for single-format or mixed-format common items. The package supports eight IRT models and four calibration methods. Dichotomous Models: 1PL, 2PL, 3PL Polytomous Models: -Graded response model -Partial credit model -Generalized
2007 Sep 05
0
New R package plink for separate calibration IRT linking
The first version of the package plink has been uploaded to CRAN. plink is a package for conducting unidimensional IRT scaling and chain linking for multiple groups for single-format or mixed-format common items. The package supports eight IRT models and four calibration methods. Dichotomous Models: 1PL, 2PL, 3PL Polytomous Models: -Graded response model -Partial credit model -Generalized
2004 May 15
2
questions about optim
Hi, I am trying to do parameter estimation with optim, but I can't get it to work quite right-- I have an equation X = Y where X is a gaussian, Y is a multinomial distribution, and I am trying to estimate the probabilities of Y( the mean and sd of X are known ), Theta1, Theta2, Theta3, and Theta4; I do not know how I can specify the constraint that Theta1 + Theta2 + Theta3 + Theta4 = 1 in