Can we confirm Poisson regression with least square weighting? (R program)

Asked 2 years ago, Updated 2 years ago, 38 views

This site Pawason regression and I am studying while implementing it in R.

The equivalent method "No.3" is introduced below.This is if the link function is identity, but is it possible if the link function is log?

x=c (1, 2, 3, 4)
y=c(2,3,5,4)
w = c(1,1,1,1)
for (i in 1:10) {
  r=lm(y-x, weights=w)
  lambda=predict(r)
  print(c(as.numeric(r$coef), -sum(y*log(lambda)-lambda)))
  w=1/lambda
}
# omission
#[1]  1.2783467  0.8886613 -4.0609501

glm(y-x, family=poisson(link="identity")
#(Intercept)x  
#     1.2784       0.8887  

Below, I assumed the link function to log, and simply set y to log(y) and w to lambda, but is that not true?May I ask someone to give me some advice?

x=c (1, 2, 3, 4)
y=c(2,3,5,4)
w = c(1,1,1,1)
for (i in 1:10) {
  r=lm(log(y)-x, weights=w)
  lambda=predict(r)
  print(c(as.numeric(r$coef), -sum(y*log(lambda)-lambda)))
  w = lambda
}
# omission
#[1] 0.6195090 0.2334289 1.7332280

glm(y-x, family=poisson(link="log"))
#(Intercept)x  
#     0.6393       0.2320 

###############################################################################################

Dear user12399423 (Answer date: June 13th, 13:19)
Thank you for your reply.The explanation was easy to understand, and I found out what I had been wondering about for a long time, which made me feel refreshed.I'm ashamed to say that I didn't study enough, but one more thing I don't understand about the same thing, and if this question is still alive, I'd appreciate it if you could give me some advice.
I also saw the maximum likelihood estimation to be solved on this site IRLS, and I was studying it.

The weighted least squares method below is when the link function is log.For example, in the case of identity in this program (simply removing exp from the lambda section), is it possible?If you run it, it doesn't work (is it the same as regression analysis?), so why would a link function log be a Poisson regression?
I was confused.May I ask someone to give me some advice?

How about this?

Run glm.

r

2022-09-30 21:46

1 Answers

No. The original method uses y=lambda=a*x+b for equal mapping, so setting the link function to logarithm (I don't think it's a good approximation either) and the extreme value in your method is log(lambda)*(log(y)-1)*lambda'*exp(lambda)=0, which is far from the regression level.


2022-09-30 21:46

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.