hope this helps. spencer graves ##################################################### dpareto <- function(x, shape, x0, log=FALSE){ dp <- if(log) (log(shape-1)-shape*log(x/x0)-log(x0)) else ((shape-1)*((x0/x)^shape)/x0) dp[x<x0] <- 0 dp }
ppareto <- function(q, shape, x0, lower.tail = TRUE, log.p=FALSE){ q <- pmax(x0, q) if(log.p){ if(lower.tail){ return(log(ppareto(q, shape, x0))) } else return((shape-1)*log(x0/q)) } else{ S.q <- (x0/q)^(shape-1) if(lower.tail)return(1-S.q) else return(S.q) } }
qpareto <- function(p, shape, x0, lower.tail=TRUE){ if(lower.tail) p <- (1-p) x0*exp(-log(p)/(shape-1)) }
rpareto <- function(n, shape, x0) qpareto(runif(n), shape, x0, lower.tail=FALSE)
fitdistr(rpareto(10000, 3, 1), dpareto, list(shape=2.5), x0=1)
######################################################## Harold Doran wrote:
Well, lm() produces an OLS solution, which are also MLE
solutions for the fixed effects. I think this is an easy way, although maybe not the best.
BHHH is a numerical approximation that can be used when
a closed form solution is not available. It is less sophisticated than Newton-Raphson.
Is this helpful?
------
Harold C. Doran
Director of Research and Evaluation
New American Schools
675 N. Washington Street, Suite 220
Alexandria, Virginia 22314
703.647.1628
-----Original Message----- From: Fohr, Marc [AM] [mailto:[EMAIL PROTECTED] Sent: Thursday, July 10, 2003 10:17 AM To: [EMAIL PROTECTED] Subject: [R] Maximum Likelihood Estimation and Optimisation
Hello,
I want to calculate a maximum likelihood funktion in R in
order to solve for the parameters of an estimator. Is there an easy way to do this in R? How do I get the parameters and the value of the maximum likelihood funktion.
above: BHHH (Berndt Hall Hall Hausman). Is this possible?
More, I want to specify the algorithm of the optimisation
Thanks a lot for your help and best regards
Marc
----------------------------------------------------------------------------- Marc Fohr, CFA Equity Portfolio Manager First Private Investment Management Neue Mainzer Strasse 75 D-60311 Frankfurt/Main Phone: ++49 - 69 - 2607 5424 Fax: ++49 - 69 - 2607 5440 Email: [EMAIL PROTECTED]
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help