tidyfun / refundr

Tidier regression with functional data
1 stars 0 forks source link

`type` arg in `predict.fpca`? #11

Open jeff-goldsmith opened 4 years ago

jeff-goldsmith commented 4 years ago

right now predict.fpca returns a tfb object (coefs from scores, basis from fpca). makes a lot of sense, but sometimes people just want the scores and not the fitted values. can we handle that with type?

ideally this will work smoothly with modelr etc too

jeff-goldsmith commented 3 years ago

just a couple more thoughts on this -- sort of related to 7c0fc0e283654baca12107277d619ac5a7425034

i wrote a function that extracts scores from an fpca object, of the kind returned by rfr_fpca. that object is a bit different from what you'd get from predict.fpca (which is just a tfb ...). so, for predict, you can convert the tfb to an fpca object and then extract scores.

kinda clunky, but i'm not sure exactly how users are likely to interact with tfbs and fpca objects. i suppose we could extract scores from either using the same function, or encourage users to convert tfbs to full fpca things if they want to worry about FPCA stuff (and not just represent data using a basis expansion).

also, am i just completely missing some easier option? do we make it simple to extract coefficients from tfb objects in tidyfun ..?