Displaying 20 results from an estimated 10000 matches similar to: "help for MLE"
2004 Feb 15
5
Maximum likelihood estimation in R
Dear Sir,
I am a new user of R and I am doing a tast, which is: find the maximum
likelihood estimate of the parameter of Gaussian distribution for generated
100 numbers by using >x=rnorm(100, mean=3, sd=1).
I tried to use following Maximum Likelihood function
>fn<-function(x)
(-50*log((sd(x))^2))-50*log(sqrt(2*pi))-(1/2*((mean(x))^2))*(sum((x-(mean(x))^2)),
but it did not work.
I am
2005 May 31
1
Solved: linear regression example using MLE using optim()
Thanks to Gabor for setting me right. My code is as follows. I found
it useful for learning optim(), and you might find it similarly
useful. I will be most grateful if you can guide me on how to do this
better. Should one be using optim() or stats4::mle?
set.seed(101) # For replicability
# Setup problem
X <- cbind(1, runif(100))
theta.true <- c(2,3,1)
y <- X
2006 Jun 22
1
Why different results with different initial values for MLE (optim)!
Hi, All:
I used optim() to minimise likelihood function for fitting the data to a partiuclar distribution. The function is converged and the value of log-likelihood is different when I change the intial value.
Whether it means the program does not work well?
Thanks!
Xin
[[alternative HTML version deleted]]
2007 Dec 20
3
mle
Dear all,
I'm trying to estimate the parameters of a special case of a poisson
model, where the specified equation has an integral and several fixed
parameters.
I think that the MLE command in STATS4 package could be a good choice,
but it's a little complicated. I've got some problems with the offset
and I don't understand some of the functions. Do you know where can I
find some
2004 Feb 05
1
for help about MLE in R
Dear Sir,
I am using R to estimate two parameters in Normal distribution. I generated
100 normal distributed numbers, on which to estimate the parameter. The
syntax is:
>fn<-function(x)-50*log((y)^2)+50*log(2*pi)-(1/2*(z^2))*(sum((x-y)^2))
>out<-nlm(fn, x, hessian=TRUE)
but it does not work. Could you please help me to compose the syntax for the
purpose that find maximum
2005 Mar 12
1
MLE for two random variables
Hello,
I've the following setting:
(1) Data from a source without truncation (x)
(2) Data from an other source with left-truncation at threshold u (xu)
I have to fit a model on these these two sources, thereby I assume that both
are "drawn" from the same distribution (eg lognormal). In a MLE I would sum
the densities and maximize. The R-Function could be:
2011 Jan 03
3
Inverse Gaussian Distribution
Dear,
I want to fit an inverse gaussion distribution to a data set.
The predictor variables are gender, area and agecategory.
For each of these variables I've defined a baseline
e.g.
#agecat: baseline is 3
data<-transform(data, agecat=C(factor(agecat,ordered=TRUE),
contr.treatment(n=6,base=3)))
The variable 'area' goes from A to F (6 areas: A,B,C,D,E,F)
How can i
2005 May 30
1
Trying to write a linear regression using MLE and optim()
I wrote this:
# Setup problem
x <- runif(100)
y <- 2 + 3*x + rnorm(100)
X <- cbind(1, x)
# True OLS --
lm(y ~ x)
# OLS likelihood function --
ols.lf <- function(theta, K, y, X) {
beta <- theta[1:K]
sigma <- exp(theta[K+1])
e <- (y - X%*%beta)/sigma
logl <- sum(log(dnorm(e)))
return(logl)
}
optim(c(2,3,0), ols.lf, gr=NULL,
method="BFGS",
2004 Apr 07
4
Problems with rlm
Dear all,
When calling rlm with the following data, I get an error. (R v.1.8.1,
WinXP Pro 2002 with service pack 1.)
> d <- na.omit(data.frame(CPRATIO, HEIGHTZ, FAMILYID))
> c <- tapply(d$CPRATIO, d$FAMILYID, mean)
> h <- tapply(d$HEIGHTZ, d$FAMILYID, mean)
> c
1 2 3 6 7 9 10
11
6.000000 2.500000 3.250000
2002 Jul 31
5
help
Hello,
I would like to apply BAGGING to classification tree. Does a package
exists on that method?
In advance I thank you for your answer and I am looking forward to
hearing from you .
Best regards,
Vincent HERNU.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info",
2010 Aug 02
2
Dealing with a lot of parameters in a function
Hi all,
I'm trying to define and log-likelihood function to work with MLE.
There will be parameters like mu_i, sigma_i, tau_i, ro_i, for i between
1 to 24. Instead of listing all the parameters, one by one in the
function definition, is there a neat way to do it in R ? The example is
as follows:
ll<- function(mu1=-0.5,b=1.2,tau_1=0.5,sigma_1=0.5,ro_1=0.7)
{ if (tau1>0 &&
2003 Jun 25
3
logLik.lm()
Hello,
I'm trying to use AIC to choose between 2 models with
positive, continuous response variables and different error
distributions (specifically a Gamma GLM with log link and a
normal linear model for log(y)). I understand that in some
cases it may not be possible (or necessary) to discriminate
between these two distributions. However, for the normal
linear model I noticed a discrepancy
2006 Feb 10
8
Fitdistr and MLE for parameter lambda of Poisson distribution
Hello!
I would like to get MLE for parameter lambda of Poisson distribution. I
can use fitdistr() for this. After looking a bit into the code of this
function I can see that value for lambda and its standard error is
estimated via
estimate <- mean(x)
sds <- sqrt(estimate/n)
Is this MLE? With my poor math/stat knowledge I thought that MLE for
Poisson parameter is (in mixture of LaTeX
2005 Jan 10
1
mle() and with()
I'm trying to figure out the best way of fitting the same negative
log-likelihood function to more than one set of data, using mle() from the
stats4 package.
Here's what I would have thought would work:
--------------
library(stats4)
## simulate values
r = rnorm(1000,mean=2)
## very basic neg. log likelihood function
mll <- function(mu,logsigma) {
2009 Dec 10
1
MLE for a t distribution
Given X1,...,Xn ~ t_k(mu,sigma) student t distribution with k degrees
of freedom, mean mu and standard deviation sigma, I want to obtain the
MLEs of the three parameters (mu, sigma and k). When I try traditional
optimization techniques I don't find the MLEs. Usually I just get
k->infty. Does anybody know of any algorithms/functions in R that can
help me obtain the MLEs? I am especially
2009 Apr 10
1
Re MLE Issues
Hi
I have been having issue with a ML estimator for Jump diffusion process but
know I am get little error I didn't notice before like I am try to create a
vector
> #GBMPJ MLE Combined Ph 1 LR
> #
> n<-length(combinedlrph1)
> j<-c(1,2,3,4,5,6,7,8,9,10)
Error in c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) :
unused argument(s) (3, 4, 5, 6, 7, 8, 9, 10)
>
2005 Feb 07
1
MLE: Question
Hi R users!
I have a likelihood ratio statistic that depends on a parameter delta and I am
trying to get confidence intervals for this delta using the fact that the
likelihood ratio statistic is approx. chi-squared distributed.
For this I need to maximize the two likelihoods (for the ratio statistic) one of
which depends on delta too and I am trying to use the function "mle". But
2006 Jan 29
1
Logit regression using MLE
I have used the following code to obtain a max likelihood estimator for
a logit regression. The final command invokes ‘optim’ to obtain the
parameter estimates. The code works OK but I want to use the ‘mle’
function in the ‘stats4’ package instead of directly calling ‘optim’.
Can someone please figure out the command to do this?
Thank you in advance.
Martin
# mlelo.r - maximum
2008 May 08
3
MLE for noncentral t distribution
I have a data with 236 observations. After plotting the histogram, I found that it looks like non-central t distribution. I would like to get MLE for mu and df.
I found an example to find MLE for gamma distribution from "fitting distributions with R":
library(stats4) ## loading package stats4
ll<-function(lambda,alfa) {n<-200
x<-x.gam
2008 Mar 11
1
messages from mle function
Dears useRs,
I am using the mle function but this gives me the follow erros that I
don't understand. Perhaps there is someone that can help me.
thank you for you atention.
Bernardo.
> erizo <- read.csv("Datos_Stokes_1.csv", header = TRUE)
> head(erizo)
EDAD TALLA
1 0 7.7
2 1 14.5
3 1 16.9
4 1 13.2
5 1 24.4
6 1 22.5
> TAN <-