Hi,
I am a novice Stata user and I am trying to implement a multilevel model with mixed command in a panel data. I am using Stata MP 16.0 edition.
There are 3 stores with 25 product categories that are sold to customers living in various zip codes during the period of 26 months. Some customers live within the area of store and some don't. I first implemented a zipcode-time fixed effects specification with reghdfe command to analyze the effect of store opening on total sales. The unit of analyis is zipcode-month. I successfully ran the following: reghdfe log_sales store_open_dummies, absorb (ibn.zipcode i.month) vce (cluster zipcode)
Now, I am trying to expand the model to product categories so that I can account for heterogenous effect across categories. Some products may benefit from the store opening more than others. The unit of analysis becomes zipcode-month-category. The equation that I am trying to implement should have a fixed effect intercept for each category across months (month-category fixed effect), random intercept for each category across zip codes (zipcode-category random intercept) and random slopes (coef) for each store across categories of store_open_dummies. Stores are independent from each other and within each store, there is a dependency across categories since categories all come from the same distribution. The dataset has ~240,000 observations.
I tried the following 4-level model. Is this the accurate way to do this?
mixed log_sales c.month, || store: || category: store_open_dummies, cov(uns) || zipcode:
Unfortunately, I got the following error:
" unable to allocate matrix;
You have attempted to create a matrix with too many rows or columns or attempted to fit a model with too many variables.
You are using Stata/MP which supports matrices with up to 65534 rows or columns. This is the maximum matrix size.
If you are using factor variables and included an interaction that has lots of missing cells, try set emptycells drop to reduce the
required matrix size; see help set emptycells.
If you are using factor variables, you might have accidentally treated a continuous variable as a categorical, resulting in lots of
categories. Use the c. operator on such variables."
Is there anything I can do to avoid this error so that the model runs? I tried some other versions of this command and I got the same error except the following which worked ok.
mixed log_sum_bask_rev store_open_dummies || category: || zipcode:
Thank you in advance for any help, input, feedback...
I am a novice Stata user and I am trying to implement a multilevel model with mixed command in a panel data. I am using Stata MP 16.0 edition.
There are 3 stores with 25 product categories that are sold to customers living in various zip codes during the period of 26 months. Some customers live within the area of store and some don't. I first implemented a zipcode-time fixed effects specification with reghdfe command to analyze the effect of store opening on total sales. The unit of analyis is zipcode-month. I successfully ran the following: reghdfe log_sales store_open_dummies, absorb (ibn.zipcode i.month) vce (cluster zipcode)
Now, I am trying to expand the model to product categories so that I can account for heterogenous effect across categories. Some products may benefit from the store opening more than others. The unit of analysis becomes zipcode-month-category. The equation that I am trying to implement should have a fixed effect intercept for each category across months (month-category fixed effect), random intercept for each category across zip codes (zipcode-category random intercept) and random slopes (coef) for each store across categories of store_open_dummies. Stores are independent from each other and within each store, there is a dependency across categories since categories all come from the same distribution. The dataset has ~240,000 observations.
I tried the following 4-level model. Is this the accurate way to do this?
mixed log_sales c.month, || store: || category: store_open_dummies, cov(uns) || zipcode:
Unfortunately, I got the following error:
" unable to allocate matrix;
You have attempted to create a matrix with too many rows or columns or attempted to fit a model with too many variables.
You are using Stata/MP which supports matrices with up to 65534 rows or columns. This is the maximum matrix size.
If you are using factor variables and included an interaction that has lots of missing cells, try set emptycells drop to reduce the
required matrix size; see help set emptycells.
If you are using factor variables, you might have accidentally treated a continuous variable as a categorical, resulting in lots of
categories. Use the c. operator on such variables."
Is there anything I can do to avoid this error so that the model runs? I tried some other versions of this command and I got the same error except the following which worked ok.
mixed log_sum_bask_rev store_open_dummies || category: || zipcode:
Thank you in advance for any help, input, feedback...
Comment