1
$\begingroup$

Can we transform the variables of a regression in MLR to sine , cosine, tan Then how to interpret the results if I get a good $R^2$ and good adjusted $R^2$

$\endgroup$
3
  • 1
    $\begingroup$ To sriram, whenever you undo the edit to your post, do have a reason why you were doing the same and whether it increased the readability further. $\endgroup$ Commented Apr 25, 2023 at 6:50
  • $\begingroup$ I don't understand what is being asked. Transform which variables? Dependent or independent? Or both? What is meant by "can"? Can you compute $\operatorname{tan}(n + \pi/2)$ or $\operatorname{cot}(n\cdot \pi)$? $\endgroup$
    – Firebug
    Commented Apr 27, 2023 at 11:12
  • $\begingroup$ Also, the answer depends on what you want to do with the regression. If you are interested in hypothesis testing over the coefficients, some transformations may possible invalidate the results. So, without further details, this is not answerable. $\endgroup$
    – Firebug
    Commented Apr 27, 2023 at 11:14

1 Answer 1

15
$\begingroup$

Yes. In particular, sine and cosine are not just convenient but often natural as ways of handling predictors in problems with periodic structure, in which at least some variation can be related to time of day (clock), time of year (calendar), or spatial direction (compass). See for example this paper as an introductory review. Interpretation is often straightforward, so that with compass direction in particular, sines and cosines are associated with East-West and North-South effects respectively, assuming that direction is measured conventionally with $0^\circ \equiv 360^\circ$ as North.

If you are modelling e.g. more or less direct or indirect effects of time of year, reflecting climatic variations, you may be lucky to find that even one (sine, cosine) pair of predictors works very well or at least helpfully. Other way round, modelling say effects of seasonality in socio-economic data may require several (sine, cosine) pairs, thus resisting simple interpretation. For that and other reasons people in economics or business may be more inclined to reach for a bundle of indicator variables to match religious or civic holidays, vacation times, and so forth. Time of week, although often obvious in effect, also tends to call for indicator variables, not sines and cosines.

Tangent and cotangent are much less common as transformations in regression in my experience. I would be especially wary about working with tangents if arguments were even close to odd multiples of $\pi/2$ radians or its equivalent. There is a similar pitfall with the cotangent for arguments that are even multiples of $\pi$ radians.

$\endgroup$
4
  • 2
    $\begingroup$ Short but concise thread. I also never come across any motivation of tangent transformation, let alone use of it. +1. $\endgroup$ Commented Apr 24, 2023 at 9:32
  • 3
    $\begingroup$ I'll share anecdotally that using day of the week as a mixed effect sometimes has had better test error than a superposition in forecasting resource demand. $\endgroup$
    – Galen
    Commented Apr 24, 2023 at 14:56
  • $\begingroup$ In pure maths tangent and its inverse arctan are sometimes used to get a continuous bijective transformation from the entire real line to a finite length interval. Abstractly that could be useful for regression analysis as well but I don't have a specific example. $\endgroup$
    – quarague
    Commented Apr 25, 2023 at 10:49
  • 2
    $\begingroup$ @quarague (1) Often arctan is used. Anyone presented with an analysis based on the arctan should therefore feel free to apply the inverse transformation if they feel that would improve the analysis or be more interpretable. (2) Observations are made of the rotation angle of a rotating lighthouse. If you wish to make a feature of the position of the point on shore that is illuminated, you will perform a tangent transformation of the angle. With this example in mind, you will be able to conceive of many other potential applications of a tangent transformation. $\endgroup$
    – whuber
    Commented Apr 25, 2023 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.