I have created three objects in r (each a 3x4 matrix). I need to do some simple arithmetic on the objects. I want to create a new object that has the same 3x4 structure by multiplying each object by each respective element in each object. For example, WCS_New 1,X1 = [WCS 1,X1 times WSCH 1,X1 times WCSC 1,X1] , WCS_New 1,X2 = [WCS 1,X2 times WSCH 1,X2 times WCSC 1,X2] ... WCS_New 4,X3 = [WCS 4, X3 times WSCH 4, X3 times WCSC 4,X3]. My understanding is that this is not matrix multiplication. It's analogous to multiplying the same cell across different worksheets in Excel.
I am struggling with how to code this in R, and was hoping there is an easy solution. The actual objects are much bigger (5000 x 1000), so I wanted to avoid loops. I'm rather new at this so I apologize for the convoluted explanation. A picture of the objects are as follows:
WCS
WCSH
WCSC
And the reprex code is as follows:
library(tidyverse)
library(reshape2)
library(tidybayes)
library(Sim.DiffProc)
library(VineCopula)
library(ESGtoolkit)
library(reprex)
# Create monte carlo simulation for WCS prices
set.seed(4580)
WCS <- ABM(N =3,M=3,x0=-21.50,t0=0,T=96,Dt=NULL,theta=-0.0001,sigma=0.30)
# Create monte carlo simulation for WCS H
set.seed(4580)
WCSH <- ABM(N =3,M=3,x0=-6.75,t0=0,T=96,Dt=NULL,theta=-0.0001,sigma=0.10)
# Create monte carlo simulation for WCS Har
set.seed(4580)
WCSC <- ABM(N =3,M=3,x0=-8.00,t0=0,T=96,Dt=NULL,theta=-0.0001,sigma=0.10)
Thanks in advance.