Yes, create a "dummy" (or indicator) variable (1,0) for each ID. This is sometimes called a "fixed effect", indicating the "identity" of each ID (in this case the movie series). So Star Wars can be expected to generate very different revenue than other films. In a linear model, the dummy will simply introduce a own intercept coefficient for each ID. So you can think of this as allowing Star Wars to have a structurally different turnover than other movie series.
There are many options to dummy-encode single columns in a DF, so that it os no problem to work with dummies/indicators. E.g. use model.matrix
in R
:
mydf = data.frame(c(1,1,2,2))
colnames(mydf)<-c("X1")
mydf$X1 <- as.factor(mydf$X1)
mydf
mymat = model.matrix(~ X1 -1 , data=mydf)
mymat
This will recode mydf
X1
1 1
2 1
3 2
4 2
To look like:
X11 X12
1 1 0
2 1 0
3 0 1
4 0 1
It is easy to illustrate how "dummies" work in a linear regression. Say your model looks like (ommiting subscripts $i$ for convenience):
$$y = \beta_0 + \beta_1 x + u,$$
where $\beta_0$ is the intercept, $x$ is a continuous feature, and $u$ is the error term. If you have two "IDs" (like Star Wars yes or no), you introduce an additional variable =1 if Star Wars and =0 otherwise. Call this vector $I$.
Now your model looks like:
$$y = \beta_0 + \beta_1 x + \beta_2 I + u.$$
When you predict a non-Star Wars film ($I=0$) you would do:
$$ \hat{y} = \hat{\beta_0} + x * \hat{\beta_1} + 0 * \hat{\beta_2}. $$
In case of a Star Wars film you would do:
$$ \hat{y} = \hat{\beta_0} + x * \hat{\beta_1} + 1 * \hat{\beta_2}. $$
So in this case the intercept term is $\hat{\beta_0} + \hat{\beta_2}$ and $\hat{\beta_2}$ is just what makes Star Wars different from the other film(s) in this simple illustration.