[R-sig-ME] Error message in lme function and question about the residual plot

li li hannah.hlx at gmail.com
Thu Jun 11 20:27:46 CEST 2015


Thanks very mcuh for reply.
  For question 1: There was a typo model 3. The model should be the following.
But I still get error message as follows.

> mod3 <- lme(fixed= res ~ method*time, random=~ 0+ method+ time | individual, data=one, weights= varIdent(form=~1|method))
Error in logLik.reStruct(object, conLin) :
  NA/NaN/Inf in foreign function call (arg 3)
  Thanks.
    Li

2015-06-11 13:44 GMT-04:00, Thierry Onkelinx <thierry.onkelinx at inbo.be>:
> You need to add type ="norm" to resid() to see the effect of varIdent.
>
> Make sure that assay is present in one before fitting model3
> Op 11 jun. 2015 19:23 schreef "li li" <hannah.hlx at gmail.com>:
>
>> Hi all,
>>   I have the following data frame named "one" in which there is a
>> grouping factor method with three levels. The varibility is very
>> different among the three groups seen from the plot. I am trying to
>> compare three models as follows. I have the following two questions:
>>   1. As you can see the third model does not seem to work. I am not
>> sure whether it is a convergent issue.
>>   2. The first model doesnot take into account the variance
>> heterogeneity issue while the second one does. However, when I compare
>> the residual plot between mod1 and mod2, there is not much difference.
>> The residual for the second model still has much larger variance for
>> methods 2 and 3 than the method 1.
>>
>>   Thanks very much!
>>   Hanna
>>
>>
>> > one
>>     method individual time       res
>> 1        3         12    0 101.40000
>> 2        3         12    3 101.50000
>> 3        3         12    6 101.50000
>> 4        3         12    9 101.30000
>> 5        3         12   12 100.70000
>> 6        3         12   15 101.00000
>> 7        3         12   18 101.50000
>> 14       3         10    0 101.30000
>> 15       3         10    3 101.20000
>> 16       3         10    6 101.50000
>> 17       3         10    9 100.70000
>> 18       3         10   12 101.50000
>> 19       3         10   15 101.30000
>> 20       3         10   18 101.30000
>> 27       3         11    0 100.70000
>> 28       3         11    3 101.10000
>> 29       3         11    6 101.90000
>> 30       3         11    9 100.80000
>> 31       3         11   12  99.80000
>> 32       3         11   15 100.60000
>> 33       3         11   18 100.60000
>> 40       3          1    0  97.50000
>> 41       3          1    3  97.40000
>> 42       3          1    6  97.70000
>> 43       3          1    9  97.40000
>> 44       3          1   12  97.30000
>> 45       3          1   15  96.70000
>> 46       3          1   18  96.60000
>> 54       3          3    0  98.10000
>> 55       3          3    3  98.50000
>> 56       3          3    6  97.90000
>> 57       3          3    9  97.90000
>> 58       3          3   12  97.70000
>> 59       3          3   15  98.00000
>> 60       3          3   18  98.50000
>> 67       3          6    0 100.20000
>> 68       3          6    3  99.60000
>> 69       3          6    6  99.90000
>> 70       3          6    9  99.90000
>> 71       3          6   12 100.30000
>> 77       3          2    0  98.90000
>> 78       3          2    3  98.90000
>> 79       3          2    6  98.70000
>> 80       3          2    9  98.90000
>> 81       3          2   12  98.80000
>> 82       3          2   15  97.80000
>> 83       3          2   18  98.90000
>> 90       3          4    0 100.20000
>> 91       3          4    3  99.80000
>> 92       3          4    6  99.50000
>> 93       3          4    9 100.40000
>> 96       3          5    0 100.70000
>> 97       3          5    3 100.30000
>> 98       3          5    6 100.70000
>> 99       3          5    9 100.50000
>> 102      3          7    0 100.90000
>> 105      3          8    0  99.30000
>> 108      3          9    0 100.20000
>> 111      3         13    0 101.00000
>> 114      3         14    0 100.80000
>> 117      3         15    0 100.40000
>> 8        2         12    0 108.00000
>> 9        2         12   12  97.00000
>> 21       2         10    0 112.00000
>> 22       2         10   12  93.00000
>> 34       2         11    0  98.00000
>> 35       2         11   12  96.00000
>> 47       2          1    0  94.00000
>> 48       2          1   12 103.00000
>> 49       2          1   18 103.00000
>> 61       2          3    0  87.00000
>> 62       2          3   12 105.00000
>> 72       2          6    0 119.00000
>> 73       2          6    3 105.00000
>> 74       2          6   12  91.00000
>> 84       2          2    0 105.00000
>> 85       2          2   12 112.00000
>> 95       2          4    0  96.00000
>> 101      2          5    0 113.00000
>> 104      2          7    0 106.00000
>> 107      2          8    0  71.00000
>> 110      2          9    0  95.00000
>> 113      2         13    0  88.00000
>> 116      2         14    0  86.00000
>> 119      2         15    0  81.00000
>> 86       1         12    0 105.90300
>> 94       1         12   12  99.82400
>> 10       1         12   15  91.26400
>> 11       1         12   18  72.15000
>> 191      1         10    0  91.14300
>> 201      1         10   12 100.36800
>> 211      1         10   15 104.79600
>> 221      1         10   18 102.58200
>> 301      1         11    0  78.32400
>> 311      1         11   12  88.20900
>> 321      1         11   15  95.52600
>> 331      1         11   18 106.87200
>> 411      1          1    0  99.04500
>> 421      1          1   12  82.83600
>> 431      1          1   15 116.51200
>> 441      1          1   18  89.05600
>> 52       1          3    0  97.81800
>> 53       1          3   12  89.81500
>> 541      1          3   15  82.11000
>> 551      1          3   18  79.83400
>> 611      1          6    0  89.06000
>> 621      1          6   12 102.56500
>> 701      1          2    0 112.32000
>> 711      1          2   12 104.40000
>> 721      1          2   15  90.06800
>> 731      1          2   18 107.28000
>> 781      1          4    0 125.92500
>> 831      1          5    0  95.16000
>> 851      1          7    0 111.28981
>> 87       1          8    0 102.22482
>> 89       1          9    0  91.61610
>> 911      1         13    0 111.18053
>> 931      1         14    0  91.70376
>> 951      1         15    0  98.04994
>>
>>
>>
>> library(nlme)
>> mod1 <- lme(fixed= res ~ method*time, random=~ 1+ time | individual,
>> data=one)
>> summary(mod1)
>> anova(mod1)
>>
>> mod2 <- lme(fixed= res ~ method*time, random=~ 1+ time | individual,
>> data=one, weights= varIdent(form=~1|method))
>> summary(mod2)
>> anova(mod2)
>>
>> mod3 <- lme(fixed= res ~ method*time, random=~ 0+ method+ time |
>> individual, data=one, weights= varIdent(form=~1|assay))
>> summary(mod3)
>> anova(mod3)
>>
>> par(mfrow=c(1,2))
>> plot(resid(mod1))
>> plot(resid(mod2))
>>
>> _______________________________________________
>> R-sig-mixed-models at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>
>



More information about the R-sig-mixed-models mailing list