When converting my model to a map_rect formulation, I am wondering how to tell the likelihood not to fit certain elements of the input data. In particular, I was going to elementwise multiply the data with a boolean (0-1 matrix in stan) matrix to tell the likelihood to not include those elements in the parameter fit.

Currently, I am doing a for loop over the data and I have an if statement that skips the data point if it corresponds to a 0 in the boolean matrix.

How can I replicate this in the map_rec formulation? Do I need to incorporate this if functionality in the function passed into map_rect?