How to plot both linear regression and Loess curve in Scatter / Bubble chart?

GaryKG
GaryKG New Altair Community Member
edited November 5 in Community Q&A
Reference: Retrieve <dataset> -> Show ExampleSet Result -> Visualizations -> Scatter / Bubble

Question: In Regression Interpolation, I'd like to be able to view both the Linear line and Loess (smoothing) curve on the same plot.

Is there any way to do it without adding a second stacked plot? Stacking seems to be a klugy way to accomplish something that should be fairly simple. Based on my experience with so many other platforms, while RM is way better, this feature lacks checkboxes that would add one or more lines in a scatter plot.

Please help.

Answers

  • RolandJones
    RolandJones
    Altair Employee
    Hi @GaryKG,

    At this time, you would need to add the second plot. I will raise this as an RFE. What would be the application for seeing both simultaneously, just so I can add more details?

    In the meantime, you can save specific chart configurations which you can then load in later. This is done on the left hand side under the plot controls.

    Best,

    Roland
  • GaryKG
    GaryKG New Altair Community Member
    Hi Roland,

    Thanks for your response and willingness to raise an RFE. Here is the argument in favor of this feature:

    When performing exploratory data analysis, it helps to visually identify non-linearities. A reasonably reliable way to do this visually is to plot both the straight line (least squares) and the Loess (smoothing line). When the Loess line does not overlap with the straight line (or only differs marginally), it is reasonable to infer linearity. 

    Here is an example:



    This helps analysts investigate the amount of linearity and determine if it is significant or not.

    Here is an example of various options that are very useful in scatterplots (that I do not see in the current RM implementation) from the Rcmdr package in R (I'm showing only the 'Least-squares line' and 'Smooth line' showing checked):



    I hope this helps.

    Thanks,

    Kiran