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