The main problem is that R is case sensitive, so the line
MultN = list(Matlist = Matlist, Params = Params)
should be
MultN = list(Matlist = MatList, Params = Params)
Notice that I changed Matlist
to MatList
.
I think a misplaced )
will still give you a problem that won't cause an error in the line
MultN = rmvnorm(vec[4],c(vec[2],vec[3],matrix(c(vec[5],vec[1],vec[1],vec[6]), 2, 2, byrow = FALSE)))
I'm guessing that you really want
MultN = rmvnorm(vec[4],c(vec[2],vec[3]),matrix(c(vec[5],vec[1],vec[1],vec[6]), 2, 2, byrow = FALSE))
In your code, you've spent the time to make a matrix that looks like it's supposed to be the variance-covariance matrix in the call to rmvnorm()
, but the misplaced )
will turn that back into a vector, so while you may be expecting to have two means and an interesting variance-covariance matrix, you end up with six means and a variance-covariance matrix of diag(6)
.
Hope this helps. Good luck!