Closed cblandhol closed 4 years ago
Done!
The problem was related to how I checked for collinearity in the splines. Early on in the function, I construct a temporary variable in the data as a placeholder for each spline. I then construct a design matrix with all the interactions requested by the user, with the splines being replaced by the temporary variables. If R decides to omit a temporary variable due to collinearity, then I know to omit the corresponding spline as well.
I wasn't careful enough with how I named and searched for the temporary variables.
This is why problems cropped up once the size of the support of x
exceeded 10.
e.g. tmpvar1
was getting confused with tmpvar10
.
The code should run now, but you'll have to crank up initgrid.nu
and audit.nu
to be very large (it worked for me when I had initgrid.nu = 500
).
The reason is that your MTRs are really flexible, so the problem will be unbounded unless your grid is sufficiently dense.
I assume this is okay now, so I'll close it!
I assume this is okay now, so I'll close it!
Thank you, it works well now!
When a factor variable which takes on 10 values or more is interacted with a constant spline, and the knots vary by the value of x, I get a similar error message as issue #156.
Some notes:
See the example below.