Strangely if I comment out control as below it runs or if I set "control=treat" it runs. However I get different results in with these two methods. The commenting out method gives a summary result that is closer to the old vignette:
However the result isn't close enough for me to feel confident that this is correct (e.g. within .01).
Both the paper referenced in mediate's documentation for gam and the old vignette imply that the by variables should be indicator variables. The current jobs data does not have this form: treat is binary but control is a factor. If I create a new variable jobs$control.1 <- 1 - jobs$treat I can then set the by options sensibly, but again I don't get the values from the old vignette. I've also tried just using the spline by factor controlsince the gam documentation suggests that creates an interaction by itself anyways. Altogether I've explored a number of alternatives, and the closest to the old vignette seems to be the "comment out control" listing above.
The demo for code here for
gam
interactions no longer runs and gives error "Error in predict.gam(new.fit.Y, type = "response", newdata = pred.data.t) : 0 not in original fit". This appears to be an error that happens when predict.gam is given unknown factor levels.Strangely if I comment out
control
as below it runs or if I set "control=treat" it runs. However I get different results in with these two methods. The commenting out method gives a summary result that is closer to the old vignette:However the result isn't close enough for me to feel confident that this is correct (e.g. within .01).
Both the paper referenced in
mediate
's documentation forgam
and the old vignette imply that theby
variables should be indicator variables. The currentjobs
data does not have this form:treat
is binary butcontrol
is a factor. If I create a new variablejobs$control.1 <- 1 - jobs$treat
I can then set theby
options sensibly, but again I don't get the values from the old vignette. I've also tried just using the spline by factorcontrol
since thegam
documentation suggests that creates an interaction by itself anyways. Altogether I've explored a number of alternatives, and the closest to the old vignette seems to be the "comment out control" listing above.