0

How would I write an R function that takes a response vec y and covariate matrix X and outputs a vector of maximum likelihood estimates of coefficients β where μ = Xβ And E[Y] = μ, where Y is an exponentially distributed random vector?

I can use the qr() and related functions, and need to program the iteratively reweighted least-squares algorithm from first principles using the QR decomposition.

Fenn Cris
  • 1
  • 2
  • 1
    Questions about how to code in `R` are off topic here. They can be on topic on [SO] but they will ask to see the code you've tried already. They don't welcome pure 'give me the code' questions. – gung - Reinstate Monica Feb 21 '16 at 23:55
  • 1
    Why do you need to do this? There are already functions that do this for you in R, & there is `optim` when you need something custom. – gung - Reinstate Monica Feb 21 '16 at 23:56
  • It generally involves some use of the optim() (or similar type of) function. Here http://stats.stackexchange.com/questions/126650/is-there-a-way-to-force-a-relationship-between-coefficients-in-logistic-regressi/126669#126669 is one example of a hand coded ML function in R for a completely different type of problem. The general methodology is the same though...you minimize the negative log likelihood function. –  Feb 22 '16 at 02:06

0 Answers0