Am 09.12.2017 um 00:01 schrieb Allin Cottrell:
On Fri, 8 Dec 2017, Sven Schreiber wrote:
> Sorry, a P.S. question about nadarwat() and also the other
> nonparametric estimator "loess()": Why are both only implemented as
> functions instead of commands? For estimators I would have expected a
> command.
For any parametric estimator, yes, a command would be expected. With
parametric estimation, predicted values may be of interest but in the
first instance interest centers on the parameter estimates, and the user
naturally wants to see them (along with standard errors, etc.).
But with loess and nadarwat (and also svmpred) there's nothing of much
interest _other than_ the predicted values. Commands don't return
anything, so instead we implement these as functions that return the
predictions series.
If we implemented the non-parametric estimation functions as commands,
what (if anything) would we print? We could print the predictions, I
suppose, but that's unlikely to be of much use; the user would need an
accessor to actually "get hold of" them. So we return the predictions
instead.
Yes that makes sense. OTOH for estimation commands we now have the
$model bundle which also holds meta stuff like $T and so on (I think).
Perhaps it could be useful to extend that to the non-parametric
estimators as well. Something like an optional bundle-pointer argument.
But these are just thoughts about design principles, I don't currently
have an explicit use case for it.
cheers,
sven