Displaying 20 results from an estimated 1000 matches similar to: "How to determine sensible values for 'fnscale' and 'parscale' in optim"
2009 Jun 22
1
The gradient of a multivariate normal density with respect to its parameters
Does anybody know of a function that implements the derivative (gradient) of
the multivariate normal density with respect to the *parameters*?
It?s easy enough to implement myself, but I?d like to avoid reinventing the
wheel (with some bugs) if possible. Here?s a simple example of the result
I?d like, using numerical differentiation:
library(mvtnorm)
library(numDeriv)
f=function(pars, xx, yy)
2008 Feb 24
0
problem with ML estimation
dear list,
as a part my problem. I have to estimate some parameters using ML
estimation. The form of the likelihood function
is not straight forward and I had to use a for loop to define the function.
I used "optim" to maximise the result but
was not sure of the programme.
To validate my results, I tried to write a function to obtain the MLE of a
bivariate normal in the same manner.
On
2008 Mar 23
2
scaling problems in "optim"
Dear R users,
I am trying to figure out the control parameter in "optim," especially,
"fnscale" and "parscale."
In the R docu.,
------------------------------------------------------
fnscale
An overall scaling to be applied to the value of fn and gr during
optimization. If negative, turns the problem into a maximization problem.
Optimization is performed on
2005 Nov 09
2
About: Error in FUN(X[[1]], ...) : symbol print-name too long
Hi,
I??m trying to use the Win2BUGS package from R and I have a similar problem
that reurns with the message:
Error in FUN(X[[1]], ...) : symbol print-name too long
But, there is no stray ` character in the file ( Sugestions given by: Duncan
Temple Lang <duncan>
Date: Mon, 26 Sep 2005 07:31:08 -0700 )
The progam in R is:
library(R2WinBUGS)
library(rbugs)
dat <-
2008 Feb 08
0
scaling and optim
?optim says, in describing the control parameter,
'fnscale' An overall scaling to be applied to the value of 'fn'
and 'gr' during optimization. If negative, turns the problem
into a maximization problem. Optimization is performed on
'fn(par)/fnscale'.
'parscale' A vector of scaling values for the parameters.
2009 Jan 04
1
POSIXct and chron issues with tz
Dear All-
I am trying to merge two data files - they have different date formats
and different times zones. I need to match up the date/time of the
datasets and then invoke a conditional statement, such as: if dataC$mph
is >= 12 then keep dataM$co23 for the corresponding time/date stamp.
snippets of data files:
*dataC.txt*
LST in mph Deg DegF DegF2 % volts Deg
2012 Dec 07
0
apply a function at: dateX, dateX+1, dateX+2, ....
Dear knowing people,
Dennis Murphy helped me a lot with my first loop last week. Thanks again - I
could have made more than 10 "Thank-You cakes" in the time it saved me!
But now I want to complicate the thing. My ideas didn't work. Let's see if
anyone is smarter ;-)
The following packages are needed:
library(adehabitatHR)
library(rgdal)
library(plyr)
# My dataframe looks
2012 Apr 05
4
Appropriate method for sharing data across functions
In trying to streamline various optimization functions, I would like to have a scratch pad
of working data that is shared across a number of functions. These can be called from
different levels within some wrapper functions for maximum likelihood and other such
computations. I'm sure there are other applications that could benefit from this.
Below are two approaches. One uses the <<-
2005 Apr 19
1
Optim(...parscale...)
Hi there,
The optim(par, fn, ...parscale...) function in R requires 'parscale' which is defined as:
"A vector of scaling values for the parameters. Optimisation is performed on 'par/parscale' and these should be comparable in the sense that a unit change in any element (??) produces a unit change in the scaled value".
I am just not understanding the
2009 Mar 02
0
Optim parscale?
I am not clear on what is happening with parscale in optim It seems that scaling the parameters will produce unpredictable results in a non-linear function (which is the purpose of optim right?)
The documentation states:
parscale
A vector of scaling values for the parameters. Optimization is performed on par/parscale and these should be comparable in the sense that a unit change in any element
2003 Jul 16
2
numerical differentiation in R? (for optim "SANN" parscale)
Dear R users,
I am running a maximum likelihood model with optim. I chose the
simulated annealing method (method="SANN").
SANN is not performing bad, but I guess it would be much more effecive
if I could set the `parscale' parameter.
The help sais:
`parscale' A vector of scaling values for the parameters.
Optimization is performed on `par/parscale' and these
2013 May 17
1
Error with adehabitatHR and kernelbb
Dear all,
I'm trying to get a Brownian bridge kernel (kernelbb) for each combination of two consecutive animal locations (see commands below) and put them, with a loop, inside a list. It works well at the beginning but after 42 runs, it appears the following warning :
>Error in seq.default(yli[1], yli[2], by = diff(xg[1:2])) :
> invalid (to - from)/by in seq(.)
I looked at the
2008 Jul 21
1
Control parameter of the optim( ): parscale
Hi everybody,
I am using the L-BFGS-B method of the mle2() function to estimate the values
of 6 parameters. mle2 uses the methods implemented in optim. As I got it
from the descriptions available online, one can use the parscale
parameter to tell R somehow what the values of the estimated parameters
should be . . .
Could somebody please help me understand what one has to do actually with
the
2008 Apr 05
2
How to improve the "OPTIM" results
Dear R users,
I used to "OPTIM" to minimize the obj. function below. Even though I used
the true parameter values as initial values, the results are not very good.
How could I improve my results? Any suggestion will be greatly appreciated.
Regards,
Kathryn Lord
#------------------------------------------------------------------------------------------
x = c(0.35938587,
2008 Apr 05
2
How to improve the "OPTIM" results
Dear R users,
I used to "OPTIM" to minimize the obj. function below. Even though I used
the true parameter values as initial values, the results are not very good.
How could I improve my results? Any suggestion will be greatly appreciated.
Regards,
Kathryn Lord
#------------------------------------------------------------------------------------------
x = c(0.35938587,
2008 Mar 31
2
L-BFGS-B needs finite values of 'fn'
Dear All,
I am trying to solve the optimization problem below, but I am always
getting the following error:
Error in optim(rep(20, nvar), f, gr, method = "L-BFGS-B", lower = rep(0, :
L-BFGS-B needs finite values of 'fn'
Any ideas?
Thanks in advance,
Paul
-----------------------------------------------
k <- 10000
b <- 0.3
f <- function(x) {
n <- length(x)
2005 Apr 26
2
"wild" function example in optim
Dear all,
Firstly, I do apologize if my question is simple and posted in the wrong place but I had no reply from the R-help mailing list (maybe it is too simple!).
I was wondering why parscale is set to 20 in the "wild" function example used in ?optim. This function has only one parameter and if we set parscale equal to 1 then the solution near the global minimum is not found.
I
2011 May 25
1
L-BFGS-B and parscale in optim()
Hi,
When using method L-BFGS-B along with a parscale argument, should the
lower and upper bounds provided be on the scaled or unscaled values?
Thanks.
Cheers,
--
Seb
2006 Sep 01
0
defining error structure in bivariate mixed models
Hi,
Using indicator variables I have been able to fit and run the code for
fitting a bivariate mixed model using unstructured covariance matrix
The code is
lme.fit1<- lme(one.var~-1+indic1+indic2+I(indic1*d.time)+I(indic2*d.time),
random =~ -1+indic1+indic2|m.unit, weights = varIdent(~1|indic1)
,data = new.data)
My variables are
one.var :- the two response variables stacked one after
2007 May 08
0
Question on bivariate GEE fit
Hi,
I have a bivariate longitudinal dataset. As an example say,
i have the data frame with column names
var1 var2 Unit time trt
(trt represents the treatment)
Now suppose I want to fit a joint model of the form for the *i* th unit
var1jk = alpha1 + beta1*timejk + gamma1* trtjk + delta1* timejk:trtjk +
error1jk
var2 = alpha2 + beta2*timejk + gamma2* trtjk + delta2* timejk:trtjk +