Structure dataset for LMER-model


New Member

I want to prepare my dataset for a LMER model conducted using Statsmodels in Jupyter Notebook. I have crossectional and longitudinal data, and have therefor been advised to use LMER. But I need help to understand how I should structure my collected data in a csv file.

My dataset contains 11672 observations regarding 14 different stocks measured over a time period of 15 days.

For each day I have collected information about the traded Volume and Price for each of the stocks. I.e they are time series.

The variable I want to predict the growth in Volume and Price is called Sentence Score - it's a compound score regarding the sentiment about a stock. This variable can be registered multiple times over the course of each day, but I also have a few occurances with no registered Sentence Score for a specific day. Sentence Score attains values between -1 & 1.

Below is an example of the current format which my data is saved in.


What I intend on doing later is to fit a LMER-model where my DV is Volume, measured over time(Date 1-15), grouped by Stock, and where the Score is the IV. Then the same but with Price as DV instead.

I've been conducting these sources, but with little success:
1 & 2

I have not done something like this before so I appreciate any input I can get.
Thank you!
Last edited: