In: Statistics and Probability
Say I have a random data that consists of crab’s color (C), spine condition (S), weight (Wt), and carapace width (W). The response outcome for each female crab is her number of satellites (Sa).
And the following code I have done is:
model=glm(carb$Sa~1+carb$W,family=poisson(link=log))
Now my main question is, how to do a Rcode on:
I am trying to use a two variable minimization rule and I need help finding the first and second derivatives of poisson so that i could also input the guesses of X and Y variables such as:
X Y~Poisson
0 1
1 1
2 3
#### Poisson Regression of Sa on W model=glm(crab$Sa~1+crab$W,family=poisson(link=log))
Note that the specification of a Poisson distribution in R is “family=poisson” and “link=log”. You can also get the predicted count for each observation and the linear predictor values from R output by using specific statements such as:
#### to get the predicted count for each observation: #### e.g. for the first observation E(y1)=3.810 print=data.frame(crab,pred=model$fitted) print #### note the linear predictor values #### e.g., for the first observation, exp(1.3378)=3.810 model$linear.predictors exp(model$linear.predictors)
In the output below, you should be able to identify the relevant parts:
Here is the output:
The estimated model is: log(μi^) = -3.30476 + 0.16405Wi
The ASE of estimated β = 0.164 is 0.01997 which is small, and the slope is statistically significant given its z-value of 8.216 and its low p-value.
Interpretation: Since estimate of β > 0, the wider the female crab, the greater expected number of male satellites on the multiplicative order as exp(0.1640) = 1.18. More specifically, for one unit of increase in the width, the number of Sa will increase and it will be multiplied by 1.18.