1
$\begingroup$

Im writing my thesis, which a monte-carlo study aimed at generating datasets for comparing the performance of various regression models (Neural networks amongst others). And since neural networks can fit some very complicated distributions, i am simulating breakpoints in the data (currently by different local means, and different distribution families).

But my question is then; is it possible to simulate a dataset with two different correlation matrices? (eg. different local relationships with the Y-term)

For at timeseries, I assume it would be suitable/ok, but does it make sense for an experimental setup, with no relation to time series?

Here's an illustration of the idea:

    #defining the two correlation matrices for the cholesky transformation:
    R1 <- matrix(c(   1, 0.2, 0.3,
                    0.2,   1,   0,
                    0.3,   0,   1),byrow = TRUE, nrow = 3, ncol = 3)

    R2 <- matrix(c(   1,   0.3, 0.4,
                      0.3,   1,   0,
                      0.4,   0,   1),byrow = TRUE, nrow = 3, ncol = 3)

    #part one of the dataset
    U = t(chol(R1))
    nvars = dim(U)[1]
    numobs = 5000
    set.seed(1234)
    random.normal = matrix(rnorm(nvars*numobs,100,5), 
                           nrow=nvars, ncol=numobs);  
    X = U %*% random.normal
    X1 = as.data.frame(t(X))

    #part two of the dataset
    U = t(chol(R2))                                   #different corr. matrix
    nvars = dim(U)[1]
    numobs = 5000
    set.seed(1234)
    random.normal = matrix(rnorm(nvars*numobs,200,5), #different local mean
                           nrow=nvars, ncol=numobs);  
    X = U %*% random.normal
    X2 = as.data.frame(t(X))

    #Combining the two datasets 
    Xfinal <- rbind(X1,X2)

    #looking at the correlation afterwards:
    cor(as.matrix(Xfinal))

#          V1        V2        V3
#V1 1.0000000 0.9941870 0.9946056
#V2 0.9941870 1.0000000 0.9936319
#V3 0.9946056 0.9936319 1.0000000


#look at the distributions for first column:
plot(density(X1[,1]))
plot(density(X2[,1]))
plot(density(Xfinal[,1]))

enter image description here

Ideally I would want different relationships around the two local means. Am I breaking some statistical assumptions in this way?

Snce the goal is to predict the first column of the dataset, I would be able to validate the performance of the algorithm of choise, which is the overall goal of my thesis.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.