Table function
- To: mathgroup at smc.vnet.net
- Subject: [mg54974] Table function
- From: Adam Getchell <agetchell at physics.ucdavis.edu>
- Date: Tue, 8 Mar 2005 05:04:23 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Hi all, Thanks to your help, I've gotten my time series data arranged as year-columns of values during trading days. So now I'm calculating the correlation matrix, C_i,j = 1/(246)*[Sum over k=1 to 246]z_i(k)*z_j(k) where C_i,j is the individual correlation matrix, z_i(k) is the k-th row in the i-th column vector of data, and z_j(k) is the k-th row of the j-th column vector of data, e.g. 40 100 50 110 60 120 70 130 Then C_1,1 = (1/246)*[40*40+50*50+60*60+....] and C_1,2 = (1/246)*[40*100+50*110+60*120+....] So yes the matrix is symmetric. I'm using the following mathematica code for 105 columns each with 246 rows of data: CorrelationMatrix=Table[1/246*correlationinput[[i,k]]*correlationinput[[j,k]],{i,1,105},{j,1,105},{k,1,246}] where the values are stored in the matrix correlationinput. However, the errors I get are: In[31]:= CorrelationMatrix = Table[(1/247)* correlationinput[[i,k]]* correlationinput[[j,k]], {i, 1, 105}, {j, 1, 105}, {k, 1, 246}] From In[31]:= \!\(\* RowBox[{\(Part::"partw"\), ":", "\<\"Part \\!\\(106\\) of \\!\\({40.37`, 49.31`, 60.41`, 68.13`, \ 70.44`, 64.32`, 64.6`, 47.77`, 70.39`, 95, \\(\\(\[LeftSkeleton] 95 \ \[RightSkeleton]\\)\\)}\\) does not exist. \\!\\(\\*ButtonBox[\\\"More\ \[Ellipsis]\\\", ButtonStyle->\\\"RefGuideLinkText\\\", ButtonFrame->None, \ ButtonData:>\\\"General::partw\\\"]\\)\"\>"}]\) From In[31]:= \!\(\* RowBox[{\(Part::"partw"\), ":", "\<\"Part \\!\\(106\\) of \\!\\({40.37`, 49.31`, 60.41`, 68.13`, \ 70.44`, 64.32`, 64.6`, 47.77`, 70.39`, 95, \\(\\(\[LeftSkeleton] 95 \ \[RightSkeleton]\\)\\)}\\) does not exist. \\!\\(\\*ButtonBox[\\\"More\ \[Ellipsis]\\\", ButtonStyle->\\\"RefGuideLinkText\\\", ButtonFrame->None, \ ButtonData:>\\\"General::partw\\\"]\\)\"\>"}]\) From In[31]:= \!\(\* RowBox[{\(Part::"partw"\), ":", "\<\"Part \\!\\(107\\) of \\!\\({40.37`, 49.31`, 60.41`, 68.13`, \ 70.44`, 64.32`, 64.6`, 47.77`, 70.39`, 95, \\(\\(\[LeftSkeleton] 95 \ \[RightSkeleton]\\)\\)}\\) does not exist. \\!\\(\\*ButtonBox[\\\"More\ \[Ellipsis]\\\", ButtonStyle->\\\"RefGuideLinkText\\\", ButtonFrame->None, \ ButtonData:>\\\"General::partw\\\"]\\)\"\>"}]\) From In[31]:= \!\(\* RowBox[{\(General::"stop"\), ":", "\<\"Further output of \\!\\(Part :: \\\"partw\\\"\\) will be \ suppressed during this calculation. \ \\!\\(\\*ButtonBox[\\\"More\[Ellipsis]\\\", ButtonStyle->\\\"RefGuideLinkText\ \\\", ButtonFrame->None, ButtonData:>\\\"General::stop\\\"]\\)\"\>"}]\) From In[31]:= No more memory available. Mathematica kernel has shut down. Try quitting other applications and then retry. From In[5]:= Part::"partw":"Part \!\(106\) of \!\({40.37`, 49.31`, 60.41`, 68.13`, 70.44`, \ 64.32`, 64.6`, 47.77`, 70.39`, 95, \(\(\[LeftSkeleton] 95 \ \[RightSkeleton]\)\)}\) does not exist. \!\(\*ButtonBox[\"More\[Ellipsis]\", \ ButtonStyle->\"RefGuideLinkText\", ButtonFrame->None, \ ButtonData:>\"General::partw\"]\)" From In[5]:= Part::"partw":"Part \!\(106\) of \!\({40.37`, 49.31`, 60.41`, 68.13`, 70.44`, \ 64.32`, 64.6`, 47.77`, 70.39`, 95, \(\(\[LeftSkeleton] 95 \ \[RightSkeleton]\)\)}\) does not exist. \!\(\*ButtonBox[\"More\[Ellipsis]\", \ ButtonStyle->\"RefGuideLinkText\", ButtonFrame->None, \ ButtonData:>\"General::partw\"]\)" From In[5]:= Part::"partw":"Part \!\(107\) of \!\({40.37`, 49.31`, 60.41`, 68.13`, 70.44`, \ 64.32`, 64.6`, 47.77`, 70.39`, 95, \(\(\[LeftSkeleton] 95 \ \[RightSkeleton]\)\)}\) does not exist. \!\(\*ButtonBox[\"More\[Ellipsis]\", \ ButtonStyle->\"RefGuideLinkText\", ButtonFrame->None, \ ButtonData:>\"General::partw\"]\)" From In[5]:= General::"stop":"Further output of \!\(Part :: \"partw\"\) will be suppressed \ during this calculation. \!\(\*ButtonBox[\"More\[Ellipsis]\", \ ButtonStyle->\"RefGuideLinkText\", ButtonFrame->None, \ ButtonData:>\"General::stop\"]\)" Which, if the above doesn't come out (using DrBob's " Copy As InputForm"), says I am looking at non-existent parts of the matrix (106, etc) and also running out of memory on this calculation. Thanks for any suggestions. --Adam Getchell
- Follow-Ups:
- Re: Table function
- From: DrBob <drbob@bigfoot.com>
- Re: Table function