Displaying 20 results from an estimated 5000 matches similar to: "confusion over S3/S4 importing"
2011 Feb 11
2
fitdistr question
Hello,
I tried to fit a poisson distribution but looking at the function
fitdistr() it does not optimize lambda but simply estimates the mean
of the data and returns it as lambda. I'm a bit confused because I was
expecting an optimization of this parameter to gain a good fit...
If I would use mle() of stats4 package or mle2() of bbmle package, I
would have to write the function by myself
2009 Nov 04
1
compute maximum likelihood estimator for a multinomial function
Hi there
I am trying to learn how to compute mle in R for a multinomial negative
log likelihood function.
I am using for this the book by B. Bolker "Ecological models and data in
R", chapter 6: "Likelihood an all that". But he has no example for
multinomial functions.
What I did is the following:
I first defined a function for the negative log likelihood:
2009 Feb 01
2
Extracting Coefficients and Such from mle2 Output
The mle2 function (bbmle library) gives an example something like the
following in its help page. How do I access the coefficients, standard
errors, etc in the summary of "a"?
> x <- 0:10
> y <- c(26, 17, 13, 12, 20, 5, 9, 8, 5, 4, 8)
> LL <- function(ymax=15, xhalf=6)
+ -sum(stats::dpois(y, lambda=ymax/(1+x/xhalf), log=TRUE))
> a <- mle2(LL,
2014 Jul 06
2
Depot for S3 to S4 generics (as in stats4)?
Dear developers,
the implementation of S4 generics for existing S3 ones in the base
package is concerned to be a threat to quick startup times [1]. But
since S4 is promoted, and S3/S4 interoperability a pain when package
developing [2], are there efforts to improve the situation? E.g. an S3
free system, etc.
A good thing [2] is the package 'stats4', including some setGeneric
calls (e.g.
2007 May 16
2
citation question
I want to put the correct information into the "author" field
of the DESCRIPTION file for my bbmle package, which is a modified
and extended version of the mle code in the stats4 package.
If I put only myself as author I feel like I'm ignoring the
contribution of R-Core (and I think Peter Dalgaard in particular)
in writing the original code. If I add "R Development Core
2008 Sep 10
1
using function instead of formula in plm
Hi all,
I am trying to use plm to estimate coefficients in a model consisting of a system of equations. So far I used mle2 from the package "bbmle", but now I need to test for autocorrelation and mle2 does not provide for the necessary tests. mle2 needs a function as input that might as well consist of many different equations. plm however requires an object of class formula that needs
2008 Nov 19
1
mle2 simple question - sigma?
I'm trying to get started with maximum likelihood estimation with a
simple regression equivalent out of Bolker (Ecological Models and Data
in R, p302).
With this code:
#Basic example regression
library(bbmle)
RegData<-data.frame(c(0.3,0.9,0.6),c(1.7,1.1,1.5))
names(RegData)<-c("x", "y")
linregfun = function(a,b,sigma) {
Y.pred = a+b*x
2012 Apr 18
1
error estimating parameters with mle2
Hi all,
When I try to estimate the functional response of the Rogers type I
equation (for the mle2 you need the package bbmle):
> RogersIbinom <- function(N0,attackR2_B,u_B) {attackR2_B+u_B*N0}
> RogersI_B <-
mle2(FR~dbinom(size=N0,prob=RogersIbinom(N0,attackR2_B,u_B)/N0),start=list(attackR2_B=4.5,u_B=0.16),method="Nelder-Mead",data=data5)
I get following error message
2019 Apr 08
1
debian testing: Problems with R function vignette()
Hola!
I am on debian testing, all updates up to date. I am running R via emacs
and ess, so I canot know if this is an R or emacs/ess problem. What
happens is that I want to read an vignette, and calls something like
vignette("mle2", package="bbmle")
the pdf file opens (for me in Foxit reader), no problem, but then emacs
starts to spew a lot of spam, interfering with the
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
2012 Apr 19
1
non-numeric argument in mle2
Hi all,
I have some problems with the mle2 function
> RogersIIbinom <- function(N0,attackR3_B,Th3_B)
{N0-lambertW(attackR3_B*Th3_B*N0*exp(-attackR3_B*(24-Th3_B*N0)))/(attackR3_B*Th3_B)}
> RogersII_B <-
mle2(FR~dbinom(size=N0,prob=RogersIIbinom(N0,attackR3_B,Th3_B)/N0),start=list(attackR3_B=1.5,Th3_B=0.04),method="Nelder-Mead",data=dat)
Error in dbinom(x, size, prob, log)
2010 Jul 31
2
Is profile.mle flexible enough?
Hi the list,
I am experiencing several issues with profile.mle (and consequently with
confint.mle) (stat4 version 2.9.2), and I have to spend a lot of time to
find workarounds to what looks like interface bugs. I would be glad to
get feedback from experienced users to know if I am really asking too
much or if there is room for improvement.
* Problem #1 with fixed parameters. I can't
2008 Jun 19
1
Optim() violates constraints
Hi,
I am using the mle2 method of the package 'bbmle'. The method is calling as
far as I understood it the optim method "L-BFGS-B" (this is the method I
use). The latter one allows the user to impose box constraints on the
variables, i.e. to give lower and upper bounds. It is important that the
initial values satisfy the constraints. In my problem, it is the case. I do
not know
2012 Nov 11
1
maximum likelihood estimation in R
I want to find ML estimates of a model using mle2 in bbmle package. When I
insert new parameters (for new covariates) in model the log-likelihood value
does not change and the estimated value is exactly the initial value that I
determined. What's the problem? This is the code and the result:
As you see the estimated values for b2 , b3 and b4 are the initial values of
them. The
2009 Aug 10
1
model.matrix evaluation challenges
I am having difficulty with evaluation/environment construction
for a formula to be evaluated by model.matrix(). Basically, I
want to construct a model matrix that first looks in "newdata"
for the values of the model parameters, then in "object at data".
Here's what I've tried:
1. model.matrix(~f,data=c(newdata,object at data)) -- fails because
something (terms()?)
2011 Feb 07
2
question mle again
A few day ago, I was looking for an answer to my question but didn't
get one. Anybody who can help now?
Hello,
I tried to use mle to fit a distribution(zero-inflated negbin for
count data). My call is very simple:
mle(ll)
ll() takes the three parameters, I'd like to be estimated (size, mu
and prob). But within the ll() function I have to judge if the current
parameter-set gives a nice
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
2012 Feb 26
1
improved error message when existing implicit S4 generic is not imported?
pkgA's NAMESPACE has
importFrom(graphics, plot)
exportClasses("A")
exportMethods("plot")
R/foo.R has
setClass("A")
setMethod("plot", "A", function(x, y, ...) {})
During R CMD INSTALL pkgA_1.0.tar.gz we are told
** preparing package for lazy loading
Creating a generic function for 'plot' from package
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
2012 Feb 23
0
error in optim: initial value in 'vmmin' is not finite
Dear r-helpers,
I'm experiencing some problems in fitting a maximum likelihood binomial
model to some of my data. The error is in optim, which founds: Error in
optim(par = c(0.2, 0.5), fn = function (p) :
initial value in 'vmmin' is not finite
Yes, I know it's a common problem, and I've carefully searched and readed
all the posts about the issue, But, I can't find a