# Non-linear regression: Developing the functional form

I'm extremely new to this and stats/regressions in general so apologies if this question is not great or seems too simple. Let me know and I can expand/provide further info.

The study I'm looking at is the relationship between the average proportion of males per occupation over time (2001-2014) and average occupational socioeconomic status score over the same time period. I'm using Excel and Stata.

From the scatter plot below we know it's not a linear regression so have been trying non-linear regressions however both myself and my supervisor are not up to speed on these. We know how to work out the parameters in Excel and then how to transfer this into a Stata non-linear regression however we are stuck at the very first step of developing the functional form.

I have roughly drawn the regression line (what we suspect it will look like) on to the scatter plot just using the draw function in Microsoft Word.

Can anyone suggest a functional form for this line? Or a way of finding out what it could be? So far we have tried:

$\begin{array}{rcl} y & = & a+\sin(x)+1 \\ y & = & a+\sin(x)+1+(b^2) \\ y & = & a+\sin(x)+1+(\log B) \end{array}$

Where '$x$' equals the Status Index score in $\pi$ terms i.e. $$(\pi/2)+(2\pi-[\pi/2]/100)*(\text{Status index score}).$$

I have also just been trying a polynomial form:

$$Y_i=B_0+B_1 X_{1i}+B_2(X_{1i})^2$$

Where $B_1$ is a negative number. However this is also not working. I've added a screenshot of the data I'm working with.

As you can see we are just experimenting with functions at the moment so any sort of direction would be great. Thanks.

• Why do you need an explicit functional form? – Glen_b -Reinstate Monica Nov 16 '16 at 10:26
• Could you post the data? – Dimitriy V. Masterov Nov 16 '16 at 18:30
• @Glen_b I think I need an explicit functional form to run the nonlinear regression in Stata. I will try and add the data into my original question. And also another function I am trying. – K. Wright Nov 17 '16 at 1:41
• You need an expicit form to run a nonlinear regression, sure, but why nonlinear regression? Why not fit a nonparametric model of the relationship between y and x? (e.g. spline smoothing, local linear regression/LOESS, or local-mean nonparametric regression like Nadaraya-Watson etc etc) – Glen_b -Reinstate Monica Nov 17 '16 at 1:51
• rather than post an image of your data, why not post it as text, so people can actually make use of it? If you paste it in, don't forget to indent 4 spaces using the code tool ("{$\,\!$}") – Glen_b -Reinstate Monica Nov 17 '16 at 4:27

While you need an explicit form to run a nonlinear regression, why do you need nonlinear regression rather than something else?

For example, why not fit a nonparametric model of the relationship between y and x? (e.g. spline smoothing, local linear regression/LOESS, or local-mean nonparametric regression like Nadaraya-Watson etc etc)

I'd also suggest you consider that as a proportion approaches 1 or 0 the standard error must tend to become smaller than when it's near the middle because it can't go outside the 0-1 bounds. It may make more sense to work on a transformed scale, whether using a variance-stabilizing transform or (perhaps better) by using a model for the data that takes account of the fat that the response is a proportion. Do you know the denominators for the proportion of males for each point, at least approximately?

Here I fitted a smooth curve (lowess rather than LOESS though the differences aren't that major, and I chose that simply because I could remember the arguments) on the arcsin-sqrt scale then transformed the fit back. Because the variation from linearity was small for most of the range I used a large fraction (5/6) in the width parameter ($f$):

However by the look of it I could probably have gone higher. (If you're wedded to a nonlinear fit, his suggests a broken line or bent cable fit might be visually pleasing, but if you just need a fitted curve some nonparametric fit should be fine)

It would likely have made little difference if I'd directly calculated a lowess smooth on the original proportions (i.e. ignoring the fact that the ones near 1 will have smaller uncertainties). Note that in the absence of information at the time of calculation, I pretended the denominators of the proportions were all similar here.

Given the possibility of getting denominators on the proportions, a GAM based on logistic regression might be highly suitable. You'd certainly avoid the issue of predicting proportions outside [0,1] as in your plot.