[R-sig-ME] R console not responding after defining variable as factor

Douglas Bates bates at stat.wisc.edu
Fri Aug 27 00:26:39 CEST 2010


On Thu, Aug 26, 2010 at 3:29 PM, Sabira el Messlaki
<S.elMesslaki at student.tudelft.nl> wrote:
> Dear list members,

> I have a problem running the lme model. The problem is caused by the random factor TransJaarCod. TransJaarCod is a factor with 12 levels. If I run the underneath model without defining TransJaarCod (R recognize it by default as interval)  as a factor the model works fine, but when I define TransJaarCod as a factor the R console turns not responding. I thought it was because of a lack of memory on my notebook but I tried the same on my desktop and the same happens there.

> model3.7.fit <- lme(y ~ x1+LnBankt500+Perceelkwaliteit+LnNS_Afstand+PGebouwd+Bouwjaar_cat4+LnBanIndDistr500+LeegstandJaar_L2, random = ~TransJaarCod|GebID,data, method = "REML")

It's not that the console has frozen - it's that the R process is
going to be very, very busy for a long time (and possibly run out of
memory space).  When you include a random effect specification with a
continuous covariate you need to estimate 3 variance components - 2
variances and a covariance.  When you have a factor with 12 levels you
need to estimate 12 variances and 66 covariances.  That will take a
very long time, if it could be done at all.

You should reconsider the form of your model.

> Can someone please help me out.
>
>
>> str(data)
> 'data.frame':   695 obs. of  35 variables:
>  $ nr                      : int  59 72 74 89 129 130 145 146 157 168 ...
>  $ GebID                   : Factor w/ 165 levels "AFC-01","ALA-01",..: 16 20 21 23 32 32 36 36 38 41 ...
>  $ TransJaarCod            : int  1 1 1 1 1 1 1 1 1 1 ...
>  $ L_3L750                 : int  2100 500 0 2000 42100 42100 41250 41250 10910 42100 ...
>  $ LnRHuurM2               : num  4.72 5.27 5.17 5.21 5.07 ...
>  $ LnReis_opaf_m           : num  0.945 1.446 0.236 1.187 0.896 ...
>  $ LnNS_Afstand            : num  6.46 7.28 6.89 7.24 6.6 ...
>  $ LnIC_afstand            : num  7.98 7.28 6.89 7.46 6.6 ...
>  $ LnBankt500              : num  5.54 6.93 7.68 6.71 8.46 ...
>  $ LnBanIndDistr500        : int  152 218 566 114 1776 1776 1175 1175 327 3607 ...
>  $ LnVoorzDagel500         : num  2.77 3 0 1.95 1.1 ...
>  $ PGebouwd                : int  0 0 0 0 0 0 0 0 0 0 ...
>  $ Bouwjaar_cat4           : int  1 1 3 2 3 3 3 3 3 3 ...
>  $ LogoBedrijf             : int  0 0 0 1 1 1 0 0 0 1 ...
>  $ Perceelkwaliteit        : int  0 1 1 1 1 1 0 0 0 1 ...
>  $ KwaliteitStraatmeubilair: int  0 0 0 0 0 0 0 0 0 0 ...
>  $ X_Coord                 : int  117591 119543 123932 120624 125236 125236 124636 124636 122515 124799 ...
>  $ Y_Coord                 : int  486259 482125 482698 482028 479864 479864 480391 480391 486650 479899 ...
>  $ LeegstandJaar_L2        : num  9.78 9.78 9.78 9.78 9.78 ...
>  [list output truncated]
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> 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