I am trying to model the number of (web) page-visits that different products receive during a period of time, using different characteristics of these products. I am using a linear regression model:
$Y_i$ ~ $a_i + b_i + c_i + \epsilon$, where $a_i, b_i$ and $c_i$ correspond to the different characteristics of the product with id $i$, and $Y_i$ is the total number of views that product $i$ has received over a one-month period.

I need to control for day of the month since in general, higher promotions/discounts are offered towards the end of the month, so the page-visits are higher the closer we get to the end of month, regardless of the product type. However, this is not possible as $Y_i$ is (an aggregate representing) the total number of views that product $i$ has received over the one-month period.

So, instead, I am planning to introduce to the model an additional independent variable $z_i \in [1,30]$ which is a summary statistic of $Y_i$ representing the mean of the days of the month of the product's page-visits. So if most visits for product $i$ took place on day 28 of the month, then $z_i$ would be higher than in the case where the visits mostly happened in the first week.

However, it seems to me that this might be an incorrect way of thinking since $z$ is a summary statistic related to $Y$, in other words, related to the time of the page-visits of the product and not day of the month (or how close it is to the end of month). My question is, can I still use $z$ as a control variable in this case, and if so, can I say that products get more visits as we move closer to the end of the month (of course assuming that the coefficient for $z$ is positive and significant)?
Is there a better way of doing this?

Any insights are appreciated. Thanks.
P.S. I am using R.

  • $\begingroup$ "I need to control for day of the month" Why? If you're interested in the aggregate over a month, why do you need to take into account the distribution within a month? Are your instances (the different $i$) per visits? $\endgroup$ – Ami Tavory Mar 5 '18 at 9:00
  • $\begingroup$ @AmiTavory My rationale behind introducing the day of the month is due to the following: if you happen to be browsing a product around the end of the month, you are very likely to also browse other (e.g., similar) products for many reasons like ads and news, etc. So some products get a high number of visits simply because people browsed other products during a busy period, and they wouldn't have had this many visits otherwise. Maybe you are right, even in this case taking into account the distribution within a month is not needed? $\endgroup$ – NadTeX Mar 5 '18 at 9:47

Your Answer

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

Browse other questions tagged or ask your own question.