[R] loess plotting problem

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Thu Mar 23 15:48:33 CET 2023


В Thu, 23 Mar 2023 19:48:40 +0530
Anupam Tyagi <anuptyagi using gmail.com> пишет:

> lines(loess(si_pov_gini ~ ny_gnp_pcap_pp_kd, gini_pci_wdi_narm))

lines() on an object of class "loess" ends up calling
lines.default(...), which uses xy.coords(...) to obtain the points to
plot, which, in turn, ends up extracting the $x and $y components from
the list returned by loess(). The structure of the "loess" object is
_not_ documented, but it turns out that the $x and the $y components
are the source data points which were originally used to fit the model,
not the smooth predictions.

Solution: use predict() on the loess object in order to obtain the
smooth predictions.

-- 
Best regards,
Ivan



More information about the R-help mailing list