Issue adding covariates to tsps model
Hi,
I'm encountering an issue when specifying different covariates for the first and second stages in a tsps model.
For example: tsps("outcome ~ exposure + covariates_stage2 | instrument + covariates_stage1")
I'd like to include covariates only in the second stage (covariates_stage2) and not in the first stage (covariates_stage1). However, when I try this, I get the following error:
Error in moments[, i] <- (X - linearpredictor) * Zwithcons[, i] : incorrect number of subscripts on matrix
Do I need to include the same covariates in both stages? Or is there a way to specify covariates only for the second stage without this error?
Any help would be appreciated!
Hi there.
It's my understanding that one should include the same covariates in the first and second stages for both the TSPS and TSRI models.
If you know of a reference that argues against this do let me know.
I think I should issue a more informative error message when different covariates are included, so I'm grateful you could work out what was causing your error.