I have been trying to fit some data with a linear regression. I don't have any theoretical assumptions on the regression, and from what I know both an intercept or no intercept can be plausible results.
In the evaluation of the goodness of fit, I came across two different definitions of $R^2$, the most general one
$$ R^2 = 1 - \frac{SS_{res}}{SS_{tot}} $$
where $SS_{res}$ is the sum of squares of residuals and $SS_{tot}$ is the total sum of squares, and another definition that is justified only in the case of a fit with intercept
$$ R^2 = \frac{SS_{reg}}{SS_{tot}} $$
where $SS_{reg}$ is the regression sum of squares and the condition $SS_{tot} = SS_{reg} + SS_{res}$ is verified.
I know that some softwares (like R) use the second definition, with a "modified" version of $R^2$ in the case of no intercept, that can give conflictual results and this is a problem that has been already addressed. In another question I read that also for the first definition I should use a modified version of $R^2$ in the case of no intercept.
What I want to understand is if there is a general definition of $R^2$ that is always applicable? If there isn't one, in what way can I compare the goodness of a fit with intercept and a fit without intercept, and ultimately to choose between the two? Thank you in advance