[R] Problems with stepAIC

Stephan Kolassa Stephan.Kolassa at gmx.de
Sat Sep 29 14:53:44 CEST 2012


Hi Katja,

try fitting the original model using ML (not REML) with the parameter 
method = "ML":

PModell1 <-lme(sqrt(Earthwormsm.2)~ 
Treatment+Pflanzenfrischmasse+aBodenfeuchte+bBodenfeuchte+Gfrischmasse+Ltrockenmasseanteil+KCN+I+Eindringtiefe,
random=~1|Block/Treatment/Cluster/Patch, data=Test1,na.action = na.omit, 
method = "ML")

Good luck!
Stephan


On 29.09.2012 09:36, Katja wrote:
> Dear help community,
>
> I'm a R-beginner and use it for my master thesis.
> I've got a mixed model and want to analyse it with lme. There are a lot
> Cofactors that coult be relevant. To extract the important ones I want to do
> the stepAIC, but always get an error warning.
>
> Structure of my data:
> data.frame':   72 obs. of  54 variables:
>   $ Block                      : Factor w/ 3 levels "A","B","C": 1 1 1 1 1 1
> 1 1 1 1 ...
>   $ Treatment                  : Factor w/ 3 levels "1","2","3": 1 1 1 1 1 1
> 1 1 2 2 ...
>   $ Paddock                    : Factor w/ 9 levels "A1","A2","A3",..: 1 1 1
> 1 1 1 1 1 2 2 ...
>   $ Cluster                    : Factor w/ 4 levels "1","2","3","4": 1 1 2 2
> 3 3 4 4 1 1 ...
>   $ Growth                     : Factor w/ 2 levels "s","t": 1 2 1 2 1 2 1 2
> 1 2 ...
>   $ Patch                      : Factor w/ 72 levels "A1_1s","A1_1t",..: 1 2
> 3 4 5 6 7 8 9 10 ...
>   $ Lufttemperatur             : num  17.3 17.3 17.3 17.3 17.3 ...
>   $ NSmm                       : num  0 0 0 0 0 0 0 0 0 0 ...
>   $ Luftfeuchte                : num  79.2 79.2 79.2 79.2 79.2 ...
>   $ Windstärke                 : num  0.96 0.96 0.96 0.96 0.96 0.96 0.96 0.96
> 1.27 1.27 ...
>   $ Bodentemperatur            : num  18.1 18.1 18.1 18.1 18.1 ...
>   $ Earthwormsm.2              : num  0 0 0 20 24 60 12 20 0 4 ...
>   $ Biomassgm.2                : num  0 0 0 24.5 17.8 ...
>   $ meanBiomassg               : num  0 0 0 1.227 0.743 ...
>   $ Species                    : num  0 0 0 1 2 2 0 0 0 1 ...
>   $ Juvenilem.2                : num  0 0 0 4 4 1 2 3 0 0 ...
>   $ JuvenileRate               : num  NA NA NA 80 80 ...
>   $ AdultsRate                 : num  NA NA NA 20 20 ...
>   $ Pflanzenfrischmasse        : num  139 803 189 739 261 ...
>   $ Pflanzentrockenmasseanteil : num  27.8 29.3 28.7 40 27.7 ...
>   $ NAnteilGesamt              : num  2.38 3.35 2.47 2.21 2.55 4.45 2.33 2.23
> 2.3 1.68 ...
>   $ CAnteilGesamt              : num  43.9 45 45 43.6 43.8 ...
>   $ aBodenfeuchte              : num  24.4 21.8 14.7 18.2 23.9 ...
>   $ bBodenfeuchte              : num  17.3 15.6 NA NA 19.1 ...
>   $ cBodenfeuchte              : num  NA NA NA NA NA ...
>   $ Gfrischmasse               : num  84.6 739.3 130.8 566.8 94 ...
>   $ Gtrockenmasse              : num  25.6 215.4 41.7 239.4 30.5 ...
>   $ Gtrockenmasseanteil        : num  30.2 29.1 31.9 42.2 32.5 ...
>   $ GtrockenmasseanteilanGesamt: num  78.8 98.3 86 96 76.5 ...
>   $ GN                         : num  2.1 3.35 2.31 2.17 2.28 ...
>   $ GC                         : num  43.8 45 44.9 43.6 43.5 ...
>   $ GCN                        : num  20.9 13.4 19.4 20.1 19.1 ...
>   $ Lfrischmasse               : num  12.1 0 0 0 19 ...
>   $ Ltrockenmasse              : num  2.56 0 0 0 3.92 1.84 0 0 2.2 0 ...
>   $ Ltrockenmasseanteil        : num  21.2 0 0 0 20.7 ...
>   $ LtrockenmasseanteilanGesamt: num  7.89 0 0 0 9.83 1.06 0 0 3.73 0 ...
>   $ LN                         : num  3.96 NA NA NA 4.09 ...
>   $ LC                         : num  43.1 NA NA NA 45.6 ...
>   $ LCN                        : num  10.9 NA NA NA 11.1 ...
>   $ Kfrischmasse               : num  20.16 8.96 38.48 56.24 31.2 ...
>   $ Ktrockenmasse              : num  4.32 3.64 6.8 10 5.44 ...
>   $ Ktrockenmasseanteil        : num  21.4 40.6 17.7 17.8 17.4 ...
>   $ KTrockenmasseanteilanGesamt: num  13.32 1.66 14.01 4.01 13.64 ...
>   $ KN                         : num  3.09 3.11 3.43 3.37 2.95 ...
>   $ KC                         : num  45 48.3 46 44 44.3 ...
>   $ KCN                        : num  14.6 15.5 13.4 13.1 15 ...
>   $ I                          : num  2.12 1.4 0.92 0.49 1.03 0.53 1.36 0.51
> 1.1 2.31 ...
>   $ II                         : num  2.61 3.97 2.82 NA 1.94 1.98 2.84 1.66
> 2.38 1.99 ...
>   $ III                        : num  2.24 3.51 3.17 NA 2.95 3.12 2.16 3.65
> 3.14 2.83 ...
>   $ IV                         : num  2.52 2.91 3.11 NA 1.97 4.39 3.22 4.61
> 2.26 2.77 ...
>   $ V                          : num  2.38 2.91 2.61 NA 3.34 3.32 3.21 NA
> 2.44 2.26 ...
>   $ VI                         : num  2.01 2.61 2.61 NA 3.61 3.57 NA NA 3.06
> 2.18 ...
>   $ VII                        : num  NA 3.73 2.61 NA 3.25 0.27 NA NA NA 3.04
> ...
>   $ Eindringtiefe              : int  64 80 80 8 80 61 55 32 73 80 ...
>
> model fo the first parameter I want to check:
>
> PModell1 <-lme(sqrt(Earthwormsm.2)~
> Treatment+Pflanzenfrischmasse+aBodenfeuchte+bBodenfeuchte+Gfrischmasse+Ltrockenmasseanteil+KCN+I+Eindringtiefe,
> random=~1|Block/Treatment/Cluster/Patch, data=Test1,na.action = na.omit)
>
> Everytime I try stepAIC with different settings:
>
>> Modell2<- stepAIC(PModell1, method=lme)
>> Fehler in extractAIC.lme(fit, scale, k = k, ...) :
>    AIC für REML-Näherung undefiniert
> englisch: Error in extractAIC.lme(fit, scale, k = k, ...) :  AIC for
> REML-Approximation undefined
>
> Same when I do extractAIC:
>> extractAIC(PModell1)
>> Fehler in extractAIC.lme(PModell1) : AIC undefined for REML fit
>
> Can anybody tell me what's wrong here? Package MASS is running, there ist no
> error.
>
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Problems-with-stepAIC-tp4644583.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>




More information about the R-help mailing list