dewittpe / cpr

Control Polygon Reduction: Methods for quick and efficient placement of internal knots for B-splines and tensor products of B-splines.
http://www.peteredewitt.com/cpr/
2 stars 0 forks source link

Redo generate_cp_formula_data #25

Closed dewittpe closed 11 months ago

dewittpe commented 7 years ago

There is no need to build a new data.frame. You only need to redesign the formula.

Things that need to happen:

  1. if any factors or characters set up the formula to include the needed I(var == level) elements
  2. return the formula

No need for a whole new data set. This change should save time and memory.

dewittpe commented 11 months ago

Thought - add formula and data to the cp or cn objects. This will also let the cpr and cnr calls reuse the data and formula instead of calling generate_cp_formula_data many times over.

Maybe keeping the regression models would make this a easier as the data and formula would be part of that obejct.

dewittpe commented 11 months ago

I think this can be made easier by looking for factors and characters in the formula. replace those variables in the data set with the expanded columns from a call to model.matrix. Update the formula to use the expanded factors/characters. If I pass in the whole data set passed to cp/cn then odd things like the id variable for geepack::geeglms shouldn't cause a special case in the calls (i hope)