I want to use the mvrnorm function in R, but I get an error that my sigma is negative. I created some data and used log likelihood functions to estimate the best parameters for my model. I now want to test if these parameters are significantly different from zero. I thought to do this by making use of the mvrnorm function and than do a t-test for every parameter. For the mvrnorm I used the estimated parameter as the mean and as covariance matrix the inverse of the information matrix. However I get an error while running the mvrnorm that my sigma matrix is negative. How can I now test if my parameters are significantly different from zero? Should I make the sigma matrix positive definite and if so how can I do this?
You can simply perturb your original matrix by adding small diagonal elements, i.e. $A\leftarrow A+\mu I$, where $\mu$ is chosen a small value to guarantee the PD property. You can simply try out some values.
Another alternative can be using
make.positive.definite method in package
corpcor, which implements the algorithm provided here. In his blog, the author of the algorithm also provides other implementations that you can use.