I'm trying to compute the cross-correlation between two time series xi and xj, each of length 100, in Wolfram Mathematica.
Here are my two lists:
xi = {0.3333333333283876`, 0.33333305506571376`, 0.3333329906221826`, 0.33333294825082654`, 0.33333283359447147`, 0.33333260262585057`, 0.3333322252592119`, 0.3333316553870631`, 0.33333083019191745`, 0.33332964718673336`, 0.3333279656537338`, 0.33332555924739027`,
0.3333220900078742`, 0.33331707097379676`, 0.3333098138291113`, 0.3332993419722573`, 0.3332843399199078`, 0.3332631102121616`, 0.3332333206480355`, 0.3331920644270133`, 0.33313529764711997`, 0.3330577171943063`, 0.3329528605812652`, 0.3328137010586426`,
0.33263357039274477`, 0.3324084769941597`, 0.332138059511054`, 0.33182613090158725`, 0.33148109756882244`, 0.33111068856605425`, 0.33071730923682857`, 0.3303019661068878`, 0.3298506631321902`, 0.3293471119566241`, 0.32877376266777136`, 0.3281148235051791`,
0.32736161236902195`, 0.3265087780758636`, 0.32555731494630297`, 0.32451228716943564`, 0.3233835141718948`, 0.3221705235070724`, 0.320875655092863`, 0.31950796845116725`, 0.3180642645271339`, 0.3165453970256945`, 0.314956497994097`, 0.3132975193817092`,
0.31157445808102197`, 0.3097901073129968`, 0.3079547254968479`, 0.30607402966253183`, 0.304159012287697`, 0.3022152406206821`, 0.3002510987384212`, 0.2982843486438012`, 0.2963307344414185`, 0.2944121554398477`, 0.2925543716654839`, 0.2907793224876965`,
0.2891075030589147`, 0.28755054214599574`, 0.2861198726235008`, 0.2848151103993362`, 0.283635256007092`, 0.28257458045638784`, 0.28161879704828197`, 0.28075920230669615`, 0.27998514479074277`, 0.2792857981784269`, 0.2786521625198615`, 0.2780801681429512`,
0.2775620715548438`, 0.2770932580306695`, 0.2766645085120039`, 0.2762725620996929`, 0.2759123032650656`, 0.27558079453194423`, 0.27527726288228577`, 0.2750001298570363`, 0.2747506081819589`, 0.27452759222638273`, 0.27432913970503797`, 0.27415029247774325`,
0.2739898220701608`, 0.2738451396244649`, 0.2737139134560014`, 0.27359913490705`, 0.2735017053899433`, 0.27342468557026733`, 0.273371367857095`, 0.27334249874791644`, 0.27333999342731674`, 0.2733612570351853`, 0.27340360709048545`, 0.2734653328534134`,
0.2735434258429037`, 0.2736375002112022`, 0.2737472231527988`, 0.2738728757775474`};
xj = {0.3333333333283876`, 0.3333330550693263`, 0.33333299064198463`, 0.3333329482572671`, 0.33333283355355603`, 0.3333326025644569`, 0.3333322252120491`, 0.3333316553390629`, 0.3333308300112076`, 0.3333296465113845`, 0.3333279635757157`, 0.333325553456171`,
0.33332207481693843`, 0.33331703287130476`, 0.33330972131861264`, 0.3332991199962099`, 0.33328381794735557`, 0.33326191387302717`, 0.33323062520695707`, 0.3331861959663794`, 0.33312281297608554`, 0.33303173704626854`, 0.3329002666209932`, 0.3327102873888713`,
0.33243663224493347`, 0.33204661974191246`, 0.3315016600714714`, 0.33076037495521016`, 0.3297798076080615`, 0.32853166004435524`, 0.32701305528837643`, 0.325231453015775`, 0.32323467724724164`, 0.32107692006561955`, 0.3188149349010592`, 0.3165024343721419`,
0.31417721319358044`, 0.3118701945730066`, 0.3095968087400568`, 0.30736115354257315`, 0.3051539838123929`, 0.30299520063839835`, 0.3008985900908532`, 0.29885841957207954`, 0.2969008930953596`, 0.295035687239855`, 0.29325467622536333`, 0.29156358523839154`,
0.2899556501599711`, 0.2884388951989434`, 0.28700305058944936`, 0.28565586838405976`, 0.28438991382017126`, 0.2832193010549134`, 0.2821587047232251`, 0.281205616690984`, 0.28038104139053477`, 0.27969438801827234`, 0.27914299960581224`, 0.2787306884109416`,
0.27845178148671806`, 0.2783145256948286`, 0.27830459107782807`, 0.2784301235741179`, 0.2786786313709517`, 0.27903334613646813`, 0.2795017398774802`, 0.28005957521668945`, 0.2806916753081819`, 0.2813908780205654`, 0.28215078209914446`, 0.28295021285984673`,
0.28379351280289505`, 0.28467018779576725`, 0.28559639516829394`, 0.2865580486009086`, 0.28755434691315407`, 0.2885807222401233`, 0.2896292424090134`, 0.29070273143130676`, 0.2917895302920882`, 0.29289137609898963`, 0.29400948757097073`, 0.2951584932540699`,
0.2963309759724171`, 0.2975311750928067`, 0.2987676651511446`, 0.30002583386983134`, 0.30130989110814793`, 0.3026146760315263`, 0.30393305421591793`, 0.3052707415371029`, 0.30661775467680363`, 0.3079850742946665`, 0.3093778036222959`, 0.3107915602740498`, 0.3122327443404581`, 0.3136954198165197`, 0.3151808626245918`, 0.31669000735559427`};
Cross-correlation between {Xi} and {Xj} is defined by the ratio of covariance to root-mean variance,
Sample covariance is found from
Similarly, sample cross-correlation is defined by the ratio
The initial code is shown below
n = Length[xi]; (*length of list*)
mxi = Mean[xi]; (*mean of list xi*)
mxj = Mean[xj]; (*mean of list xj*)
Yij = (1/n)Sum[(xi[[t]]-mxi)(xj[[t]]-mxj),{t,1,N}];
rhoij= Yij/(Sqrt[Sum[(xi[[t]] - mxi)^2, {t,1, n}]] Sqrt[Sum[(xj[[t]] - mxj)^2, {t,1,n}]])
rhoijh=(Sum[(xi[[t]]-mxi)(xj[[t]]-mxj)])/(Sqrt[Sum[(xi[[t]] - mxi)^2, {t,1, n}]]; Sqrt[Sum[(xj[[t]] - mxj)^2, {t,1,n}]])
ListLinePlot[{rhoij,rhoijh},
AxesLabel -> {"Lag", "Correlation"}, PlotRange -> All,
PlotStyle -> Thick]
Anybody can help me to implement and plot these cross-correlation?



Nandn) is from a 9-year member. Perhaps you're having difficulty in reality, but it's not a reason for asking careless question in this site. The question will be reopened once it meets the standard of the site. $\endgroup$