search for: simualtion

Displaying 4 results from an estimated 4 matches for "simualtion".

2008 Jun 26
2
constructing arbitrary (positive definite) covariance matrix
...from [-1, 1]) that will always be positive definite? I have noticed that covraince matrices created using the following COV function are positive definite for -0.5 < r <1. However, for r < -0.5, the matrix is not positive definite. Does anyone have any idea why this is the case? For my simualtion, I need to generate multivariate data for the whole range of r, [-1, 1] for a give value of sd. Any help/ suggestion would be greatly appreciated. Examples ######## COV<-function (p = 3, sd = 1, r= 0.5){ cov <- diag(sd^2, ncol=p, nrow=p) for (i in 1:p) { for (j in 1:p) {...
2003 Sep 03
1
glmmPQL probelm
...e. Those are the two error messages I usually get: Error in logLik.reStruct(object, conLin) : NA/NaN/Inf in foreign function call (arg 3) Error in solve.default(pdMatrix(a, fact = TRUE)) : Lapack routine dgesv: system is exactly singular The trick is that the model is a part of a simualtion run, which uses the same starting variance covariance matrix as a source for a mutlivariate normal simulated 2 level dataset. So the variations in the data set are just a part of the stochastic process. In the majority of the cases the model runs fine, while in some cases I get either of the two er...
2003 Oct 25
0
memory optimization and use of recursion
Hi listers, In light with the recent discussion on the optimizing the use of memory in straneous proceudres i present you m problem, and hope to some additional ideas. I'm running a simualtion that in each step uses quite an amount of memory (but not exceedingly) - just to give you an idea - I create a pseudo population (n=1000, m=3) run lme and lm model and multiply impute (M=5) and do the pooling and final staistics calculation. Each simulation has 1000 cycles. I repeat the simulation...
2003 Mar 03
0
R-devel RNG change
...version. I also suggest the addition of a small function to query and set all aspects of random number generation. I find it is very useful to program with a construct like: simulate <- function(model, rng=NULL, ...) {if(is.null(rng)) rng <- set.RNG() # current settings to return with simualtion object else {old.rng <- set.RNG(rng); on.exit(set.RNG(old.rng)) } ... } and know that I have all the information for reproducibility. Below is a version of this that I have been using for a few years. Its main shortcoming is that it only considers the uniform generator and n...