0

I am trying to sample from skew normal distributions of following 4 variables (MAT - mean annual temperature, Tmin - minimum temperature, MAP - mean annual precipitation, and WQP - precipitation of warmest quarter) using sn package in r. And, their xi, omega, and alpha are as follows.

s_xi <- c(8.9, -1.5, 673.5, 202.7)
s_Omega <- matrix(c(2.1, 2.9, 76.3, -2.3,  
                2.9, 4.9, 9.4, 0.4, 
                76.3, 94.6, 22614.1, 2519.0, 
                -2.3, 0.37, 2519, 915.2), 4,4, byrow=TRUE)
s_alpha <- c(1.8, -4, 6.7, -3.6)

camp_sample2 <- rmsn(n=1000, xi=s_xi, Omega=s_Omega, alpha=s_alpha)

When I ran bivariate sampling of MAT and MAP, it worked fine with the same code. However, above code of 4 variables would not work. I get following error message.

camp_sample2 <- rmsn(n=1000, xi=s_xi, Omega=s_Omega, alpha=s_alpha) Error in pd.solve(Omega) : x appears to be not symmetric

Can anyone interpret this error message? and help me with the correct coding?

gugi
  • 11
  • 2
  • I found out why the error occurred by myself. I am posting the answer in case some other people might encounter the same issue. For the rmsn() function to work, it does not allow negative values for input variable. So, convert all your data into positive number e.g., by adding constant number before running the analysis. After generating the sample, you can re-convert sample data by subtracting the same constant number you added. – gugi Sep 23 '22 at 17:44

0 Answers0