[ADMB Users] crappy software

Ben Bolker bbolker at gmail.com
Sun Oct 30 21:19:58 PDT 2011


On 11-10-31 11:59 AM, dave fournier wrote:
> I don't think most people even care whether the software works.

  I do, I'm just busy!

  I can give you an R script, but I was trying to be ambitious/elegant
about it, so it's not done yet ... it's easy enough to simulate from R,
anyway:

simfun <- function(n,beta=c(1,1),tau=0.001,
                   Cor=matrix(c(1,0.25,0.25,1),nrow=2)) {
    D <- expand.grid(id=factor(1:n),t=1:3)
    D$x <- rnorm(3*n)  # x_{it} ~ N(0,1)
    X <- model.matrix(~x,data=D)
    Z <- model.matrix(~id-1+id:x,data=D)
    b <- MASS::mvrnorm(n,mu=c(0,0),Sigma=tau^2*Cor)
    D$y <- rbinom(nrow(D),
                  prob=plogis(X %*% beta + Z %*% c(b)),
                  size=1)
    D
}

> Anyway If I output the data from the simulator in a file like
> 
> 
>    x1             x2               x3        Y1    Y2    Y3
>  0.818846 0.782839 -0.449841    0 0 0
>  0.26365 1.50276 -0.536648    0 0 0
>  0.171608 -0.171408 -0.871537    0 0 0
>  0.815544 -1.56534 -0.603267    1 0 1
>  1.22148 1.48879 1.56945    0 0 0
>  0.300354 0.174603 1.18029    0 0 0
>  0.738757 -1.67821 -0.190645    1 1 1
>    .....
> 
> 
> 
> maybe someone can give me the R script to run the model on it.
> _______________________________________________
> Users mailing list
> Users at admb-project.org
> http://lists.admb-project.org/mailman/listinfo/users




More information about the Users mailing list