I recently answered a question on CV and the asker checked my answer. Subsequently, the question was put on hold as off-topic. I invested time and effort into answering this question, and I believe along with the asker that my answer was helpful. Will my reputation points for answering this question be revoked because the question was deemed off-topic?
I'm surprised you haven't run into this several times already!
Writing an answer that helps the user (which you clearly did) doesn't make the answer on-topic. It's nice to help a user when we can but the question must still be on topic to stay open. [I've given dozens of answers to questions that were marked off topic - indeed, after reflection, I have marked as off topic a few questions I gave answers to myself.]
There are several things you can do about a question marked off-topic:
- where possible, you can encourage the OP to edit the question to make it more clearly on-topic (or if you could edit it yourself if you don't change the general sense of the question)
- if there's another SE site for which it is clearly on topic you can flag to migrate (and perhaps earn reputation there)
- if there's another SE site for which it would be on topic after an edit you can encourage the OP to edit to make it so (or again, edit yourself if you don't change the sense of the question), and you can flag to migrate
I presume you refer to this answer. In that case, to be on topic here, it would need to ask a more clearly statistical question than "which package do I need?"; with some (different) edits it might be on topic on StackOverflow or possibly another SE site.
You don't lose reputation when a question is closed. Deletion, however, can affect reputation in some circumstances (see the answer, under "Additionally").