Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Estimate nonlinear correlations between two variables

    Hi folks,

    Apologies for beginner question.

    In R, it is possible to estimate nonlinear correlations between two variables (e.g. https://towardsdatascience.com/estim...r-62c6571cb1db).

    Is there a similar function in Stata? I was a little unsure, but my thinking was:

    Perhaps one way could be to use regression with some splines and extract R^2 (the squared correlation), and taking the square root (though that loses the sign, as I think does the approach in nlcor). The sign would be interpreted from the coefficients / plots? Does anyone have potential code to do this, or perhaps there is a simpler way?

    Many thanks.
    Patrick

  • #2
    Patrick:
    you may want to take a look at -spearman- and -ktau-.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Carlo Lazzaro - many thanks. I may have misunderstood, but are spearman and ktau not largely limited to linear estimates (i.e. using rank order involves a loss of information about distance between observations, so cannot robustly estimate nonlinear correlations)?

      Comment


      • #4
        Patrick:
        as second thought, see Richard Williams 's excellent teaching notes on Nonlinear relationships at https://www3.nd.edu/~rwilliam/stats2/l61.pdf.
        Last edited by Carlo Lazzaro; 06 Aug 2019, 04:27.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          See also FAQ https://www.stata.com/support/faqs/s...ics/r-squared/

          Comment

          Working...
          X