harvard-ufds / saeczi

Small Area Estimation for Continuous Zero Inflated data
https://harvard-ufds.github.io/saeczi/
Other
4 stars 2 forks source link

matrix multiply 'by hand' #9

Closed graysonwhite closed 8 months ago

graysonwhite commented 8 months ago

this PR adds removes the need for predict.merMod and does the matrix multiplication for prediction by hand.

Currently, my code is far from pretty, but from my initial testing this does give the same result as our initial predict.merMod approach, but with a significant speed increase.

@joshyam-k, could you take a close look at this code and make any needed changes for merging this. I know, for one, the lines 76 and 95 need to be changed to not be hard coded to "COUNTYFIPS".

In summary,

lines 74 - 78 create the matrices needed for prediction in the Gaussian model 81 - 90 allow for prediction on new levels for the Gaussian model 91-92 create the initial y.hat from the Gaussian model 94-97 set up the matrices and do the prediction from the Binomial model

100-104 pass the product of y.hat and p.hat into the same form as before

joshyam-k commented 8 months ago

Closing this as I prepare to open a pull request with similar changes in a large overhaul!