search for: mcsamp

Displaying 5 results from an estimated 5 matches for "mcsamp".

2006 Jul 16
1
Manipulation involving arrays
...ot;for" loop with a faster construct. I tried things like "kronecker" and "outer" combined with apply, but couldn't get it to work. Here is a sample code: ########################## n <- 120 sigerr <- 5 covmat <- diag(c(8,6,3.5)) mu <- c(105,12,10) mcsamp <- 10000 Tbar <- array(0, dim=c(3,3,n)) # theta is a mcsamp x 3 matrix theta <- mvrnorm(mcsamp, mu = mu, Sigma = covmat) wt <- matrix(runif(n*mcsamp),n,mcsamp) wti <- apply(wt,1,sum) tarray <- array(apply(theta,1,function(x)outer(x,x)),dim=c(3,3,mcsamp)) for (i i...
2006 Jul 17
1
multiplying multidimensional arrays (was: Re: [R] Manipulation involving arrays)
...uter" combined with apply, but couldn't get it to work. > > > > > > Here is a sample code: > > > > ########################## > > n <- 120 > > sigerr <- 5 > > covmat <- diag(c(8,6,3.5)) > > mu <- c(105,12,10) > > mcsamp <- 10000 > > > > Tbar <- array(0, dim=c(3,3,n)) > > > > # theta is a mcsamp x 3 matrix > > theta <- mvrnorm(mcsamp, mu = mu, Sigma = covmat) > > > > wt <- matrix(runif(n*mcsamp),n,mcsamp) > > wti <- apply(wt,1,sum) > > > &...
2007 Mar 07
1
Failure to run mcsamp() in package arm
Dear r-helpers, I can run the examples on the mcsamp help page. For example: **************************************** > M1 <- lmer (y1 ~ x + (1|group)) > (M1.sim <- mcsamp (M1)) fit using lmer, 3 chains, each with 1000 iterations (first 500 discarded) n.sims = 1500 iterations saved mean sd 2.5% 25% 50% 75%...
2006 Feb 10
1
mcmcsamp shortening variable names; how can i turn this feature off?
I have written a function called mcsamp() that is a wrapper that runs mcmcsamp() and automatically monitors convergence and structures the inferences into vectors and arrays as appropriate. But I have run into a very little problem, which is that mcmcsamp() shortens the variable names. For example: > set.seed (1) > group &l...
2006 Jan 10
2
lmer(): nested and non-nested factors in logistic regression
Thanks to some help by Doug Bates (and the updated version of the Matrix package), I've refined my question about fitting nested and non-nested factors in lmer(). I can get it to work in linear regression but it crashes in logistic regression. Here's my example: # set up the predictors n.age <- 4 n.edu <- 4 n.rep <- 100 n.state <- 50 n <- n.age*n.edu*n.rep age.id