# Finding independent variables which are effecting dependent variable

I am working on a movie pizza data set

movie data set example(single row)
Date        Day   Elite Seats Premium Seats NOM7 UM Pizzac
11/12/2012  "Tuesday"   230          300  2   4    5

NOM7 <- Number of movies whose release day is less than 7 days till
11/12/2012
UM <- Unique Movies on 11/12/2012


Now I would like to build a regression model but I am unable to know which independent variables are affecting pizza count

Since I am new to stats and machine learning I am sub-setting all data and just using elite and premium seat count

in some machine learning models, I saw formula where more than one independent variables exists Can I know what is the process which I must follow to know which factors are affecting my regression model

## 2 Answers

I guess that you are trying to identify all independent variables in your dataframe that influence your target variable. You can do variable selection by performing forward stepwise regression. Here is an example that you may try out:

df = data.frame(y=rnorm(20), var1=rnorm(20), var2=rnorm(20), var2=rnorm(20))
model = lm(y ~ 1, data=df)
biggest <- formula(lm(y~.,df))
fwd.model = step(model, direction='forward', scope=biggest)


if your goal is to reduce the number of variables going into a model, you can try principal component analysis, which will give you a new (orthonormal) basis for the data. The vectors in the new basis are aligned with the data such that they point in the direction of most variability.

You won't get the new data, but you can find the vectors (in the new basis) that account for most of the variability in the data.