Group Abstract Group Abstract

Message Boards Message Boards

0
|
6.4K Views
|
6 Replies
|
1 Total Like
View groups...
Share
Share this post:

Remove one element within a nested list or create lists of equal length

Posted 4 years ago
port = {"^GSPC", "GLD", "VCSH"};
ret1 = QuantityMagnitude[
FinancialData[#, "Return", {2021}]["Values"]] & /@ port;
In[120]:= Length[#] & /@ {ret1[[1]], ret1[[2]], ret1[[3]]}

Out[120]= {169, 168, 168}

I have three sub-lists of unequal length. How could I remove, say the first element in the first list?? I have tried Drop without success. Better yet, how would I create the three lists of equal length in the first place???

Thanks much for the help.

POSTED BY: Raymond Low
6 Replies
Posted 4 years ago

Take a look at the documentation for Rest and Most. FinancialData returns a TimeSeries. There are many functions available for time-series processing. For time-series correlation, take a look at this post on MSE and this one on this site.

POSTED BY: Rohit Namjoshi
Posted 4 years ago
POSTED BY: Bill Nelson
Posted 4 years ago

Hi Bill The correlations between no deletion and 1 day deletion enter image description here

I plotted the graphs, but Return is the % change in price from the day before, so the charts just looks like noise.
enter image description here

I did average the Return, which did reduce the error caused by the one day deletion. enter image description here

Below is the Notebook

POSTED BY: Raymond Low
Posted 4 years ago

"Surprising" and "such a difference from such a small change" always makes me think "I've made a mistake in this somehow."

Perhaps the time stamps might be too important to discard. Is there any way you could do a ListPlot with the time stamps and another without the time stamps and see if the reason for the large change becomes obvious? If that explains things then would interpolating the {value,time} points to construct value=function[time] still make your computations easy

POSTED BY: Bill Nelson
Posted 4 years ago
POSTED BY: Raymond Low
Posted 4 years ago
POSTED BY: Bill Nelson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard