Displaying 20 results from an estimated 200 matches similar to: "problems with optim, "for"-loops and machine precision"
2006 Aug 09
1
scaling constant in optim("L-BFGS-B")
Hi all,
I am trying to find estimates for 7 parameters of a model which should fit
real data. I have a function for the negative log likelihood (NLL) of the
data. With optim(method="L-BFGS-B",lower=0) I am now minimizing the NLL to
find the best fitting parameters.
My problem is that the algorithm does not converge for certain data sets. I
have read that one should scale the fn
2006 Aug 26
1
problems with loop
Dear all,
I am trying to evaluate the optimisation behaviour of a function. Originally
I have optimised a model with real data and got a set of parameters. Now I
am creating simulated data sets based on these estimates. With these
simulations I am estimating the parameters again to see how variable the
estimation is. To this end I have written a loop which should generate a new
simulated data
2010 Jul 08
2
Using nlm or optim
Hello,
I am trying to use nlm to estimate the parameters that minimize the
following function:
Predict<-function(M,c,z){
+ v = c*M^z
+ return(v)
+ }
M is a variable and c and z are parameters to be estimated.
I then write the negative loglikelihood function assuming normal errors:
nll<-function(M,V,c,z,s){
n<-length(Mean)
logl<- -.5*n*log(2*pi) -.5*n*log(s) -
2012 Jul 17
2
Problem creation tensor
Hi guys,
I need some help to analyzing my data.
I start to describe my data: I have 21 matrices, every matrix on the
rows has users and on columns has items, in my case films.
Element of index (i, j) represent the rating expressed by user i about item j.
I have a matrix for each of professions.
An example of a this type of matrix is:
item 1 item 2 item 3 item4
id
2012 Jul 05
3
Maximum Likelihood Estimation Poisson distribution mle {stats4}
Hi everyone!
I am using the mle {stats4} to estimate the parameters of distributions by
MLE method. I have a problem with the examples they provided with the
mle{stats4} html files. Please check the example and my question below!
*Here is the mle html help file *
http://stat.ethz.ch/R-manual/R-devel/library/stats4/html/mle.html
http://stat.ethz.ch/R-manual/R-devel/library/stats4/html/mle.html
2008 May 23
1
maximizing the gamma likelihood
for learning purposes and also to help someone, i used roger peng's
document to get the mle's of the gamma where the gamma is defined as
f(y_i) = (1/gammafunction(shape)) * (scale^shape) * (y_i^(shape-1)) *
exp(-scale*y_i)
( i'm defining the scale as lambda rather than 1/lambda. various books
define it differently ).
i found the likelihood to be n*shape*log(scale) +
2011 Oct 17
1
simultaneously maximizing two independent log likelihood functions using mle2
Hello,
I have a log likelihood function that I was able to optimize using
mle2. I have two years of the data used to fit the function and I would
like to fit both years simultaneously to test if the model parameter
estimates differ between years, using likelihood ratio tests and AIC.
Can anyone give advice on how to do this?
My likelihood functions are long so I'll use the tadpole
2024 Feb 29
2
Initializing vector and matrices
You could declare a matrix much larger than you intend to use. This works with a few megabytes of data. It is not very efficient, so scaling up may become a problem.
m22 <- matrix(NA, 1:600000, ncol=6)
It does not work to add a new column to the matrix, as in you get an error if you try m22[ , 7] but convert to data frame and add a column
m23 <- data.frame(m22)
m23$x7 <- 12
The only
2019 Apr 24
1
Bug in "stats4" package - "confint" method
Dear R developers,
I noticed a bug in the stats4 package, specifically in the confint method applied to ?mle? objects.
In particular, when some ?fixed? parameters define the log likelihood, these parameters are stored within the mle object but they are not used by the ?confint" method, which retrieves their value from the global environment (whenever they still exist).
Sample code:
>
2024 Mar 02
1
Initializing vector and matrices
The matrix equivalent of
x <- ...
v <- ...
x[length(x)+1] <- v
is
m <- ...
r <- ...
m <- rbind(m, r)
or
m <- ...
k <- ...
m <- cbind(m, c)
A vector or matrix so constructed never has "holes" in it.
It's better to think of CONSTRUCTING vectors and matrices rather than
INITIALISING them,
because always being fully defined is important.
It
2012 Oct 05
2
problem with convergence in mle2/optim function
Hello R Help,
I am trying solve an MLE convergence problem: I would like to estimate
four parameters, p1, p2, mu1, mu2, which relate to the probabilities,
P1, P2, P3, of a multinomial (trinomial) distribution. I am using the
mle2() function and feeding it a time series dataset composed of four
columns: time point, number of successes in category 1, number of
successes in category 2, and
2024 Mar 02
1
Initializing vector and matrices
"It would be really really helpful to have a clearer idea of what you
are trying to do."
Amen!
But in R, "constructing" objects by extending them piece by piece is
generally very inefficient (e.g.
https://r-craft.org/growing-objects-and-loop-memory-pre-allocation/),
although sometimes?/often? unavoidable (hence the relevance of your
comment above). R generally prefers to take
2006 Apr 19
0
Sysprep & Samba
Hi,
I'm using Samba version 3.0.14a-r2 on Gentoo Linux as a PDC for a
classroom environment. The server and the classroom are in different
subnets, but on the same local LAN. The broadcast messages are not
forwarded, so I have enabled a single machine in the classroom subnet to
act as a WINS proxy. I am using Ghost to image the classroom machines
which uses sysprep to prepare the
2003 Dec 11
0
Re: [R] chisq.test freezing on certain inputs (PR#5701)
On Thu, 11 Dec 2003, Jeffrey Chang wrote:
> Hello everybody,
>
> I'm running R 1.8.1 on both Linux and OS X compiled with gcc 3.2.2 and
> 3.3, respectively. The following call seems to freeze the interpreter
> on both systems:
> > chisq.test(matrix(c(233, 580104, 3776, 5786104), 2, 2),
> simulate.p.value=TRUE)
>
> By freeze, I mean, the function call never
2003 Dec 11
2
chisq.test freezing on certain inputs
Hello everybody,
I'm running R 1.8.1 on both Linux and OS X compiled with gcc 3.2.2 and
3.3, respectively. The following call seems to freeze the interpreter
on both systems:
> chisq.test(matrix(c(233, 580104, 3776, 5786104), 2, 2),
simulate.p.value=TRUE)
By freeze, I mean, the function call never returns (running > 10 hours
so far), the process is unresponsive to SIGINT (but I
2000 Apr 01
0
space in user dir?
This is obviously not a long term acceptable solution. Could someone
please enlighten me as to the permanent solution, or at least see why it
doesn't work? This is not my problem, therefore I have not had the
opportuntity to test - I don't have a version that old. Let me know if it
is solved in a newer version as well. Thanks.
It is a workable solution, although the generally accepted
2012 Nov 25
5
bbmle "Warning: optimization did not converge"
I am using the Ben bolker's R package "bbmle" to estimate the parameters of a
binomial mixture distribution via Maximum Likelihood Method. For some data
sets, I got the following warning messages:
*Warning: optimization did not converge (code 1: )
There were 50 or more warnings (use warnings() to see the first 50)*
Also, warnings() results the following:
*In 0:(n - x) : numerical
2003 Oct 29
1
AW: Help for Samba 3 and Win ADS
Hi Denis,
I just tried this but still I can't log on the samba server with a domain user!
If I try to do so I get the error:
[2003/10/29 08:48:37, 0] auth/auth_util.c:make_server_info_info3(1017)
make_server_info_info3: pdb_init_sam failed!
in the log file of the client on samba server...
Is there anytihng else I have to adjust on the samba server?
I sucessfully joined the domain with
2012 Sep 27
0
problems with mle2 convergence and with writing gradient function
Dear R help,
I am trying solve an MLE convergence problem: I would like to estimate
four parameters, p1, p2, mu1, mu2, which relate to the probabilities,
P1, P2, P3, of a multinomial (trinomial) distribution. I am using the
mle2() function and feeding it a time series dataset composed of four
columns: time point, number of successes in category 1, number of
successes in category 2, and
2012 Jul 17
0
Maximum Likelihood estimation of KB distribution
Hi, The following distribution is known as Kumaraswamy binomial Distribution.
http://r.789695.n4.nabble.com/file/n4636782/kb.png
For a given data I need to estimate the paramters (alpha and beta) of this
distribution(Known as Kumaraswamy binomial Distribution, A Binomial Like
Distribution). For that, in order to use *optim()*, I first declared the
Negative Log-likelihood of this distribution as