Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Does this bootstrap code work the way I intend it to?

    Click image for larger version

Name:	kanskje.png
Views:	1
Size:	75.4 KB
ID:	1747950


    Hello I have attached the bootstrapping code I'm currently using. I've run the code several times and it gives me a plausible answer. However, I'm very new to bootstrapping and this sort of coding, so I'd like to make sure it works the way I hope it does. The intension is to draw ONE random stock each month (from month 241 to 770). Then store that stocks monthly return and add it all up for the 530 different months I have in the dataset. Then i want it to calculate the mean for that iteration. Lastly I want it to calculate the mean for all the average monthly returns from my iterations. The variables I use from the dataset are yearmonth, which is the number for the month (starting at 241 to 770), unik which is the number of unique stocks within the yearmonth, isin which is a unique id for the stock, and lastly monthlyreturn which is the monthly return for a stock that month.
    Last edited by Ole Groendahl; 26 Mar 2024, 18:27.

  • #2
    Edit: I've run the code with noisily display isin["random_index"] name["random_index"] within the loop that finds and stores the monthly return for each month, and see that it usually picks the same 4-5 stocks each month. Number of unique stocks varies from 54 to 340 depending on the month, so picking the same 4-5 stocks every time should be impossible. Please help.

    Comment

    Working...
    X