0

I have five data frames among which I want to run regressions:

  • df1: stock returns
  • df2: housing returns
  • df3: actual inflation rate
  • df4: expected inflation rate
  • df5: unexpected inflation rate

Dataframe example

Dataframe example

Each of the data frames has the same format as above, with only different data inside it.

I want to do separate regression of housing and stocks against expected and unexpected inflation as below:

df1[i] ~ df4[i] + df5[i]

df2[i] ~ df4[i] + df5[i]

I want to compare the results of regression for periods where actual inflation (included in df3) is higher than the median value with periods where actual inflation is lower than the median value. For doing that, I need to create two subsamples from each data frame based on the value that each column has in df3. Since I don't have a deep knowledge of R, I don't know how to do it. Is it possible to do it? and how? Or is it better to create 13 different data frames for each country?

Thank you in advance!

AnilGoyal
  • 25,297
  • 4
  • 27
  • 45
Albi351
  • 1
  • 1
  • 3
    Please post a sample of each of your data frames, it would be much easier to help you. – Anoushiravan R Apr 03 '21 at 11:03
  • I've tried to edit my question to include the example of my dataframe as an image. However, I don't know if I've well explained my problems – Albi351 Apr 03 '21 at 14:04

0 Answers0