Request for review of formula -> code translation

I’ve attempted to translate a previously published algorithm into R code, but I’m not sure if I’ve got it right. I’d be very grateful for some feedback. I’ve posted the algorithm and my code here:



thanks @benmarwick so it looks like you’ve sorted it out now given ?

Yes, case closed! Think I’ve got it correct now.

great, glad its sorted