I have a dataset which consists of 50 variables. I want to programmatically(using python) identify what is my dependent variable is. Are there any tests to separate the dependent variable from independent variables in the dataset?

Any ideas would be highly appreciated!

  • $\begingroup$ depends on what your variables are and the functions that relate them. If a variable's value changes when another of the variables change then it is dependent, otherwise independent. $\endgroup$ – Atirag Feb 12 at 8:57
  • 2
    $\begingroup$ If you don't know from outside the data which variable is dependent, I think you would have your work cut out to discover which it is. @Atirag's criterion seems to me no criterion at all, as a dependent variable can't be distinguished from its main predictors that way. $\endgroup$ – Nick Cox Feb 12 at 11:09
  • $\begingroup$ I'm voting to close this question as off-topic because this is misguided and not answerable with statistics. $\endgroup$ – mkt Feb 12 at 12:12
  • 1
    $\begingroup$ @mkt Being misguided isn't a criterion for closure. $\endgroup$ – Nick Cox Feb 12 at 12:23
  • 1
    $\begingroup$ This is a misunderstanding about statistics, or machine learning if anyone prefers. I initially voted to close as unclear but @Peter Flom's answer made it worth keeping in my view. $\endgroup$ – Nick Cox Feb 12 at 13:04

You cannot do this in the way you describe. Which variable is dependent is a matter for you to figure out from substantive knowledge.

Suppose you had a data set that consisted of height, weight and age of a bunch of adult humans. Which is the dependent variable? There's no way to know from just the numbers. Given what we know about humans, we can say weight is dependent on height and age. But the data don't tell us that and you could run a regression with any of these as the DV.

Or, if you had an experiment, then you would have to know which variables were manipulated by the experimenter. Suppose you had a randomized controlled trial in which some people got a medication and others did not and there was a variable for symptom severity and a bunch of other variables. Well, YOU know that the medication was manipulated. But the computer won't know unless you tell it.

EDIT: It reminds me of something I read (I think it was by Douglas Hofstadter but I am not sure and can't find it):

Computers are logical but not reasonable and people are reasonable but not logical.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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