Long Z
2003-Mar-01 16:58 UTC
[R] error message from gls(), unstructured in lower triangle, identical diagonal, help.
Hi, nlme users, I am fitting a model for repeated measures, using gls(). The var-cov structure is UNSTRUCTURED in lower triangle and identical for the diagonal, for which I still have no idea how to fit using PROC MIXED. The error message is as follows: Error in "coef<-.corNatural"(*tmp*, value log((cStNatPar + 1)/(1 - cStNatPar))) : NA/NaN/Inf in foreign function call (arg 1) I have no idea why that will happen, since the same codes work well for other similar data. The data and the codes are as follows. I am wondering whether I can get help here. Thanks a lot! Peng Liu ------------------------------ Peng Liu | Division of Statistics | Northern Illinois University | De Kalb, IL 60115, USA | E-mail: pliu at math.niu.edu | ------------------------------ ########Here are the codes and data########## sample <- cbind(c(1.831573,0.820619,2.081226,1.441899,-1.316942,-0.9153977,-2.615172,0.6244147,-1.384212,0.2537837,-0.008428624,-0.4111116,-0.919574,-1.69364,-0.7349749,-1.608629,-0.03456573,-2.322608,-0.7962107,-1.161889,0.8634877,1.062846,-0.7290675,0.1593192,0.5629082,-0.2773188,-0.8110306,1.516512,0.3191615,2.066002,1.492041,-0.2712102,-0.907483,-1.251194,0.1067267,-1.893993,-0.05563948,0.3225586,0.9530283,-0.9470236, -1.183466,-0.8254096,0.2745802,-0.09157914,-1.137616,-1.010385,-0.3922027,-1.622668,-0.878803,-0.7586166,0.4662699,-0.3748910,-1.181506,-0.009744484,-0.2503955,-0.167983,0.4440732,0.5867642,1.074624,0.4537496,2.009861,0.1448494,-0.8916145,0.6610586,-1.306448,-1.301082,-0.7900978,-1.809101,-0.5169003,-0.4365317,0.6808186,-0.1231397,-2.118134,-1.166811,-0.9272828,-2.372523,0.1543802,1.369601,0.2327486,1.138620, -1.519021,-2.049833,0.7442267,-0.7025775,0.04518552,-1.169271,-0.09720012,0.3490697,-1.229996,-1.631016,-3.404595,-2.917325,0.081256,-0.05817446,0.8030733,0.03814584,-0.7191387,0.9275563,-1.138103,-1.531016,0.5430816,1.144775,-0.7662923,0.3517145,2.241299,0.4542238,1.166567,1.269506,-2.063319,-1.661397,-2.112718,-2.168209,-0.01513848,-1.018248,-0.375433,-1.830825,2.301888,1.649184,2.666166,2.497785, 0.3834129,0.5868564,-0.874599,-0.351699,-0.3735526,0.7182726,0.1732434,1.384503,1.377456,1.85285,0.340099,1.549716,-0.3473703,0.8082551,0.3906645,-0.1855657,-1.873152,-1.932688,-2.061348,-0.7435891,-1.465873,-2.190746,-0.4280419,-0.7422656,-0.8705315,-0.4861004,0.414328,-1.606564,1.138383,2.173107,1.099662,0.6287685,-0.9623125,0.4057413,0.2073339,1.087254,0.6524806,-0.3654337,0.2532572,0.0263857), c(37,37,37,37,19,19,19,19,13,13,13,13,6,6,6,6,9,9,9,9,27,27,27,27,33,33,33,33,36,36,36,36,12,12,12,12,26,26,26,26, 14,14,14,14,8,8,8,8,17,17,17,17,11,11,11,11,28,28,28,28,35,35,35,35,4,4,4,4,21,21,21,21,3,3,3,3,31,31,31,31, 22,22,22,22,15,15,15,15,2,2,2,2,23,23,23,23,25,25,25,25,30,30,30,30,39,39,39,39,1,1,1,1,10,10,10,10,40,40,40,40, 18,18,18,18,32,32,32,32,34,34,34,34,24,24,24,24,5,5,5,5,7,7,7,7,16,16,16,16,38,38,38,38,29,29,29,29,20,20,20,20), c(1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4, 1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4, 1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4, 1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4)) sample <- as.data.frame(sample) names(sample) <- c("y", "subj", "time") sample <- groupedData(y~time | subj, data=sample) sample.gls <- gls(y ~ 1, sample, correlation=corSymm(form=~1|subj), weights=NULL) Error in "coef<-.corNatural"(*tmp*, value log((cStNatPar + 1)/(1 - cStNatPar))) : NA/NaN/Inf in foreign function call (arg 1)
P L
2003-Mar-02 23:35 UTC
[R] error message from gls(), unstructured in lower triangle, identical diagonal, help.
> It's just by chance that this happened: the > correlation you generated > was not strong enough, or was far from an > unstructured correlation and > the algorithm did not converge (and you obtained > this error message). > Generate another sample might solve the problem. >I think that you help me on the right point. Since nlme() uses EM and Newton-Raphson in sequence, other than that PROC MIXED uses Newton-Raphson only, as I know, I am wondering whether PROC MIXED can circumvent this situation. But the problem is as what I mentioned in the first mail, which is I do not know how to structure the var-cor with unstructured lower triangle and identical diagonal in PROC MIXED.> You might try "for fun" but it does not make much > sense to me.I am now doing a project which needs to generate random samples, and fit them using mixed models with different var-cov structures. If the problem that I met is common, then I need to revise my codes a little bit. Thank you for breaking my problem. Peng ------------------------------ Peng Liu | Division of Statistics | Northern Illinois University | De Kalb, IL 60115, USA | E-mail: pliu at math.niu.edu | ------------------------------