A few questions about my workflow for quickly investigating data!

The problem with smooth=true not working is exactly because you have 0 passed to log so fitting a regression fails - just like your manual try.

Therefore do:

@df filter(:deaths => >(0), covid) scatter(:dateRep,log.(:deaths),group= :countriesAndTerritories, legend =:topleft, smooth=true)

and all will be nice.

If you would not want to drop 0s I typically recommend log(x+1) transform:

@df covid scatter(:dateRep,log.(:deaths .+ 1),group= :countriesAndTerritories, legend =:topleft, smooth=true)

Of course then the plot and the regression changes as you include 0s in the data and the transform is a bit different.

2 Likes