• We are pleased to announce that the winner of our Feedback Prize Draw for the Winter 2024-25 session and winning £150 of gift vouchers is Zhao Liang Tay. Congratulations to Zhao Liang. If you fancy winning £150 worth of gift vouchers (from a major UK store) for the Summer 2025 exam sitting for just a few minutes of your time throughout the session, please see our website at https://www.acted.co.uk/further-info.html?pat=feedback#feedback-prize for more information on how you can make sure your name is included in the draw at the end of the session.
  • Please be advised that the SP1, SP5 and SP7 X1 deadline is the 14th July and not the 17th June as first stated. Please accept out apologies for any confusion caused.

Design Matrix

E

entact

Member
For the following dataset:

Design Matrix

Exp Clms Size Type
500 42 small 1
1200 37 medium 1
100 1 large 1
400 101 small 2
500 73 medium 2
300 14 large 2

Is the correct design matrix, X:

1 1 0 0
1 0 1 0
1 0 0 0
1 1 0 1
1 0 1 1
1 0 0 1

So the base will size(large) and type(1).

I've imported this data in Emblem modelling software and fit the first iteration only. The attachment 'Betas.jpg' is the results I am getting for the betas. The 'mean' as described in the attachment is size(large) and type(1).

I have also attached the results of the 1st Iteration showing the fitted values. I am trying to replicate these values!

So my design matrix, X, is above. Next is the W matric. I have attached the formula which Emblem give for a Poisson with log link (attachment: 'formulae.jpg'). I assume the wi in the formula is the Exp (exposure years) column in the data above? I know mu in the formula is a function of inital estimate of betas. I have attached the note in the Emblem guide where they discuss the initial fit and a brief discussion of intial mu (attachment: 'Initial Fit Instructions.jpg'). It gives 2 options for inital mu. The first, average y, I assume is the (sum of Clms)/(sum of Exp) so a so the vector initial mui is:

.08933
.08933
.08933
.08933
.08933
.08933

Is this correct. If so the diag(wi.mui) would be:

500*.08933 0 0 0 0 0 0

0 1200*.08933 0 0 0 0

0 0 100*.08933 0 0 0

...

...

...

Finally, the linear predictor at the end of the formula

Β(1st iteration)=(X_T.W.X)^(-1).X_T.W.η

is log(mui(initial))

so...

η vector is:

log(.08933)
log(.08933)
log(.08933)
log(.08933)
log(.08933)
log(.08933)


When I put all of this together I get the following values for my betas from iteration 1 I get

-2.415
0
0
0

Which is clearly wrong and doesn't match the betas from the attached.

The fitted values I get are a vector of all same values:

.08933
.08933
.08933
.08933
.08933
.08933

Whereas the values in the attachment (Fitted Values...) are

.104833
.045030
...
...
...
...

If anyone can help solve this and shed some light for me it would be brilliant. I'm only interested in the 1st iteration so if you knew it would take 2 minutes in excel to do the matrix multiplication and put me out of my misery.

Many thanks in advance
 

Attachments

  • Betas.png
    Betas.png
    12.7 KB · Views: 88
  • Formulae.jpg
    Formulae.jpg
    8.5 KB · Views: 66
  • Initial Fit Instructions.jpg
    Initial Fit Instructions.jpg
    13.8 KB · Views: 84
Back
Top