# Is it possible to use the dependent variable to predict independent variable(s) in a data set?

I have a data set that contains cyclists traffic, the independent variables are: day of week, high temp, humidity

the dependent variable is: total number of cyclists for that day.

Is it possible to predict what day of the week it is based on a given number of cyclists for that day? If so, what method should be used?

essentially, can you predict/estimate a independent variable from a dependent variable

Info about data set: ~40 entries for each day of week

based on total cyclists how can I predict what day of week it is?

my current idea is to use multinomial Naive Bayes and swap the variables so that days of week are dependent categorical and total cyclists are the independent variable.

I am trying to solve this with python so any starter material around using the suggested method would be helpful but not required.

• Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
– Community Bot
Jul 26, 2023 at 15:20
• How is the "dependence" and "independence" of these variables currently determined? This sounds like an observational dataset. What would distinguish count of cyclists from any of the other variables from this perspective?
– whuber
Jul 26, 2023 at 18:50

"Dependent" and "independent" are not intrinsic properties of variables themselves, they are merely labels that describe how you use them. If you use X to predict Y, X is independent and Y is dependent, while if you use Y to predict X, Y is independent and X is dependent. Oftentimes you'll try to set the dependent and independent variables in a way that reflects causality, but it's not a requirement.

You seem to have defined your variables as "independent" or "dependent" based on domain knowledge of what is likely related or unrelated, but that sense of independence actually has nothing to do with the sense of dependent vs. independent variables in the context of statistical modelling. We can surmise that colloquially in the sense of causation, the day of the week cannot possibly "depend" on how many cyclists are out, but we can still build a model that treats it as such.

“Independent” and “dependent” variables describe how variables are used in a regression model. Without such a model, you just have variables.

The way you handle such a situation is to run a regression with the predictive variable(s) as independent as the outcome as dependent.

If you want to predict the day of the week from the number of cyclists, feel free to do so as you would predict anything else.

my current idea is to use multinomial Naive Bayes and swap the variables so that days of week are dependent categorical and total cyclists are the independent variable.

It is not clear that naïve Bayes is the right model over a multinomial logistic regression, random forest, or neural network (just to name a few), but $$1)$$ it might be, and $$2)$$ you’re getting the important idea that you can use whatever to predict whatever else if you would get use out of such a model.

• One possible issue is that the days of the week are cyclical. You might get better performance by treating it as a circular variable. The downside is that this is harder analysis to understand and explain to stakeholders.
– Dave
Jul 26, 2023 at 18:30