similar to: for help about MLE in R

Displaying 20 results from an estimated 10000 matches similar to: "for help about MLE in R"

2009 Jul 01
2
Difficulty in calculating MLE through NLM
Hi R-friends, Attached is the SAS XPORT file that I have imported into R using following code library(foreign) mydata<-read.xport("C:\\ctf.xpt") print(mydata) I am trying to maximize logL in order to find Maximum Likelihood Estimate (MLE) of 5 parameters (alpha1, beta1, alpha2, beta2, p) using NLM function in R as follows. # Defining Log likelihood - In the function it is noted as
1999 Dec 09
1
nlm() problem or MLE problem?
I am trying to do a MLE fit of the weibull to some data, which I attach. fitweibull<-function() { rt<-scan("r/rt/data2/triam1.dat") rt<-sort(rt) plot(rt,ppoints(rt)) a<-9 b<-.27 fn<-function(p) -sum( log(dweibull(rt,p[1],p[2])) ) cat("starting -log like=",fn(c(a,b)),"\n") out<-nlm(fn,p=c(a,b), hessian=TRUE)
1998 Apr 14
1
R-beta: SEs for one-param MLE in R?
Simple-mindedly I tried getting MLE and SE for one-parameter model in the same way as for multi-param models. out<-nlm(fn,p=c(2),hessian=T) But sqrt(diag(solve(out$hessian))) gives the answer 1. The Hessian has only one entry, not really a matrix. diag(x) gives 1 if x is just a single number. Is this what I should be doing to get SE for MLE? sqrt(solve(out$hessian)) Thanks very much for
1998 Apr 14
1
R-beta: SEs for one-param MLE in R?
Simple-mindedly I tried getting MLE and SE for one-parameter model in the same way as for multi-param models. out<-nlm(fn,p=c(2),hessian=T) But sqrt(diag(solve(out$hessian))) gives the answer 1. The Hessian has only one entry, not really a matrix. diag(x) gives 1 if x is just a single number. Is this what I should be doing to get SE for MLE? sqrt(solve(out$hessian)) Thanks very much for
2007 Sep 16
1
Problem with nlm() function.
In the course of revising a paper I have had occasion to attempt to maximize a rather complicated log likelihood using the function nlm(). This is at the demand of a referee who claims that this will work better than my proposed use of a home- grown implementation of the Levenberg-Marquardt algorithm. I have run into serious hiccups in attempting to apply nlm(). If I provide gradient and
2005 Dec 04
1
Understanding nonlinear optimization and Rosenbrock's banana valley function?
GENERAL REFERENCE ON NONLINEAR OPTIMIZATION? What are your favorite references on nonlinear optimization? I like Bates and Watts (1988) Nonlinear Regression Analysis and Its Applications (Wiley), especially for its key insights regarding parameter effects vs. intrinsic curvature. Before I spent time and money on several of the refences cited on the help pages for "optim",
2003 Oct 17
2
nlm, hessian, and derivatives in obj function?
I've been working on a new package and I have a few questions regarding the behaviour of the nlm function. I've been (for better or worse) using the nlm function to fit a linear model without suppling the hessian or gradient attributes in the objective function. I'm curious as to why the nlm requires 31 iterations (for the linear model), and then it doesn't work when I try to add
2010 Mar 25
1
*** caught segfault *** address 0x18, cause 'memory not mapped'
Hello R Community, I've been run the following codes. However, I've been getting an unusual segfault that I'm unable to trace its origin. Please give me a light to decipher the "caught segfault" Thanks for you attention. Bernardo. > options(STERM='iESS', editor='emacsclient') > rm(list = ls()) > > source("fgenIGLD.R") #RNG
2011 Sep 22
1
nlm's Hessian update method
Hi R-help! I'm trying to understand how R's nlm function updates its estimate of the Hessian matrix. The Dennis/Schnabel book cited in the references presents a number of different ways to do this, and seems to conclude that the positive-definite secant method (BFGS) works best in practice (p201). However, when I run my code through the optim function with the method as "BFGS",
2003 Oct 20
1
Fitting a Weibull/NaNs
I'm trying to fit a Weibull distribution to some data via maximum likelihood estimation. I'm following the procedure described by Doug Bates in his "Using Open Source Software to Teach Mathematical Statistics" but I keep getting warnings about NaNs being converted to maximum positive value: > llfunc <- function (x) { -sum(dweibull(AM,shape=x[1],scale=x[2], log=TRUE))} >
2016 Apr 06
1
Optimization max likelihood problem
hello all, I am getting wrong estimates from this code. do you know what could be the problem. thanks x<- c(1.6, 1.7, 1.7, 1.7, 1.8, 1.8, 1.8, 1.8) y <- c( 6, 13, 18, 28, 52, 53, 61, 60) n <- c(59, 60, 62, 56, 63, 59, 62, 60) DF <- data.frame(x, y, n) # note: there is no need to have the choose(n, y) term in the likelihood fn <- function(p, DF) { z <- p[1]+p[2]*DF$x
2019 Feb 19
1
mle (stat4) crashing due to singular Hessian in covariance matrix calculation
Hi, R developers. when running mle inside a loop I found a nasty behavior. From time to time, my model had a degenerate minimum and the loop just crashed. I tracked it down to "vcov <- if (length(coef)) solve(oout$hessian)" line, being the hessian singular. Note that the minimum reached was good, it just did not make sense to calculate the covariance matrix as the inverse of a
2003 Oct 24
1
first value from nlm (non-finite value supplied by nlm)
Dear expeRts, first of all I'd like to thank you for the quick help on my last which() problem. Here is another one I could not tackle: I have data on an absorption measurement which I want to fit with an voigt profile: fn.1 <- function(p){ for (i1 in ilong){ ff <- f[i1] ex[i1] <- exp(S*n*L*voigt(u,v,ff,p[1],p[2],p[3])[[1]]) } sum((t-ex)^2) } out <-
2009 Dec 06
5
optim with constraints
Hi, dear R users I am a newbie in R and I wantto use the method of meximum likelihood to fit a Weibull distribution to my survival data. I use "optim" as follows: optim(c(1, 0.25),weibull.like,mydata=mydata,method="L-BFGS-B",hessian = TRUE) My question is: how do I setup the constraints so that the two parametrs of Weibull to be pisotive? Or should I use other function
2001 Jan 09
3
log(0) problem in max likelihood estimation
This practical problem in maximum likelihood estimation must be encountered quite a bit. What do you do when a data point has a probability that comes out in numerical evaluation to zero? In calculating the log likelihood you then have a log(0) problem. Here is a simple example (probit) which illustrates the problem: x<-c(1,2,3,4,100) ntrials<-100 yes<-round(ntrials*pnorm((x-3)/1))
2007 Mar 02
2
nlm() problem : extra parameters
Hello: Below is a toy logistic regression problem. When I wrote my own code, Newton-Raphson converged in three iterations using both the gradient and the Hessian and the starting values given below. But I can't get nlm() to work! I would much appreciate any help. > x [1] 10.2 7.7 5.1 3.8 2.6 > y [1] 9 8 3 2 1 > n [1] 10 9 6 8 10 derfs4=function(b,x,y,n) {
2008 Jun 16
1
Error in maximum likelihood estimation.
Dear UseRs, I wrote the following function to use MLE. --------------------------------------------- mlog <- function(theta, nx = 1, nz = 1, dt){ beta <- matrix(theta[1:(nx+1)], ncol = 1) delta <- matrix(theta[(nx+2):(nx+nz+1)], ncol = 1) sigma2 <- theta[nx+nz+2] gamma <- theta[nx+nz+3] y <- as.matrix(dt[, 1], ncol = 1) x <- as.matrix(data.frame(1,
2001 Apr 27
3
nls question
I have a question about passing arguments to the function f that nlm minimizes. I have no problems if I do this: x<-seq(0,1,.1) y<-1.1*x + (1-1.1) + rnorm(length(x),0,.1) fn<-function(p) { yhat<-p*x+(1-p) sum((y-yhat)^2) } out<-nlm(fn,p=1.5,hessian=TRUE) But I would like to define fn<-function(x,y,p) { yhat<-p*x+(1-p) sum((y-yhat)^2) } so
2000 Mar 06
1
nlm and optional arguments
It would be really nice if nlm took a set of "..." optional arguments that were passed through to the objective function. This level of hacking is probably slightly beyond me: is there a reason it would be technically difficult/inefficient? (I have a vague memory that it used to work this way either in S-PLUS or in some previous version of R, but I could easily be wrong.) Here's
1998 Mar 18
2
``nlm(.) with derivatives''
>>>>> "DougB" == Douglas Bates <bates@stat.wisc.edu> writes: DougB> ....... DougB> ....... { time comparisons in testing lme(..) for R } DougB> ....... DougB> This can be expected to run faster when a version of nlm that accepts DougB> gradients and Hessians is available. --- Doug, do I understand properly that it won't