Javier, Creo que aquí aplica la ley de Linus que dice: "Dado un número suficientemente elevado de ojos, todos los errores se convierten en obvios". La persona que revisa y encuentra un error no necesariamente tiene que ser la misma que la que lo escribe. Una motivación muy importante al compartir un código es la de recibir los beneficios del control de calidad por parte de tus pares. No dudes que cualquier contribución tuya bien documentada será apreciada por la persona que mantiene el paquete, ten en cuenta que él también lo usa. Daniel Merino 2013/10/18 Javier Marcuzzi <javier.ruben.marcuzzi@gmail.com>> Estimado Javier Villacampa Gonzáles > > Si una persona se toma el trabajo de desarrollar y compartir, como es el > caso de R, seguramente conoce de problemas que tuvo que decidir mientras > escibía el código, y estará agradecido porque hay gente que utiliza su > aporte, su trabajo no fué a la nada, todo lo contrario. > > En mi caso un solo autor tuvo una respuesta negativa para con migo. > > Javier Marcuzzi > > > 2013/10/18 Javier Villacampa González < > javier.villacampa.gonzalez@gmail.com> > > > Hola buenas. > > al final corri el siguiente código en mi máquina de casa. El problema es > > que ha habido algún cambio en la librería lme4, que hace incompatible los > > nuevos objetos lmer con la funcioón pamer.fnc. En este tipo de > situaciones > > imagino que lo propio sería ponerme en contacto con el autor o intentar > > corregir yo mismo el código o incluso ambas. ¿Es decortes escribir al > > autor reportandole el fallo? ¿ Existe algún problema protocolo para hacer > > esto? (aparte de ponerme en contacto a traves del mail de contacto de la > > persona responsable) > > > > Muchas gracias por adelantado. > > > > Aquí les dejo el código simplificado y las informaciones de sesión en la > > que podrán ver distintas versiones de R así como SO. > > > > # ------------------------------ > > -------------------------- > > # Codigo > > # -------------------------------------------------------- > > require(lme4) > > require(LMERConvenienceFunctions) > > dat <- data.frame(row.names= 1:20) > > dat$Subject <- > > factor(rep(x= c("S1","S2","S3","S4"), each= 5)) > > dat$RT <- rnorm( 20, mean= 500,sd= 20) > > dat$Condicion1 <- > > factor(rep(x= c("A","B"), each= 2)) > > dat$Condicion2 <- > > factor(rep(x= c("X","Y"))) > > mod <- lmer( RT ~ Condicion1 * Condicion2 + (1|Subject), data=dat) > > summary(mod) > > > > pamer.fnc(mod) > > sessionInfo() > > > > # -------------------------------------------------------- > > Con R 3.0.1 NO FUNCIONA > > # ------------------------------ > > -------------------------- > > > require(lme4) > > Loading required package: lme4 > > Loading required package: lattice > > Loading required package: Matrix > > Mensajes de aviso perdidos > > package ‘lme4’ was built under R version 3.0.2 > > > require(LMERConvenienceFunctions) > > Loading required package: LMERConvenienceFunctions > > Mensajes de aviso perdidos > > package ‘LMERConvenienceFunctions’ was built under R version 3.0.2 > > > dat <- data.frame(row.names= 1:20) > > > dat$Subject <- > > + + factor(rep(x= c("S1","S2","S3","S4"), each= 5)) > > Mensajes de aviso perdidos > > In Ops.factor(factor(rep(x = c("S1", "S2", "S3", "S4"), each = 5))) : > > + not meaningful for factors > > > dat$RT <- rnorm( 20, mean= 500,sd= 20) > > > dat$Condicion1 <- > > + + factor(rep(x= c("A","B"), each= 2)) > > Mensajes de aviso perdidos > > In Ops.factor(factor(rep(x = c("A", "B"), each = 2))) : > > + not meaningful for factors > > > dat$Condicion2 <- > > + + factor(rep(x= c("X","Y"))) > > Mensajes de aviso perdidos > > In Ops.factor(factor(rep(x = c("X", "Y")))) : + not meaningful for > factors > > > mod <- lmer( RT ~ Condicion1 * Condicion2 + (1|Subject), data=dat) > > Error en FUN(X[[1L]], ...) : > > Invalid grouping factor specification, Subject > > > summary(mod) > > Linear mixed model fit by REML ['lmerMod'] > > Formula: RT ~ Condicion1 * Condicion2 + (1 | Subject) > > Data: dat > > > > REML criterion at convergence: 145.1507 > > > > Random effects: > > Groups Name Variance Std.Dev. > > Subject (Intercept) 0.0 0.00 > > Residual 340.9 18.46 > > Number of obs: 20, groups: Subject, 4 > > > > Fixed effects: > > Estimate Std. Error t value > > (Intercept) 494.7082 8.2575 59.91 > > Condicion1B 6.7442 11.6779 0.58 > > Condicion2Y -1.1768 11.6779 -0.10 > > Condicion1B:Condicion2Y 0.9188 16.5150 0.06 > > > > Correlation of Fixed Effects: > > (Intr) Cndc1B Cndc2Y > > Condicion1B -0.707 > > Condicion2Y -0.707 0.500 > > Cndcn1B:C2Y 0.500 -0.707 -0.707 > > > > > > pamer.fnc(mod) > > Error en qr(model@X) : > > error in evaluating the argument 'x' in selecting a method for function > > 'qr': Error: no hay un slot de nombre "X" para ese objeto de clase > > "lmerMod" > > > sessionInfo() > > R version 3.0.1 (2013-05-16) > > Platform: x86_64-w64-mingw32/x64 (64-bit) > > > > locale: > > [1] LC_COLLATE=Spanish_Spain.1252 LC_CTYPE=Spanish_Spain.1252 > > [3] LC_MONETARY=Spanish_Spain.1252 LC_NUMERIC=C > > [5] LC_TIME=Spanish_Spain.1252 > > > > attached base packages: > > [1] stats graphics grDevices utils datasets methods base > > > > other attached packages: > > [1] LMERConvenienceFunctions_2.1 lme4_1.0-4 > > [3] Matrix_1.0-12 lattice_0.20-15 > > > > loaded via a namespace (and not attached): > > [1] grid_3.0.1 MASS_7.3-26 minqa_1.2.1 nlme_3.1-109 splines_3.0.1 > > > > # ------------------------------ > > > > -------------------------- > > Con R 2.15.3 Windows NO FUNCIONA > > # -------------------------------------------------------- > > > > > > > require(lme4)Loading required package: lme4Loading required package: > > latticeLoading required package: Matrix > > > require(LMERConvenienceFunctions)Loading required package: > > LMERConvenienceFunctions > > > dat <- data.frame(row.names= 1:20) > > > > > dat$Subject <- > > + factor(rep(x= c("S1","S2","S3","S4"), each= 5)) > > > > > dat$RT <- rnorm( 20, mean= 500,sd= 20) > > > > > dat$Condicion1 <- > > + factor(rep(x= c("A","B"), each= 2)) > > > > > dat$Condicion2 <- > > + factor(rep(x= c("X","Y"))) > > > > > mod <- lmer( RT ~ Condicion1 * Condicion2 + (1|Subject), data=dat) > > > > > summary(mod) > > Linear mixed model fit by REML ['lmerMod'] > > Formula: RT ~ Condicion1 * Condicion2 + (1 | Subject) > > Data: dat > > > > REML criterion at convergence: 145.443 > > > > Random effects: > > Groups Name Variance Std.Dev. > > Subject (Intercept) 0.0 0.00 > > Residual 347.2 18.63 > > Number of obs: 20, groups: Subject, 4 > > > > Fixed effects: > > Estimate Std. Error t value > > (Intercept) 492.738 8.333 59.13 > > Condicion1B 11.351 11.785 0.96 > > Condicion2Y -1.000 11.785 -0.08 > > Condicion1B:Condicion2Y -6.865 16.666 -0.41 > > > > Correlation of Fixed Effects: > > (Intr) Cndc1B Cndc2Y > > Condicion1B -0.707 > > Condicion2Y -0.707 0.500 > > Cndcn1B:C2Y 0.500 -0.707 -0.707 > > > > > pamer.fnc(mod)Error en qr(model@X) : > > error in evaluating the argument 'x' in selecting a method for > > function 'qr': Error: no hay un slot de nombre "X" para ese objeto de > > clase "lmerMod"> sessionInfo()R version 2.15.3 (2013-03-01) > > Platform: x86_64-w64-mingw32/x64 (64-bit) > > > > locale: > > [1] LC_COLLATE=Spanish_Spain.1252 LC_CTYPE=Spanish_Spain.1252 > > [3] LC_MONETARY=Spanish_Spain.1252 LC_NUMERIC=C > > [5] LC_TIME=Spanish_Spain.1252 > > > > attached base packages: > > [1] stats graphics grDevices utils datasets methods base > > > > other attached packages: > > [1] LMERConvenienceFunctions_2.1 lme4_1.0-4 > > [3] Matrix_1.0-11 lattice_0.20-13 > > > > loaded via a namespace (and not attached): > > [1] grid_2.15.3 MASS_7.3-23 minqa_1.2.1 nlme_3.1-108 > > splines_2.15.3 > > [6] tools_2.15.3 > > > > > > # -------------------------------------------------------- > > Con R 2.15.2 Windows FUNCIONA > > # -------------------------------------------------------- > > > require(lme4) > > > require(LMERConvenienceFunctions) > > > dat <- data.frame(row.names= 1:20) > > > dat$Subject <- > > + factor(rep(x= c("S1","S2","S3","S4"), each= 5)) > > > dat$RT <- rnorm( 20, mean= 500,sd= 20) > > > dat$Condicion1 <- > > + factor(rep(x= c("A","B"), each= 2)) > > > dat$Condicion2 <- > > + factor(rep(x= c("X","Y"))) > > > mod <- lmer( RT ~ Condicion1 * Condicion2 + (1|Subject), data=dat) > > > summary(mod) > > Linear mixed model fit by REML > > Formula: RT ~ Condicion1 * Condicion2 + (1 | Subject) > > Data: dat > > AIC BIC logLik deviance REMLdev > > 162.3 168.3 -75.15 175.7 150.3 > > Random effects: > > Groups Name Variance Std.Dev. > > Subject (Intercept) 101.59 10.079 > > Residual 405.85 20.146 > > Number of obs: 20, groups: Subject, 4 > > > > Fixed effects: > > Estimate Std. Error t value > > (Intercept) 504.9071 10.3897 48.60 > > Condicion1B -0.5751 12.8853 -0.04 > > Condicion2Y -5.6312 12.8853 -0.44 > > Condicion1B:Condicion2Y -5.5012 18.2226 -0.30 > > > > Correlation of Fixed Effects: > > (Intr) Cndc1B Cndc2Y > > Condicion1B -0.620 > > Condicion2Y -0.620 0.500 > > Cndcn1B:C2Y 0.438 -0.707 -0.707 > > > > > > pamer.fnc(mod) > > Df Sum Sq Mean Sq F value upper.den.df > upper.p.val > > Condicion1 1 54.0666 54.0666 0.1332 16 > 0.7199 > > Condicion2 1 343.4881 343.4881 0.8463 16 > 0.3713 > > Condicion1:Condicion2 1 36.9835 36.9835 0.0911 16 > 0.7666 > > lower.den.df lower.p.val expl.dev.(%) > > Condicion1 12 0.7215 0.6186 > > Condicion2 12 0.3757 3.9298 > > Condicion1:Condicion2 12 0.7679 0.4231 > > > sessionInfo() > > R version 2.15.2 (2012-10-26) > > Platform: x86_64-w64-mingw32/x64 (64-bit) > > > > locale: > > [1] LC_COLLATE=Spanish_Spain.1252 LC_CTYPE=Spanish_Spain.1252 > > [3] LC_MONETARY=Spanish_Spain.1252 LC_NUMERIC=C > > [5] LC_TIME=Spanish_Spain.1252 > > > > attached base packages: > > [1] stats graphics grDevices utils datasets methods base > > > > other attached packages: > > [1] LMERConvenienceFunctions_2.0 lme4_0.999999-2 > > [3] Matrix_1.0-9 lattice_0.20-10 > > > > loaded via a namespace (and not attached): > > [1] grid_2.15.2 nlme_3.1-105 stats4_2.15.2 > > > > # -------------------------------------------------------- > > Con R 2.15.2 Uubntu FUNCIONA > > # -------------------------------------------------------- > > > require(lme4) > > > require( > > LMERConvenienceFunctions) > > > dat <- data.frame(row.names= 1:20) > > > dat$Subject <- > > + factor(rep(x= c("S1","S2","S3","S4"), each= 5)) > > > dat$RT <- rnorm( 20, mean= 500,sd= 20) > > > dat$Condicion1 <- > > + factor(rep(x= c("A","B"), each= 2)) > > > dat$Condicion2 <- > > + factor(rep(x= c("X","Y"))) > > > mod <- lmer( RT ~ Condicion1 * Condicion2 + (1|Subject), data=dat) > > > summary(mod) > > Linear mixed model fit by REML > > Formula: RT ~ Condicion1 * Condicion2 + (1 | Subject) > > Data: dat > > AIC BIC logLik deviance REMLdev > > 163.7 169.6 -75.83 177.1 151.7 > > Random effects: > > Groups Name Variance Std.Dev. > > Subject (Intercept) 0.00 0.000 > > Residual 511.81 22.623 > > Number of obs: 20, groups: Subject, 4 > > > > Fixed effects: > > Estimate Std. Error t value > > (Intercept) 499.096 10.117 49.33 > > Condicion1B 15.992 14.308 1.12 > > Condicion2Y 7.018 14.308 0.49 > > Condicion1B:Condicion2Y -34.872 20.235 -1.72 > > > > Correlation of Fixed Effects: > > (Intr) Cndc1B Cndc2Y > > Condicion1B -0.707 > > Condicion2Y -0.707 0.500 > > Cndcn1B:C2Y 0.500 -0.707 -0.707 > > > pamer.fnc(mod) > > Df Sum Sq Mean Sq F value upper.den.df > > upper.p.val lower.den.df lower.p.val expl.dev.(%) > > Condicion1 1 10.4232 10.4232 0.0204 16 > > 0.8883 12 0.8889 0.0965 > > Condicion2 1 542.6392 542.6392 1.0602 16 > > 0.3185 12 0.3235 5.0234 > > Condicion1:Condicion2 1 1520.0902 1520.0902 2.9700 16 > > 0.1041 12 0.1105 14.0720 > > > sessionInfo() > > R version 2.15.2 (2012-10-26) > > Platform: x86_64-pc-linux-gnu (64-bit) > > > > locale: > > [1] LC_CTYPE=es_ES.UTF-8 LC_NUMERIC=C > > LC_TIME=es_ES.UTF-8 LC_COLLATE=es_ES.UTF-8 > > [5] LC_MONETARY=es_ES.UTF-8 LC_MESSAGES=es_ES.UTF-8 > > LC_PAPER=C LC_NAME=C > > [9] LC_ADDRESS=C LC_TELEPHONE=C > > LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C > > > > attached base packages: > > [1] stats graphics grDevices utils datasets methods base > > > > other attached packages: > > [1] LMERConvenienceFunctions_2.0 lme4_0.999999-2 > > Matrix_1.0-11 lattice_0.20-13 > > > > loaded via a namespace (and not attached): > > [1] grid_2.15.2 nlme_3.1-108 stats4_2.15.2 tools_2. > > > > > > -- > > > > [[alternative HTML version deleted]] > > > > > > _______________________________________________ > > R-help-es mailing list > > R-help-es@r-project.org > > https://stat.ethz.ch/mailman/listinfo/r-help-es > > > > > > [[alternative HTML version deleted]] > > > _______________________________________________ > R-help-es mailing list > R-help-es@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-help-es > >-- Daniel [[alternative HTML version deleted]]
Gracias a todos por las recomendaciones. Ya me he puesto en contacto con el autor y le explicado donde esta el error. Es tan fácil como que han cambiado la estructura de los objetos tipos lmer desde la versión 2.15.3 con lo que su paquete dejo de funcionar. Por suerte la nueva estructura conserva por lo menos la parte necesaria para hacer sus funciones. Se localizar el fallo y como arreglarlo, lo ideal sería hacer una función que transformase los objetos lmer nuevos en lmer viejos, pero mis conocimientos sobre objetos S4 es nulo y por lo que he mirado en la red no es un tema fácil de aprender. De todas maneras os dejao la función que lo arregla (solo hay que cambiar una linea para esa función, pamer.fnc) También os dejo las estructuras de los elementos lmer viejos y nuevos. Si seguis interesados en saber que pasó al final os mandaré a la lista la contestación del autor (si la recibo) Muchas gracias por todo, una vez más (y ya van mil). Un cordial saludo Javier ################################################################################################################################# # Estructura de los lmer ################################################################################################################################# The old lmerMod structure was: ############################## ###########################################> str(mod)Formal class 'mer' [package "lme4"] with 34 slots ..@ env :<environment: 0xbfeda80> ..@ nlmodel : language I(x) ..@ frame :'data.frame': 20 obs. of 4 variables: .. ..$ RT : num [1:20] 490 514 476 502 520 ... .. ..$ Condicion1: Factor w/ 2 levels "A","B": 1 1 2 2 1 1 2 2 1 1 ... .. ..$ Condicion2: Factor w/ 2 levels "X","Y": 1 2 1 2 1 2 1 2 1 2 ... .. ..$ Subject : Factor w/ 4 levels "S1","S2","S3",..: 1 1 1 1 1 2 2 2 2 2 ... .. ..- attr(*, "terms")=Classes 'terms', 'formula' length 3 RT ~ Condicion1 * Condicion2 .. .. .. ..- attr(*, "variables")= language list(RT, Condicion1, Condicion2) .. .. .. ..- attr(*, "factors")= int [1:3, 1:3] 0 1 0 0 0 1 0 1 1 .. .. .. .. ..- attr(*, "dimnames")=List of 2 .. .. .. .. .. ..$ : chr [1:3] "RT" "Condicion1" "Condicion2" .. .. .. .. .. ..$ : chr [1:3] "Condicion1" "Condicion2" "Condicion1:Condicion2" .. .. .. ..- attr(*, "term.labels")= chr [1:3] "Condicion1" "Condicion2" "Condicion1:Condicion2" .. .. .. ..- attr(*, "order")= int [1:3] 1 1 2 .. .. .. ..- attr(*, "intercept")= int 1 .. .. .. ..- attr(*, "response")= int 1 .. .. .. ..- attr(*, ".Environment")=<environment: R_GlobalEnv> .. .. .. ..- attr(*, "predvars")= language list(RT, Condicion1, Condicion2) .. .. .. ..- attr(*, "dataClasses")= Named chr [1:3] "numeric" "factor" "factor" .. .. .. .. ..- attr(*, "names")= chr [1:3] "RT" "Condicion1" "Condicion2" ..@ call : language lmer(formula = RT ~ Condicion1 * Condicion2 + (1 | Subject), data = dat) ..@ flist :'data.frame': 20 obs. of 1 variable: .. ..$ Subject: Factor w/ 4 levels "S1","S2","S3",..: 1 1 1 1 1 2 2 2 2 2 ... .. ..- attr(*, "assign")= int 1 ..@ X : num [1:20, 1:4] 1 1 1 1 1 1 1 1 1 1 ... .. ..- attr(*, "assign")= int [1:4] 0 1 2 3 .. ..- attr(*, "contrasts")=List of 2 .. .. ..$ Condicion1: chr "contr.treatment" .. .. ..$ Condicion2: chr "contr.treatment" ..@ Xst :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots .. .. ..@ i : int(0) .. .. ..@ p : int 0 .. .. ..@ Dim : int [1:2] 0 0 .. .. ..@ Dimnames:List of 2 .. .. .. ..$ : NULL .. .. .. ..$ : NULL .. .. ..@ x : num(0) .. .. ..@ factors : list() ..@ Zt :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots .. .. ..@ i : int [1:20] 0 0 0 0 0 1 1 1 1 1 ... .. .. ..@ p : int [1:21] 0 1 2 3 4 5 6 7 8 9 ... .. .. ..@ Dim : int [1:2] 4 20 .. .. ..@ Dimnames:List of 2 .. .. .. ..$ : NULL .. .. .. ..$ : NULL .. .. ..@ x : num [1:20] 1 1 1 1 1 1 1 1 1 1 ... .. .. ..@ factors : list() ..@ pWt : num(0) ..@ offset : num(0) ..@ y : num [1:20] 490 514 476 502 520 ... ..@ Gp : int [1:2] 0 4 ..@ dims : Named int [1:18] 1 20 4 4 1 1 1 1 2 5 ... .. ..- attr(*, "names")= chr [1:18] "nt" "n" "p" "q" ... ..@ ST :List of 1 .. ..$ : num [1, 1] 1.02e-05 .. .. ..- attr(*, "dimnames")=List of 2 .. .. .. ..$ : chr "(Intercept)" .. .. .. ..$ : chr "(Intercept)" ..@ V : num[0 , 0 ] ..@ A :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots .. .. ..@ i : int [1:20] 0 0 0 0 0 1 1 1 1 1 ... .. .. ..@ p : int [1:21] 0 1 2 3 4 5 6 7 8 9 ... .. .. ..@ Dim : int [1:2] 4 20 .. .. ..@ Dimnames:List of 2 .. .. .. ..$ : chr [1:4] "S1" "S2" "S3" "S4" .. .. .. ..$ : NULL .. .. ..@ x : num [1:20] 1.02e-05 1.02e-05 1.02e-05 1.02e-05 1.02e-05 ... .. .. ..@ factors : list() ..@ Cm :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots .. .. ..@ i : int(0) .. .. ..@ p : int 0 .. .. ..@ Dim : int [1:2] 0 0 .. .. ..@ Dimnames:List of 2 .. .. .. ..$ : NULL .. .. .. ..$ : NULL .. .. ..@ x : num(0) .. .. ..@ factors : list() ..@ Cx : num(0) ..@ L :Formal class 'dCHMsimpl' [package "Matrix"] with 10 slots .. .. ..@ x : num [1:4] 1 1 1 1 .. .. ..@ p : int [1:5] 0 1 2 3 4 .. .. ..@ i : int [1:4] 0 1 2 3 .. .. ..@ nz : int [1:4] 1 1 1 1 .. .. ..@ nxt : int [1:6] 1 2 3 4 -1 0 .. .. ..@ prv : int [1:6] 5 0 1 2 3 -1 .. .. ..@ colcount: int [1:4] 1 1 1 1 .. .. ..@ perm : int [1:4] 0 1 2 3 .. .. ..@ type : int [1:4] 2 1 0 1 .. .. ..@ Dim : int [1:2] 4 4 ..@ deviance: Named num [1:13] 1.84e+02 1.57e+02 1.12e-06 6.44 2.39e+01 ... .. ..- attr(*, "names")= chr [1:13] "ML" "REML" "ldL2" "ldRX2" ... ..@ fixef : Named num [1:4] 495.29 1.67 7.87 3.84 .. ..- attr(*, "names")= chr [1:4] "(Intercept)" "Condicion1B" "Condicion2Y" "Condicion1B:Condicion2Y" ..@ ranef : num [1:4] 7.55e-09 1.87e-07 -2.02e-07 7.80e-09 ..@ u : num [1:4] 0.000743 0.018369 -0.01988 0.000768 ..@ eta : num [1:20] 495 503 497 509 495 ... ..@ mu : num [1:20] 495 503 497 509 495 ... ..@ muEta : num(0) ..@ var : num(0) ..@ resid : num [1:20] -5.24 10.93 -20.81 -6.19 24.44 ... ..@ sqrtXWt : num[0 , 1] ..@ sqrtrWt : num(0) ..@ RZX : num [1:4, 1:4] 0.001185 0.001185 0.001185 0.001185 0.000474 ... ..@ RX : num [1:4, 1:4] 4.47 0 0 0 2.24 ... ..@ ghx : num(0) ..@ ghw : num(0) ########################################################################### And the new structure is: ############################## ############################################# Formal class 'lmerMod' [package "lme4"] with 13 slots ..@ resp :Reference class 'lmerResp' [package "lme4"] with 9 fields .. ..$ Ptr :<externalptr> .. ..$ mu : num [1:20] 515 490 494 502 515 ... .. ..$ offset : num [1:20] 0 0 0 0 0 0 0 0 0 0 ... .. ..$ sqrtXwt: num [1:20] 1 1 1 1 1 1 1 1 1 1 ... .. ..$ sqrtrwt: num [1:20] 1 1 1 1 1 1 1 1 1 1 ... .. ..$ weights: num [1:20] 1 1 1 1 1 1 1 1 1 1 ... .. ..$ wtres : num [1:20] 13.3 -20.2 -13.7 12.7 15.9 ... .. ..$ y : num [1:20] 528 470 480 514 531 ... .. ..$ REML : int 4 .. ..and 26 methods, of which 14 are possibly relevant: .. .. allInfo, copy#envRefClass, initialize, initialize#lmResp, initializePtr, initializePtr#lmResp, objective, ptr, ptr#lmResp, .. .. setOffset, setResp, setWeights, updateMu, wrss ..@ Gp : int [1:2] 0 4 ..@ call : language lmer(formula = RT ~ Condicion1 * Condicion2 + (1 | Subject), data = dat) ..@ frame :'data.frame': 20 obs. of 4 variables: .. ..$ RT : num [1:20] 528 470 480 514 531 ... .. ..$ Condicion1: Factor w/ 2 levels "A","B": 1 1 2 2 1 1 2 2 1 1 ... .. ..$ Condicion2: Factor w/ 2 levels "X","Y": 1 2 1 2 1 2 1 2 1 2 ... .. ..$ Subject : Factor w/ 4 levels "S1","S2","S3",..: 1 1 1 1 1 2 2 2 2 2 ... .. ..- attr(*, "terms")=Classes 'terms', 'formula' length 3 RT ~ Condicion1 * Condicion2 + (1 + Subject) .. .. .. ..- attr(*, "variables")= language list(RT, Condicion1, Condicion2, Subject) .. .. .. ..- attr(*, "factors")= int [1:4, 1:4] 0 1 0 0 0 0 1 0 0 0 ... .. .. .. .. ..- attr(*, "dimnames")=List of 2 .. .. .. .. .. ..$ : chr [1:4] "RT" "Condicion1" "Condicion2" "Subject" .. .. .. .. .. ..$ : chr [1:4] "Condicion1" "Condicion2" "Subject" "Condicion1:Condicion2" .. .. .. ..- attr(*, "term.labels")= chr [1:4] "Condicion1" "Condicion2" "Subject" "Condicion1:Condicion2" .. .. .. ..- attr(*, "order")= int [1:4] 1 1 1 2 .. .. .. ..- attr(*, "intercept")= int 1 .. .. .. ..- attr(*, "response")= int 1 .. .. .. ..- attr(*, ".Environment")=<environment: R_GlobalEnv> .. .. .. ..- attr(*, "predvars")= language list(RT, Condicion1, Condicion2, Subject) .. .. .. ..- attr(*, "dataClasses")= Named chr [1:4] "numeric" "factor" "factor" "factor" .. .. .. .. ..- attr(*, "names")= chr [1:4] "RT" "Condicion1" "Condicion2" "Subject" .. .. .. ..- attr(*, "predvars.fixed")= language list(RT, Condicion1, Condicion2) .. ..- attr(*, "formula")=Class 'formula' length 3 RT ~ Condicion1 * Condicion2 + (1 | Subject) .. .. .. ..- attr(*, ".Environment")=<environment: R_GlobalEnv> ..@ flist :List of 1 .. ..$ Subject: Factor w/ 4 levels "S1","S2","S3",..: 1 1 1 1 1 2 2 2 2 2 ... .. ..- attr(*, "assign")= int 1 ..@ cnms :List of 1 .. ..$ Subject: chr "(Intercept)" ..@ lower : num 0 ..@ theta : num 0.499 ..@ beta : num [1:4] 512.6 -20.5 -24.2 31.7 ..@ u : num [1:4] 3.97 -12.4 -6.62 15.04 ..@ devcomp:List of 2 .. ..$ cmp : Named num [1:10] 3.24 5.56 3862.92 439.6 4302.51 ... .. .. ..- attr(*, "names")= chr [1:10] "ldL2" "ldRX2" "wrss" "ussq" ... .. ..$ dims: Named int [1:12] 20 20 4 16 1 4 1 1 0 4 ... .. .. ..- attr(*, "names")= chr [1:12] "N" "n" "p" "nmp" ... ..@ pp :Reference class 'merPredD' [package "lme4"] with 18 fields .. ..$ Lambdat:Formal class 'dgCMatrix' [package "Matrix"] with 6 slots .. .. .. ..@ i : int [1:4] 0 1 2 3 .. .. .. ..@ p : int [1:5] 0 1 2 3 4 .. .. .. ..@ Dim : int [1:2] 4 4 .. .. .. ..@ Dimnames:List of 2 .. .. .. .. ..$ : NULL .. .. .. .. ..$ : NULL .. .. .. ..@ x : num [1:4] 0.499 0.499 0.499 0.499 .. .. .. ..@ factors : list() .. ..$ LamtUt :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots .. .. .. ..@ i : int [1:20] 0 0 0 0 0 1 1 1 1 1 ... .. .. .. ..@ p : int [1:21] 0 1 2 3 4 5 6 7 8 9 ... .. .. .. ..@ Dim : int [1:2] 4 20 .. .. .. ..@ Dimnames:List of 2 .. .. .. .. ..$ : NULL .. .. .. .. ..$ : NULL .. .. .. ..@ x : num [1:20] 0.499 0.499 0.499 0.499 0.499 ... .. .. .. ..@ factors : list() .. ..$ Lind : int [1:4] 1 1 1 1 .. ..$ Ptr :<externalptr> .. ..$ RZX : num [1:4, 1:4] 1.666 1.666 1.666 1.666 0.666 ... .. ..$ Ut :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots .. .. .. ..@ i : int [1:20] 0 0 0 0 0 1 1 1 1 1 ... .. .. .. ..@ p : int [1:21] 0 1 2 3 4 5 6 7 8 9 ... .. .. .. ..@ Dim : int [1:2] 4 20 .. .. .. ..@ Dimnames:List of 2 .. .. .. .. ..$ : chr [1:4] "S1" "S2" "S3" "S4" .. .. .. .. ..$ : NULL .. .. .. ..@ x : num [1:20] 1 1 1 1 1 1 1 1 1 1 ... .. .. .. ..@ factors : list() .. ..$ Utr : num [1:4] 1260 1211 1226 1279 .. ..$ V : num [1:20, 1:4] 1 1 1 1 1 1 1 1 1 1 ... .. ..$ VtV : num [1:4, 1:4] 20 0 0 0 10 10 0 0 10 5 ... .. ..$ Vtr : num [1:4] 9963 4962 4941 2505 .. ..$ X : num [1:20, 1:4] 1 1 1 1 1 1 1 1 1 1 ... .. .. ..- attr(*, "dimnames")=List of 2 .. .. .. ..$ : chr [1:20] "1" "2" "3" "4" ... .. .. .. ..$ : chr [1:4] "(Intercept)" "Condicion1B" "Condicion2Y" "Condicion1B:Condicion2Y" .. .. ..- attr(*, "assign")= int [1:4] 0 1 2 3 .. .. ..- attr(*, "contrasts")=List of 2 .. .. .. ..$ Condicion1: chr "contr.treatment" .. .. .. ..$ Condicion2: chr "contr.treatment" .. ..$ Xwts : num [1:20] 1 1 1 1 1 1 1 1 1 1 ... .. ..$ Zt :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots .. .. .. ..@ i : int [1:20] 0 0 0 0 0 1 1 1 1 1 ... .. .. .. ..@ p : int [1:21] 0 1 2 3 4 5 6 7 8 9 ... .. .. .. ..@ Dim : int [1:2] 4 20 .. .. .. ..@ Dimnames:List of 2 .. .. .. .. ..$ : chr [1:4] "S1" "S2" "S3" "S4" .. .. .. .. ..$ : NULL .. .. .. ..@ x : num [1:20] 1 1 1 1 1 1 1 1 1 1 ... .. .. .. ..@ factors : list() .. ..$ beta0 : num [1:4] 0 0 0 0 .. ..$ delb : num [1:4] 512.6 -20.5 -24.2 31.7 .. ..$ delu : num [1:4] 3.97 -12.4 -6.62 15.04 .. ..$ theta : num 0.499 .. ..$ u0 : num [1:4] 0 0 0 0 .. ..and 42 methods, of which 30 are possibly relevant: .. .. b, beta, CcNumer, copy#envRefClass, initialize, initializePtr, installPars, L, ldL2, ldRX2, linPred, P, ptr, RX, RXdiag, RXi, .. .. setBeta0, setDelb, setDelu, setTheta, solve, solveU, sqrL, u, unsc, updateDecomp, updateL, updateLamtUt, updateRes, updateXwts ..@ optinfo:List of 4 .. ..$ optimizer: chr "Nelder_Mead" .. ..$ control :List of 1 .. .. ..$ verbose: int 0 .. ..$ conv : num 0 .. ..$ warnings : list() ########################################################################### Really, object structure changed a lot between the old version and the new. For fix up the pamer.fnc is easy: you only must change one code line. ################################################################################################################################# # "solución" ################################################################################################################################# ############################## ############################################# pamer.fnc2 <- function (model, ndigits = 4) { if (length(rownames(anova(model))) == 0) { cat("nothing to evaluate: model has only an intercept.\n\n") cat("printing model fixed effects:\n") fixef(model) } else { dims <- NULL # rank.X = qr(model@X)$rank rank.X = qr(model@pp$X)$rank anova.table = anova(model) anova.table = cbind(anova.table, upper.den.df = nrow(model@frame) - rank.X) p.values.upper = as.numeric() p.values.lower = as.numeric() for (term in row.names(anova.table)) { p.values.upper = c(p.values.upper, round(1 - pf(anova.table[term, "F value"], anova.table[term, "Df"], nrow(model@frame) - rank.X), ndigits)) model.ranef <- ranef(model) lower.bound <- 0 for (i in 1:length(names(model.ranef))) { dims <- dim(model.ranef[[i]]) lower.bound <- lower.bound + dims[1] * dims[2] } p.values.lower = c(p.values.lower, 1 - pf(anova.table[term, "F value"], anova.table[term, "Df"], nrow(model@frame) - rank.X - lower.bound)) } dv <- gsub(" ", "", gsub("(.*)~.*", "\\1", as.character(model@call)[2])) ss.tot <- sum((model@frame[, dv] - mean(model@frame[, dv]))^2) aov.table <- as.data.frame(anova(model)) expl.dev <- vector("numeric") for (i in rownames(aov.table)) { expl.dev <- c(expl.dev, aov.table[i, 2]/ss.tot) } names(expl.dev) <- rownames(aov.table) anova.table = round(cbind(anova.table, upper.p.val = p.values.upper, lower.den.df = nrow(model@frame) - rank.X - lower.bound, lower.p.val = p.values.lower, `expl.dev.(%)` = expl.dev * 100), ndigits) return(anova.table) } } ################################################################################################################################# # Volviendo correr el código de ejemplo mandado ################################################################################################################################# dat <- data.frame(row.names= 1:20) dat$Subject <- factor(rep(x= c("S1","S2","S3","S4"), each= 5)) dat$RT <- rnorm( 20, mean= 500,sd= 20) dat$Condicion1 <- factor(rep(x= c("A","B"), each= 2)) dat$Condicion2 <- factor(rep(x= c("X","Y"))) mod <- lmer( RT ~ Condicion1 * Condicion2 + (1|Subject), data=dat) summary(mod) pamer.fnc2(mod) ########################################################################### 2013/10/18 daniel <daniel319@gmail.com>> Javier, > > Creo que aquí aplica la ley de Linus que dice: "Dado un número > suficientemente elevado de ojos, todos los errores se convierten en > obvios". La persona que revisa y encuentra un error no necesariamente > tiene que ser la misma que la que lo escribe. Una motivación muy importante > al compartir un código es la de recibir los beneficios del control de > calidad por parte de tus pares. No dudes que cualquier contribución tuya > bien documentada será apreciada por la persona que mantiene el paquete, ten > en cuenta que él también lo usa. > > Daniel Merino > > > 2013/10/18 Javier Marcuzzi <javier.ruben.marcuzzi@gmail.com> > >> Estimado Javier Villacampa Gonzáles >> >> Si una persona se toma el trabajo de desarrollar y compartir, como es el >> caso de R, seguramente conoce de problemas que tuvo que decidir mientras >> escibía el código, y estará agradecido porque hay gente que utiliza su >> aporte, su trabajo no fué a la nada, todo lo contrario. >> >> En mi caso un solo autor tuvo una respuesta negativa para con migo. >> >> Javier Marcuzzi >> >> >> 2013/10/18 Javier Villacampa González < >> javier.villacampa.gonzalez@gmail.com> >> >> > Hola buenas. >> > al final corri el siguiente código en mi máquina de casa. El problema es >> > que ha habido algún cambio en la librería lme4, que hace incompatible >> los >> > nuevos objetos lmer con la funcioón pamer.fnc. En este tipo de >> situaciones >> > imagino que lo propio sería ponerme en contacto con el autor o intentar >> > corregir yo mismo el código o incluso ambas. ¿Es decortes escribir al >> > autor reportandole el fallo? ¿ Existe algún problema protocolo para >> hacer >> > esto? (aparte de ponerme en contacto a traves del mail de contacto de la >> > persona responsable) >> > >> > Muchas gracias por adelantado. >> > >> > Aquí les dejo el código simplificado y las informaciones de sesión en la >> > que podrán ver distintas versiones de R así como SO. >> > >> > # ------------------------------ >> > -------------------------- >> > # Codigo >> > # -------------------------------------------------------- >> > require(lme4) >> > require(LMERConvenienceFunctions) >> > dat <- data.frame(row.names= 1:20) >> > dat$Subject <- >> > factor(rep(x= c("S1","S2","S3","S4"), each= 5)) >> > dat$RT <- rnorm( 20, mean= 500,sd= 20) >> > dat$Condicion1 <- >> > factor(rep(x= c("A","B"), each= 2)) >> > dat$Condicion2 <- >> > factor(rep(x= c("X","Y"))) >> > mod <- lmer( RT ~ Condicion1 * Condicion2 + (1|Subject), data=dat) >> > summary(mod) >> > >> > pamer.fnc(mod) >> > sessionInfo() >> > >> > # -------------------------------------------------------- >> > Con R 3.0.1 NO FUNCIONA >> > # ------------------------------ >> > -------------------------- >> > > require(lme4) >> > Loading required package: lme4 >> > Loading required package: lattice >> > Loading required package: Matrix >> > Mensajes de aviso perdidos >> > package ‘lme4’ was built under R version 3.0.2 >> > > require(LMERConvenienceFunctions) >> > Loading required package: LMERConvenienceFunctions >> > Mensajes de aviso perdidos >> > package ‘LMERConvenienceFunctions’ was built under R version 3.0.2 >> > > dat <- data.frame(row.names= 1:20) >> > > dat$Subject <- >> > + + factor(rep(x= c("S1","S2","S3","S4"), each= 5)) >> > Mensajes de aviso perdidos >> > In Ops.factor(factor(rep(x = c("S1", "S2", "S3", "S4"), each = 5))) : >> > + not meaningful for factors >> > > dat$RT <- rnorm( 20, mean= 500,sd= 20) >> > > dat$Condicion1 <- >> > + + factor(rep(x= c("A","B"), each= 2)) >> > Mensajes de aviso perdidos >> > In Ops.factor(factor(rep(x = c("A", "B"), each = 2))) : >> > + not meaningful for factors >> > > dat$Condicion2 <- >> > + + factor(rep(x= c("X","Y"))) >> > Mensajes de aviso perdidos >> > In Ops.factor(factor(rep(x = c("X", "Y")))) : + not meaningful for >> factors >> > > mod <- lmer( RT ~ Condicion1 * Condicion2 + (1|Subject), data=dat) >> > Error en FUN(X[[1L]], ...) : >> > Invalid grouping factor specification, Subject >> > > summary(mod) >> > Linear mixed model fit by REML ['lmerMod'] >> > Formula: RT ~ Condicion1 * Condicion2 + (1 | Subject) >> > Data: dat >> > >> > REML criterion at convergence: 145.1507 >> > >> > Random effects: >> > Groups Name Variance Std.Dev. >> > Subject (Intercept) 0.0 0.00 >> > Residual 340.9 18.46 >> > Number of obs: 20, groups: Subject, 4 >> > >> > Fixed effects: >> > Estimate Std. Error t value >> > (Intercept) 494.7082 8.2575 59.91 >> > Condicion1B 6.7442 11.6779 0.58 >> > Condicion2Y -1.1768 11.6779 -0.10 >> > Condicion1B:Condicion2Y 0.9188 16.5150 0.06 >> > >> > Correlation of Fixed Effects: >> > (Intr) Cndc1B Cndc2Y >> > Condicion1B -0.707 >> > Condicion2Y -0.707 0.500 >> > Cndcn1B:C2Y 0.500 -0.707 -0.707 >> > > >> > > pamer.fnc(mod) >> > Error en qr(model@X) : >> > error in evaluating the argument 'x' in selecting a method for >> function >> > 'qr': Error: no hay un slot de nombre "X" para ese objeto de clase >> > "lmerMod" >> > > sessionInfo() >> > R version 3.0.1 (2013-05-16) >> > Platform: x86_64-w64-mingw32/x64 (64-bit) >> > >> > locale: >> > [1] LC_COLLATE=Spanish_Spain.1252 LC_CTYPE=Spanish_Spain.1252 >> > [3] LC_MONETARY=Spanish_Spain.1252 LC_NUMERIC=C >> > [5] LC_TIME=Spanish_Spain.1252 >> > >> > attached base packages: >> > [1] stats graphics grDevices utils datasets methods base >> > >> > other attached packages: >> > [1] LMERConvenienceFunctions_2.1 lme4_1.0-4 >> > [3] Matrix_1.0-12 lattice_0.20-15 >> > >> > loaded via a namespace (and not attached): >> > [1] grid_3.0.1 MASS_7.3-26 minqa_1.2.1 nlme_3.1-109 >> splines_3.0.1 >> > >> > # ------------------------------ >> > >> > -------------------------- >> > Con R 2.15.3 Windows NO FUNCIONA >> > # -------------------------------------------------------- >> > >> > >> > > require(lme4)Loading required package: lme4Loading required package: >> > latticeLoading required package: Matrix >> > > require(LMERConvenienceFunctions)Loading required package: >> > LMERConvenienceFunctions >> > > dat <- data.frame(row.names= 1:20) >> > >> > > dat$Subject <- >> > + factor(rep(x= c("S1","S2","S3","S4"), each= 5)) >> > >> > > dat$RT <- rnorm( 20, mean= 500,sd= 20) >> > >> > > dat$Condicion1 <- >> > + factor(rep(x= c("A","B"), each= 2)) >> > >> > > dat$Condicion2 <- >> > + factor(rep(x= c("X","Y"))) >> > >> > > mod <- lmer( RT ~ Condicion1 * Condicion2 + (1|Subject), data=dat) >> > >> > > summary(mod) >> > Linear mixed model fit by REML ['lmerMod'] >> > Formula: RT ~ Condicion1 * Condicion2 + (1 | Subject) >> > Data: dat >> > >> > REML criterion at convergence: 145.443 >> > >> > Random effects: >> > Groups Name Variance Std.Dev. >> > Subject (Intercept) 0.0 0.00 >> > Residual 347.2 18.63 >> > Number of obs: 20, groups: Subject, 4 >> > >> > Fixed effects: >> > Estimate Std. Error t value >> > (Intercept) 492.738 8.333 59.13 >> > Condicion1B 11.351 11.785 0.96 >> > Condicion2Y -1.000 11.785 -0.08 >> > Condicion1B:Condicion2Y -6.865 16.666 -0.41 >> > >> > Correlation of Fixed Effects: >> > (Intr) Cndc1B Cndc2Y >> > Condicion1B -0.707 >> > Condicion2Y -0.707 0.500 >> > Cndcn1B:C2Y 0.500 -0.707 -0.707 >> > >> > > pamer.fnc(mod)Error en qr(model@X) : >> > error in evaluating the argument 'x' in selecting a method for >> > function 'qr': Error: no hay un slot de nombre "X" para ese objeto de >> > clase "lmerMod"> sessionInfo()R version 2.15.3 (2013-03-01) >> > Platform: x86_64-w64-mingw32/x64 (64-bit) >> > >> > locale: >> > [1] LC_COLLATE=Spanish_Spain.1252 LC_CTYPE=Spanish_Spain.1252 >> > [3] LC_MONETARY=Spanish_Spain.1252 LC_NUMERIC=C >> > [5] LC_TIME=Spanish_Spain.1252 >> > >> > attached base packages: >> > [1] stats graphics grDevices utils datasets methods base >> > >> > other attached packages: >> > [1] LMERConvenienceFunctions_2.1 lme4_1.0-4 >> > [3] Matrix_1.0-11 lattice_0.20-13 >> > >> > loaded via a namespace (and not attached): >> > [1] grid_2.15.3 MASS_7.3-23 minqa_1.2.1 nlme_3.1-108 >> > splines_2.15.3 >> > [6] tools_2.15.3 >> > >> > >> > # -------------------------------------------------------- >> > Con R 2.15.2 Windows FUNCIONA >> > # -------------------------------------------------------- >> > > require(lme4) >> > > require(LMERConvenienceFunctions) >> > > dat <- data.frame(row.names= 1:20) >> > > dat$Subject <- >> > + factor(rep(x= c("S1","S2","S3","S4"), each= 5)) >> > > dat$RT <- rnorm( 20, mean= 500,sd= 20) >> > > dat$Condicion1 <- >> > + factor(rep(x= c("A","B"), each= 2)) >> > > dat$Condicion2 <- >> > + factor(rep(x= c("X","Y"))) >> > > mod <- lmer( RT ~ Condicion1 * Condicion2 + (1|Subject), data=dat) >> > > summary(mod) >> > Linear mixed model fit by REML >> > Formula: RT ~ Condicion1 * Condicion2 + (1 | Subject) >> > Data: dat >> > AIC BIC logLik deviance REMLdev >> > 162.3 168.3 -75.15 175.7 150.3 >> > Random effects: >> > Groups Name Variance Std.Dev. >> > Subject (Intercept) 101.59 10.079 >> > Residual 405.85 20.146 >> > Number of obs: 20, groups: Subject, 4 >> > >> > Fixed effects: >> > Estimate Std. Error t value >> > (Intercept) 504.9071 10.3897 48.60 >> > Condicion1B -0.5751 12.8853 -0.04 >> > Condicion2Y -5.6312 12.8853 -0.44 >> > Condicion1B:Condicion2Y -5.5012 18.2226 -0.30 >> > >> > Correlation of Fixed Effects: >> > (Intr) Cndc1B Cndc2Y >> > Condicion1B -0.620 >> > Condicion2Y -0.620 0.500 >> > Cndcn1B:C2Y 0.438 -0.707 -0.707 >> > > >> > > pamer.fnc(mod) >> > Df Sum Sq Mean Sq F value upper.den.df >> upper.p.val >> > Condicion1 1 54.0666 54.0666 0.1332 16 >> 0.7199 >> > Condicion2 1 343.4881 343.4881 0.8463 16 >> 0.3713 >> > Condicion1:Condicion2 1 36.9835 36.9835 0.0911 16 >> 0.7666 >> > lower.den.df lower.p.val expl.dev.(%) >> > Condicion1 12 0.7215 0.6186 >> > Condicion2 12 0.3757 3.9298 >> > Condicion1:Condicion2 12 0.7679 0.4231 >> > > sessionInfo() >> > R version 2.15.2 (2012-10-26) >> > Platform: x86_64-w64-mingw32/x64 (64-bit) >> > >> > locale: >> > [1] LC_COLLATE=Spanish_Spain.1252 LC_CTYPE=Spanish_Spain.1252 >> > [3] LC_MONETARY=Spanish_Spain.1252 LC_NUMERIC=C >> > [5] LC_TIME=Spanish_Spain.1252 >> > >> > attached base packages: >> > [1] stats graphics grDevices utils datasets methods base >> > >> > other attached packages: >> > [1] LMERConvenienceFunctions_2.0 lme4_0.999999-2 >> > [3] Matrix_1.0-9 lattice_0.20-10 >> > >> > loaded via a namespace (and not attached): >> > [1] grid_2.15.2 nlme_3.1-105 stats4_2.15.2 >> > >> > # -------------------------------------------------------- >> > Con R 2.15.2 Uubntu FUNCIONA >> > # -------------------------------------------------------- >> > > require(lme4) >> > > require( >> > LMERConvenienceFunctions) >> > > dat <- data.frame(row.names= 1:20) >> > > dat$Subject <- >> > + factor(rep(x= c("S1","S2","S3","S4"), each= 5)) >> > > dat$RT <- rnorm( 20, mean= 500,sd= 20) >> > > dat$Condicion1 <- >> > + factor(rep(x= c("A","B"), each= 2)) >> > > dat$Condicion2 <- >> > + factor(rep(x= c("X","Y"))) >> > > mod <- lmer( RT ~ Condicion1 * Condicion2 + (1|Subject), data=dat) >> > > summary(mod) >> > Linear mixed model fit by REML >> > Formula: RT ~ Condicion1 * Condicion2 + (1 | Subject) >> > Data: dat >> > AIC BIC logLik deviance REMLdev >> > 163.7 169.6 -75.83 177.1 151.7 >> > Random effects: >> > Groups Name Variance Std.Dev. >> > Subject (Intercept) 0.00 0.000 >> > Residual 511.81 22.623 >> > Number of obs: 20, groups: Subject, 4 >> > >> > Fixed effects: >> > Estimate Std. Error t value >> > (Intercept) 499.096 10.117 49.33 >> > Condicion1B 15.992 14.308 1.12 >> > Condicion2Y 7.018 14.308 0.49 >> > Condicion1B:Condicion2Y -34.872 20.235 -1.72 >> > >> > Correlation of Fixed Effects: >> > (Intr) Cndc1B Cndc2Y >> > Condicion1B -0.707 >> > Condicion2Y -0.707 0.500 >> > Cndcn1B:C2Y 0.500 -0.707 -0.707 >> > > pamer.fnc(mod) >> > Df Sum Sq Mean Sq F value upper.den.df >> > upper.p.val lower.den.df lower.p.val expl.dev.(%) >> > Condicion1 1 10.4232 10.4232 0.0204 16 >> > 0.8883 12 0.8889 0.0965 >> > Condicion2 1 542.6392 542.6392 1.0602 16 >> > 0.3185 12 0.3235 5.0234 >> > Condicion1:Condicion2 1 1520.0902 1520.0902 2.9700 16 >> > 0.1041 12 0.1105 14.0720 >> > > sessionInfo() >> > R version 2.15.2 (2012-10-26) >> > Platform: x86_64-pc-linux-gnu (64-bit) >> > >> > locale: >> > [1] LC_CTYPE=es_ES.UTF-8 LC_NUMERIC=C >> > LC_TIME=es_ES.UTF-8 LC_COLLATE=es_ES.UTF-8 >> > [5] LC_MONETARY=es_ES.UTF-8 LC_MESSAGES=es_ES.UTF-8 >> > LC_PAPER=C LC_NAME=C >> > [9] LC_ADDRESS=C LC_TELEPHONE=C >> > LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C >> > >> > attached base packages: >> > [1] stats graphics grDevices utils datasets methods base >> > >> > other attached packages: >> > [1] LMERConvenienceFunctions_2.0 lme4_0.999999-2 >> > Matrix_1.0-11 lattice_0.20-13 >> > >> > loaded via a namespace (and not attached): >> > [1] grid_2.15.2 nlme_3.1-108 stats4_2.15.2 tools_2. >> > >> > >> > -- >> > >> > [[alternative HTML version deleted]] >> > >> > >> > _______________________________________________ >> > R-help-es mailing list >> > R-help-es@r-project.org >> > https://stat.ethz.ch/mailman/listinfo/r-help-es >> > >> > >> >> [[alternative HTML version deleted]] >> >> >> _______________________________________________ >> R-help-es mailing list >> R-help-es@r-project.org >> https://stat.ethz.ch/mailman/listinfo/r-help-es >> >> > > > -- > Daniel >-- [[alternative HTML version deleted]]
Hace unos meses os escribir para comunicaros que había un fallo en esta función. Como os prometí os comento la respuesta por si alguno está interesado en utilizar el paquete LMERconvenientsfucntions Dear Javier, The package has been updated and should work for you fine now. Note that function mcp.fnc does not return the fourth plot (dffits) anymore. We still have to figure out a way to compute the dffits for the new merMod objects. Also note that mcposthoc.fnc doesn't work with pvals.fnc / MCMC anymore. Please see Note in help page. Finally, the package gained function plotLMER.fnc from archived package languageR. It's the same, except for the bits related to mcmc. Please let me know if you encounter other problems. Sincerely, 2013/10/18 Javier Villacampa González <javier.villacampa.gonzalez@gmail.com>> Gracias a todos por las recomendaciones. Ya me he puesto en contacto con > el autor y le explicado donde esta el error. Es tan fácil como que han > cambiado la estructura de los objetos tipos lmer desde la versión 2.15.3 > con lo que su paquete dejo de funcionar. Por suerte la nueva estructura > conserva por lo menos la parte necesaria para hacer sus funciones. Se > localizar el fallo y como arreglarlo, lo ideal sería hacer una función que > transformase los objetos lmer nuevos en lmer viejos, pero mis conocimientos > sobre objetos S4 es nulo y por lo que he mirado en la red no es un tema > fácil de aprender. > > De todas maneras os dejao la función que lo arregla (solo hay que cambiar > una linea para esa función, pamer.fnc) > > También os dejo las estructuras de los elementos lmer viejos y nuevos. > > Si seguis interesados en saber que pasó al final os mandaré a la lista la > contestación del autor (si la recibo) > > Muchas gracias por todo, una vez más (y ya van mil). > > Un cordial saludo > > Javier > > > > ################################################################################################################################# > # Estructura de los lmer > > ################################################################################################################################# > The old lmerMod structure was: > ############################## > ########################################### > > str(mod) > Formal class 'mer' [package "lme4"] with 34 slots > ..@ env :<environment: 0xbfeda80> > ..@ nlmodel : language I(x) > ..@ frame :'data.frame': 20 obs. of 4 variables: > .. ..$ RT : num [1:20] 490 514 476 502 520 ... > .. ..$ Condicion1: Factor w/ 2 levels "A","B": 1 1 2 2 1 1 2 2 1 1 ... > .. ..$ Condicion2: Factor w/ 2 levels "X","Y": 1 2 1 2 1 2 1 2 1 2 ... > .. ..$ Subject : Factor w/ 4 levels "S1","S2","S3",..: 1 1 1 1 1 2 2 2 2 > 2 ... > .. ..- attr(*, "terms")=Classes 'terms', 'formula' length 3 RT ~ > Condicion1 * Condicion2 > .. .. .. ..- attr(*, "variables")= language list(RT, Condicion1, > Condicion2) > .. .. .. ..- attr(*, "factors")= int [1:3, 1:3] 0 1 0 0 0 1 0 1 1 > .. .. .. .. ..- attr(*, "dimnames")=List of 2 > .. .. .. .. .. ..$ : chr [1:3] "RT" "Condicion1" "Condicion2" > .. .. .. .. .. ..$ : chr [1:3] "Condicion1" "Condicion2" > "Condicion1:Condicion2" > .. .. .. ..- attr(*, "term.labels")= chr [1:3] "Condicion1" "Condicion2" > "Condicion1:Condicion2" > .. .. .. ..- attr(*, "order")= int [1:3] 1 1 2 > .. .. .. ..- attr(*, "intercept")= int 1 > .. .. .. ..- attr(*, "response")= int 1 > .. .. .. ..- attr(*, ".Environment")=<environment: R_GlobalEnv> > .. .. .. ..- attr(*, "predvars")= language list(RT, Condicion1, > Condicion2) > .. .. .. ..- attr(*, "dataClasses")= Named chr [1:3] "numeric" "factor" > "factor" > .. .. .. .. ..- attr(*, "names")= chr [1:3] "RT" "Condicion1" "Condicion2" > ..@ call : language lmer(formula = RT ~ Condicion1 * Condicion2 + (1 | > Subject), data = dat) > ..@ flist :'data.frame': 20 obs. of 1 variable: > .. ..$ Subject: Factor w/ 4 levels "S1","S2","S3",..: 1 1 1 1 1 2 2 2 2 > 2 ... > .. ..- attr(*, "assign")= int 1 > ..@ X : num [1:20, 1:4] 1 1 1 1 1 1 1 1 1 1 ... > .. ..- attr(*, "assign")= int [1:4] 0 1 2 3 > .. ..- attr(*, "contrasts")=List of 2 > .. .. ..$ Condicion1: chr "contr.treatment" > .. .. ..$ Condicion2: chr "contr.treatment" > ..@ Xst :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots > .. .. ..@ i : int(0) > .. .. ..@ p : int 0 > .. .. ..@ Dim : int [1:2] 0 0 > .. .. ..@ Dimnames:List of 2 > .. .. .. ..$ : NULL > .. .. .. ..$ : NULL > .. .. ..@ x : num(0) > .. .. ..@ factors : list() > ..@ Zt :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots > .. .. ..@ i : int [1:20] 0 0 0 0 0 1 1 1 1 1 ... > .. .. ..@ p : int [1:21] 0 1 2 3 4 5 6 7 8 9 ... > .. .. ..@ Dim : int [1:2] 4 20 > .. .. ..@ Dimnames:List of 2 > .. .. .. ..$ : NULL > .. .. .. ..$ : NULL > .. .. ..@ x : num [1:20] 1 1 1 1 1 1 1 1 1 1 ... > .. .. ..@ factors : list() > ..@ pWt : num(0) > ..@ offset : num(0) > ..@ y : num [1:20] 490 514 476 502 520 ... > ..@ Gp : int [1:2] 0 4 > ..@ dims : Named int [1:18] 1 20 4 4 1 1 1 1 2 5 ... > .. ..- attr(*, "names")= chr [1:18] "nt" "n" "p" "q" ... > ..@ ST :List of 1 > .. ..$ : num [1, 1] 1.02e-05 > .. .. ..- attr(*, "dimnames")=List of 2 > .. .. .. ..$ : chr "(Intercept)" > .. .. .. ..$ : chr "(Intercept)" > ..@ V : num[0 , 0 ] > ..@ A :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots > .. .. ..@ i : int [1:20] 0 0 0 0 0 1 1 1 1 1 ... > .. .. ..@ p : int [1:21] 0 1 2 3 4 5 6 7 8 9 ... > .. .. ..@ Dim : int [1:2] 4 20 > .. .. ..@ Dimnames:List of 2 > .. .. .. ..$ : chr [1:4] "S1" "S2" "S3" "S4" > .. .. .. ..$ : NULL > .. .. ..@ x : num [1:20] 1.02e-05 1.02e-05 1.02e-05 1.02e-05 > 1.02e-05 ... > .. .. ..@ factors : list() > ..@ Cm :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots > .. .. ..@ i : int(0) > .. .. ..@ p : int 0 > .. .. ..@ Dim : int [1:2] 0 0 > .. .. ..@ Dimnames:List of 2 > .. .. .. ..$ : NULL > .. .. .. ..$ : NULL > .. .. ..@ x : num(0) > .. .. ..@ factors : list() > ..@ Cx : num(0) > ..@ L :Formal class 'dCHMsimpl' [package "Matrix"] with 10 slots > .. .. ..@ x : num [1:4] 1 1 1 1 > .. .. ..@ p : int [1:5] 0 1 2 3 4 > .. .. ..@ i : int [1:4] 0 1 2 3 > .. .. ..@ nz : int [1:4] 1 1 1 1 > .. .. ..@ nxt : int [1:6] 1 2 3 4 -1 0 > .. .. ..@ prv : int [1:6] 5 0 1 2 3 -1 > .. .. ..@ colcount: int [1:4] 1 1 1 1 > .. .. ..@ perm : int [1:4] 0 1 2 3 > .. .. ..@ type : int [1:4] 2 1 0 1 > .. .. ..@ Dim : int [1:2] 4 4 > ..@ deviance: Named num [1:13] 1.84e+02 1.57e+02 1.12e-06 6.44 2.39e+01 ... > .. ..- attr(*, "names")= chr [1:13] "ML" "REML" "ldL2" "ldRX2" ... > ..@ fixef : Named num [1:4] 495.29 1.67 7.87 3.84 > .. ..- attr(*, "names")= chr [1:4] "(Intercept)" "Condicion1B" > "Condicion2Y" "Condicion1B:Condicion2Y" > ..@ ranef : num [1:4] 7.55e-09 1.87e-07 -2.02e-07 7.80e-09 > ..@ u : num [1:4] 0.000743 0.018369 -0.01988 0.000768 > ..@ eta : num [1:20] 495 503 497 509 495 ... > ..@ mu : num [1:20] 495 503 497 509 495 ... > ..@ muEta : num(0) > ..@ var : num(0) > ..@ resid : num [1:20] -5.24 10.93 -20.81 -6.19 24.44 ... > ..@ sqrtXWt : num[0 , 1] > ..@ sqrtrWt : num(0) > ..@ RZX : num [1:4, 1:4] 0.001185 0.001185 0.001185 0.001185 0.000474 > ... > ..@ RX : num [1:4, 1:4] 4.47 0 0 0 2.24 ... > ..@ ghx : num(0) > ..@ ghw : num(0) > ########################################################################### > > And the new structure is: > ############################## > ############################################# > > Formal class 'lmerMod' [package "lme4"] with 13 slots > ..@ resp :Reference class 'lmerResp' [package "lme4"] with 9 fields > .. ..$ Ptr :<externalptr> > .. ..$ mu : num [1:20] 515 490 494 502 515 ... > .. ..$ offset : num [1:20] 0 0 0 0 0 0 0 0 0 0 ... > .. ..$ sqrtXwt: num [1:20] 1 1 1 1 1 1 1 1 1 1 ... > .. ..$ sqrtrwt: num [1:20] 1 1 1 1 1 1 1 1 1 1 ... > .. ..$ weights: num [1:20] 1 1 1 1 1 1 1 1 1 1 ... > .. ..$ wtres : num [1:20] 13.3 -20.2 -13.7 12.7 15.9 ... > .. ..$ y : num [1:20] 528 470 480 514 531 ... > .. ..$ REML : int 4 > .. ..and 26 methods, of which 14 are possibly relevant: > .. .. allInfo, copy#envRefClass, initialize, initialize#lmResp, initializePtr, initializePtr#lmResp, objective, ptr, ptr#lmResp, > .. .. setOffset, setResp, setWeights, updateMu, wrss > ..@ Gp : int [1:2] 0 4 > ..@ call : language lmer(formula = RT ~ Condicion1 * Condicion2 + (1 | Subject), data = dat) > ..@ frame :'data.frame': 20 obs. of 4 variables: > .. ..$ RT : num [1:20] 528 470 480 514 531 ... > .. ..$ Condicion1: Factor w/ 2 levels "A","B": 1 1 2 2 1 1 2 2 1 1 ... > .. ..$ Condicion2: Factor w/ 2 levels "X","Y": 1 2 1 2 1 2 1 2 1 2 ... > .. ..$ Subject : Factor w/ 4 levels "S1","S2","S3",..: 1 1 1 1 1 2 2 2 2 2 ... > .. ..- attr(*, "terms")=Classes 'terms', 'formula' length 3 RT ~ Condicion1 * Condicion2 + (1 + Subject) > .. .. .. ..- attr(*, "variables")= language list(RT, Condicion1, Condicion2, Subject) > .. .. .. ..- attr(*, "factors")= int [1:4, 1:4] 0 1 0 0 0 0 1 0 0 0 ... > .. .. .. .. ..- attr(*, "dimnames")=List of 2 > .. .. .. .. .. ..$ : chr [1:4] "RT" "Condicion1" "Condicion2" "Subject" > .. .. .. .. .. ..$ : chr [1:4] "Condicion1" "Condicion2" "Subject" "Condicion1:Condicion2" > .. .. .. ..- attr(*, "term.labels")= chr [1:4] "Condicion1" "Condicion2" "Subject" "Condicion1:Condicion2" > .. .. .. ..- attr(*, "order")= int [1:4] 1 1 1 2 > .. .. .. ..- attr(*, "intercept")= int 1 > .. .. .. ..- attr(*, "response")= int 1 > .. .. .. ..- attr(*, ".Environment")=<environment: R_GlobalEnv> > .. .. .. ..- attr(*, "predvars")= language list(RT, Condicion1, Condicion2, Subject) > .. .. .. ..- attr(*, "dataClasses")= Named chr [1:4] "numeric" "factor" "factor" "factor" > .. .. .. .. ..- attr(*, "names")= chr [1:4] "RT" "Condicion1" "Condicion2" "Subject" > .. .. .. ..- attr(*, "predvars.fixed")= language list(RT, Condicion1, Condicion2) > .. ..- attr(*, "formula")=Class 'formula' length 3 RT ~ Condicion1 * Condicion2 + (1 | Subject) > .. .. .. ..- attr(*, ".Environment")=<environment: R_GlobalEnv> > ..@ flist :List of 1 > .. ..$ Subject: Factor w/ 4 levels "S1","S2","S3",..: 1 1 1 1 1 2 2 2 2 2 ... > .. ..- attr(*, "assign")= int 1 > ..@ cnms :List of 1 > .. ..$ Subject: chr "(Intercept)" > ..@ lower : num 0 > ..@ theta : num 0.499 > ..@ beta : num [1:4] 512.6 -20.5 -24.2 31.7 > ..@ u : num [1:4] 3.97 -12.4 -6.62 15.04 > ..@ devcomp:List of 2 > .. ..$ cmp : Named num [1:10] 3.24 5.56 3862.92 439.6 4302.51 ... > .. .. ..- attr(*, "names")= chr [1:10] "ldL2" "ldRX2" "wrss" "ussq" ... > .. ..$ dims: Named int [1:12] 20 20 4 16 1 4 1 1 0 4 ... > .. .. ..- attr(*, "names")= chr [1:12] "N" "n" "p" "nmp" ... > ..@ pp :Reference class 'merPredD' [package "lme4"] with 18 fields > .. ..$ Lambdat:Formal class 'dgCMatrix' [package "Matrix"] with 6 slots > .. .. .. ..@ i : int [1:4] 0 1 2 3 > .. .. .. ..@ p : int [1:5] 0 1 2 3 4 > .. .. .. ..@ Dim : int [1:2] 4 4 > .. .. .. ..@ Dimnames:List of 2 > .. .. .. .. ..$ : NULL > .. .. .. .. ..$ : NULL > .. .. .. ..@ x : num [1:4] 0.499 0.499 0.499 0.499 > .. .. .. ..@ factors : list() > .. ..$ LamtUt :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots > .. .. .. ..@ i : int [1:20] 0 0 0 0 0 1 1 1 1 1 ... > .. .. .. ..@ p : int [1:21] 0 1 2 3 4 5 6 7 8 9 ... > .. .. .. ..@ Dim : int [1:2] 4 20 > .. .. .. ..@ Dimnames:List of 2 > .. .. .. .. ..$ : NULL > .. .. .. .. ..$ : NULL > .. .. .. ..@ x : num [1:20] 0.499 0.499 0.499 0.499 0.499 ... > .. .. .. ..@ factors : list() > .. ..$ Lind : int [1:4] 1 1 1 1 > .. ..$ Ptr :<externalptr> > .. ..$ RZX : num [1:4, 1:4] 1.666 1.666 1.666 1.666 0.666 ... > .. ..$ Ut :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots > .. .. .. ..@ i : int [1:20] 0 0 0 0 0 1 1 1 1 1 ... > .. .. .. ..@ p : int [1:21] 0 1 2 3 4 5 6 7 8 9 ... > .. .. .. ..@ Dim : int [1:2] 4 20 > .. .. .. ..@ Dimnames:List of 2 > .. .. .. .. ..$ : chr [1:4] "S1" "S2" "S3" "S4" > .. .. .. .. ..$ : NULL > .. .. .. ..@ x : num [1:20] 1 1 1 1 1 1 1 1 1 1 ... > .. .. .. ..@ factors : list() > .. ..$ Utr : num [1:4] 1260 1211 1226 1279 > .. ..$ V : num [1:20, 1:4] 1 1 1 1 1 1 1 1 1 1 ... > .. ..$ VtV : num [1:4, 1:4] 20 0 0 0 10 10 0 0 10 5 ... > .. ..$ Vtr : num [1:4] 9963 4962 4941 2505 > .. ..$ X : num [1:20, 1:4] 1 1 1 1 1 1 1 1 1 1 ... > .. .. ..- attr(*, "dimnames")=List of 2 > .. .. .. ..$ : chr [1:20] "1" "2" "3" "4" ... > .. .. .. ..$ : chr [1:4] "(Intercept)" "Condicion1B" "Condicion2Y" "Condicion1B:Condicion2Y" > .. .. ..- attr(*, "assign")= int [1:4] 0 1 2 3 > .. .. ..- attr(*, "contrasts")=List of 2 > .. .. .. ..$ Condicion1: chr "contr.treatment" > .. .. .. ..$ Condicion2: chr "contr.treatment" > .. ..$ Xwts : num [1:20] 1 1 1 1 1 1 1 1 1 1 ... > .. ..$ Zt :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots > .. .. .. ..@ i : int [1:20] 0 0 0 0 0 1 1 1 1 1 ... > .. .. .. ..@ p : int [1:21] 0 1 2 3 4 5 6 7 8 9 ... > .. .. .. ..@ Dim : int [1:2] 4 20 > .. .. .. ..@ Dimnames:List of 2 > .. .. .. .. ..$ : chr [1:4] "S1" "S2" "S3" "S4" > .. .. .. .. ..$ : NULL > .. .. .. ..@ x : num [1:20] 1 1 1 1 1 1 1 1 1 1 ... > .. .. .. ..@ factors : list() > .. ..$ beta0 : num [1:4] 0 0 0 0 > .. ..$ delb : num [1:4] 512.6 -20.5 -24.2 31.7 > .. ..$ delu : num [1:4] 3.97 -12.4 -6.62 15.04 > .. ..$ theta : num 0.499 > .. ..$ u0 : num [1:4] 0 0 0 0 > .. ..and 42 methods, of which 30 are possibly relevant: > .. .. b, beta, CcNumer, copy#envRefClass, initialize, initializePtr, installPars, L, ldL2, ldRX2, linPred, P, ptr, RX, RXdiag, RXi, > .. .. setBeta0, setDelb, setDelu, setTheta, solve, solveU, sqrL, u, unsc, updateDecomp, updateL, updateLamtUt, updateRes, updateXwts > ..@ optinfo:List of 4 > .. ..$ optimizer: chr "Nelder_Mead" > .. ..$ control :List of 1 > .. .. ..$ verbose: int 0 > .. ..$ conv : num 0 > .. ..$ warnings : list() > > > > ########################################################################### > > Really, object structure changed a lot between the old version and the new. > For fix up the pamer.fnc is easy: you only must change one code line. > > > > > > ################################################################################################################################# > # "solución" > > ################################################################################################################################# > ############################## > ############################################# > > pamer.fnc2 <- function (model, ndigits = 4) { > if (length(rownames(anova(model))) == 0) { > cat("nothing to evaluate: model has only an intercept.\n\n") > cat("printing model fixed effects:\n") > > > fixef(model) > } > else { > dims <- NULL > # rank.X = qr(model@X)$rank > rank.X = qr(model@pp$X)$rank > > > anova.table = anova(model) > anova.table = cbind(anova.table, upper.den.df = nrow(model@frame) - > rank.X) > p.values.upper = as.numeric() > p.values.lower = as.numeric() > > > for (term in row.names(anova.table)) { > p.values.upper = c(p.values.upper, round(1 - pf(anova.table[term, > "F value"], anova.table[term, "Df"], nrow(model@frame) - > > > rank.X), ndigits)) > model.ranef <- ranef(model) > lower.bound <- 0 > for (i in 1:length(names(model.ranef))) { > dims <- dim(model.ranef[[i]]) > > > lower.bound <- lower.bound + dims[1] * dims[2] > } > p.values.lower = c(p.values.lower, 1 - pf(anova.table[term, > "F value"], anova.table[term, "Df"], nrow(model@frame) - > > > rank.X - lower.bound)) > } > dv <- gsub(" ", "", gsub("(.*)~.*", "\\1", as.character(model@call)[2])) > ss.tot <- sum((model@frame[, dv] - mean(model@frame[, > > > dv]))^2) > aov.table <- as.data.frame(anova(model)) > expl.dev <- vector("numeric") > for (i in rownames(aov.table)) { > expl.dev <- c(expl.dev, aov.table[i, 2]/ss.tot) > > > } > names(expl.dev) <- rownames(aov.table) > anova.table = round(cbind(anova.table, upper.p.val = p.values.upper, > lower.den.df = nrow(model@frame) - rank.X - lower.bound, > > > lower.p.val = p.values.lower, `expl.dev.(%)` = expl.dev * > 100), ndigits) > return(anova.table) > } > } > > > ################################################################################################################################# > > # Volviendo correr el código de ejemplo mandado > > ################################################################################################################################# > > dat <- data.frame(row.names= 1:20) > > dat$Subject <- > factor(rep(x= c("S1","S2","S3","S4"), each= 5)) > dat$RT <- rnorm( 20, mean= 500,sd= 20) > dat$Condicion1 <- > factor(rep(x= c("A","B"), each= 2)) > > > dat$Condicion2 <- > factor(rep(x= c("X","Y"))) > mod <- lmer( RT ~ Condicion1 * Condicion2 + (1|Subject), data=dat) > summary(mod) > > > pamer.fnc2(mod) > ########################################################################### > > > > > > 2013/10/18 daniel <daniel319@gmail.com> > >> Javier, >> >> Creo que aquí aplica la ley de Linus que dice: "Dado un número >> suficientemente elevado de ojos, todos los errores se convierten en >> obvios". La persona que revisa y encuentra un error no necesariamente >> tiene que ser la misma que la que lo escribe. Una motivación muy importante >> al compartir un código es la de recibir los beneficios del control de >> calidad por parte de tus pares. No dudes que cualquier contribución tuya >> bien documentada será apreciada por la persona que mantiene el paquete, ten >> en cuenta que él también lo usa. >> >> Daniel Merino >> >> >> 2013/10/18 Javier Marcuzzi <javier.ruben.marcuzzi@gmail.com> >> >>> Estimado Javier Villacampa Gonzáles >>> >>> Si una persona se toma el trabajo de desarrollar y compartir, como es el >>> caso de R, seguramente conoce de problemas que tuvo que decidir mientras >>> escibía el código, y estará agradecido porque hay gente que utiliza su >>> aporte, su trabajo no fué a la nada, todo lo contrario. >>> >>> En mi caso un solo autor tuvo una respuesta negativa para con migo. >>> >>> Javier Marcuzzi >>> >>> >>> 2013/10/18 Javier Villacampa González < >>> javier.villacampa.gonzalez@gmail.com> >>> >>> > Hola buenas. >>> > al final corri el siguiente código en mi máquina de casa. El problema >>> es >>> > que ha habido algún cambio en la librería lme4, que hace incompatible >>> los >>> > nuevos objetos lmer con la funcioón pamer.fnc. En este tipo de >>> situaciones >>> > imagino que lo propio sería ponerme en contacto con el autor o intentar >>> > corregir yo mismo el código o incluso ambas. ¿Es decortes escribir al >>> > autor reportandole el fallo? ¿ Existe algún problema protocolo para >>> hacer >>> > esto? (aparte de ponerme en contacto a traves del mail de contacto de >>> la >>> > persona responsable) >>> > >>> > Muchas gracias por adelantado. >>> > >>> > Aquí les dejo el código simplificado y las informaciones de sesión en >>> la >>> > que podrán ver distintas versiones de R así como SO. >>> > >>> > # ------------------------------ >>> > -------------------------- >>> > # Codigo >>> > # -------------------------------------------------------- >>> > require(lme4) >>> > require(LMERConvenienceFunctions) >>> > dat <- data.frame(row.names= 1:20) >>> > dat$Subject <- >>> > factor(rep(x= c("S1","S2","S3","S4"), each= 5)) >>> > dat$RT <- rnorm( 20, mean= 500,sd= 20) >>> > dat$Condicion1 <- >>> > factor(rep(x= c("A","B"), each= 2)) >>> > dat$Condicion2 <- >>> > factor(rep(x= c("X","Y"))) >>> > mod <- lmer( RT ~ Condicion1 * Condicion2 + (1|Subject), data=dat) >>> > summary(mod) >>> > >>> > pamer.fnc(mod) >>> > sessionInfo() >>> > >>> > # -------------------------------------------------------- >>> > Con R 3.0.1 NO FUNCIONA >>> > # ------------------------------ >>> > -------------------------- >>> > > require(lme4) >>> > Loading required package: lme4 >>> > Loading required package: lattice >>> > Loading required package: Matrix >>> > Mensajes de aviso perdidos >>> > package ‘lme4’ was built under R version 3.0.2 >>> > > require(LMERConvenienceFunctions) >>> > Loading required package: LMERConvenienceFunctions >>> > Mensajes de aviso perdidos >>> > package ‘LMERConvenienceFunctions’ was built under R version 3.0.2 >>> > > dat <- data.frame(row.names= 1:20) >>> > > dat$Subject <- >>> > + + factor(rep(x= c("S1","S2","S3","S4"), each= 5)) >>> > Mensajes de aviso perdidos >>> > In Ops.factor(factor(rep(x = c("S1", "S2", "S3", "S4"), each = 5))) : >>> > + not meaningful for factors >>> > > dat$RT <- rnorm( 20, mean= 500,sd= 20) >>> > > dat$Condicion1 <- >>> > + + factor(rep(x= c("A","B"), each= 2)) >>> > Mensajes de aviso perdidos >>> > In Ops.factor(factor(rep(x = c("A", "B"), each = 2))) : >>> > + not meaningful for factors >>> > > dat$Condicion2 <- >>> > + + factor(rep(x= c("X","Y"))) >>> > Mensajes de aviso perdidos >>> > In Ops.factor(factor(rep(x = c("X", "Y")))) : + not meaningful for >>> factors >>> > > mod <- lmer( RT ~ Condicion1 * Condicion2 + (1|Subject), data=dat) >>> > Error en FUN(X[[1L]], ...) : >>> > Invalid grouping factor specification, Subject >>> > > summary(mod) >>> > Linear mixed model fit by REML ['lmerMod'] >>> > Formula: RT ~ Condicion1 * Condicion2 + (1 | Subject) >>> > Data: dat >>> > >>> > REML criterion at convergence: 145.1507 >>> > >>> > Random effects: >>> > Groups Name Variance Std.Dev. >>> > Subject (Intercept) 0.0 0.00 >>> > Residual 340.9 18.46 >>> > Number of obs: 20, groups: Subject, 4 >>> > >>> > Fixed effects: >>> > Estimate Std. Error t value >>> > (Intercept) 494.7082 8.2575 59.91 >>> > Condicion1B 6.7442 11.6779 0.58 >>> > Condicion2Y -1.1768 11.6779 -0.10 >>> > Condicion1B:Condicion2Y 0.9188 16.5150 0.06 >>> > >>> > Correlation of Fixed Effects: >>> > (Intr) Cndc1B Cndc2Y >>> > Condicion1B -0.707 >>> > Condicion2Y -0.707 0.500 >>> > Cndcn1B:C2Y 0.500 -0.707 -0.707 >>> > > >>> > > pamer.fnc(mod) >>> > Error en qr(model@X) : >>> > error in evaluating the argument 'x' in selecting a method for >>> function >>> > 'qr': Error: no hay un slot de nombre "X" para ese objeto de clase >>> > "lmerMod" >>> > > sessionInfo() >>> > R version 3.0.1 (2013-05-16) >>> > Platform: x86_64-w64-mingw32/x64 (64-bit) >>> > >>> > locale: >>> > [1] LC_COLLATE=Spanish_Spain.1252 LC_CTYPE=Spanish_Spain.1252 >>> > [3] LC_MONETARY=Spanish_Spain.1252 LC_NUMERIC=C >>> > [5] LC_TIME=Spanish_Spain.1252 >>> > >>> > attached base packages: >>> > [1] stats graphics grDevices utils datasets methods base >>> > >>> > other attached packages: >>> > [1] LMERConvenienceFunctions_2.1 lme4_1.0-4 >>> > [3] Matrix_1.0-12 lattice_0.20-15 >>> > >>> > loaded via a namespace (and not attached): >>> > [1] grid_3.0.1 MASS_7.3-26 minqa_1.2.1 nlme_3.1-109 >>> splines_3.0.1 >>> > >>> > # ------------------------------ >>> > >>> > -------------------------- >>> > Con R 2.15.3 Windows NO FUNCIONA >>> > # -------------------------------------------------------- >>> > >>> > >>> > > require(lme4)Loading required package: lme4Loading required package: >>> > latticeLoading required package: Matrix >>> > > require(LMERConvenienceFunctions)Loading required package: >>> > LMERConvenienceFunctions >>> > > dat <- data.frame(row.names= 1:20) >>> > >>> > > dat$Subject <- >>> > + factor(rep(x= c("S1","S2","S3","S4"), each= 5)) >>> > >>> > > dat$RT <- rnorm( 20, mean= 500,sd= 20) >>> > >>> > > dat$Condicion1 <- >>> > + factor(rep(x= c("A","B"), each= 2)) >>> > >>> > > dat$Condicion2 <- >>> > + factor(rep(x= c("X","Y"))) >>> > >>> > > mod <- lmer( RT ~ Condicion1 * Condicion2 + (1|Subject), data=dat) >>> > >>> > > summary(mod) >>> > Linear mixed model fit by REML ['lmerMod'] >>> > Formula: RT ~ Condicion1 * Condicion2 + (1 | Subject) >>> > Data: dat >>> > >>> > REML criterion at convergence: 145.443 >>> > >>> > Random effects: >>> > Groups Name Variance Std.Dev. >>> > Subject (Intercept) 0.0 0.00 >>> > Residual 347.2 18.63 >>> > Number of obs: 20, groups: Subject, 4 >>> > >>> > Fixed effects: >>> > Estimate Std. Error t value >>> > (Intercept) 492.738 8.333 59.13 >>> > Condicion1B 11.351 11.785 0.96 >>> > Condicion2Y -1.000 11.785 -0.08 >>> > Condicion1B:Condicion2Y -6.865 16.666 -0.41 >>> > >>> > Correlation of Fixed Effects: >>> > (Intr) Cndc1B Cndc2Y >>> > Condicion1B -0.707 >>> > Condicion2Y -0.707 0.500 >>> > Cndcn1B:C2Y 0.500 -0.707 -0.707 >>> > >>> > > pamer.fnc(mod)Error en qr(model@X) : >>> > error in evaluating the argument 'x' in selecting a method for >>> > function 'qr': Error: no hay un slot de nombre "X" para ese objeto de >>> > clase "lmerMod"> sessionInfo()R version 2.15.3 (2013-03-01) >>> > Platform: x86_64-w64-mingw32/x64 (64-bit) >>> > >>> > locale: >>> > [1] LC_COLLATE=Spanish_Spain.1252 LC_CTYPE=Spanish_Spain.1252 >>> > [3] LC_MONETARY=Spanish_Spain.1252 LC_NUMERIC=C >>> > [5] LC_TIME=Spanish_Spain.1252 >>> > >>> > attached base packages: >>> > [1] stats graphics grDevices utils datasets methods base >>> > >>> > other attached packages: >>> > [1] LMERConvenienceFunctions_2.1 lme4_1.0-4 >>> > [3] Matrix_1.0-11 lattice_0.20-13 >>> > >>> > loaded via a namespace (and not attached): >>> > [1] grid_2.15.3 MASS_7.3-23 minqa_1.2.1 nlme_3.1-108 >>> > splines_2.15.3 >>> > [6] tools_2.15.3 >>> > >>> > >>> > # -------------------------------------------------------- >>> > Con R 2.15.2 Windows FUNCIONA >>> > # -------------------------------------------------------- >>> > > require(lme4) >>> > > require(LMERConvenienceFunctions) >>> > > dat <- data.frame(row.names= 1:20) >>> > > dat$Subject <- >>> > + factor(rep(x= c("S1","S2","S3","S4"), each= 5)) >>> > > dat$RT <- rnorm( 20, mean= 500,sd= 20) >>> > > dat$Condicion1 <- >>> > + factor(rep(x= c("A","B"), each= 2)) >>> > > dat$Condicion2 <- >>> > + factor(rep(x= c("X","Y"))) >>> > > mod <- lmer( RT ~ Condicion1 * Condicion2 + (1|Subject), data=dat) >>> > > summary(mod) >>> > Linear mixed model fit by REML >>> > Formula: RT ~ Condicion1 * Condicion2 + (1 | Subject) >>> > Data: dat >>> > AIC BIC logLik deviance REMLdev >>> > 162.3 168.3 -75.15 175.7 150.3 >>> > Random effects: >>> > Groups Name Variance Std.Dev. >>> > Subject (Intercept) 101.59 10.079 >>> > Residual 405.85 20.146 >>> > Number of obs: 20, groups: Subject, 4 >>> > >>> > Fixed effects: >>> > Estimate Std. Error t value >>> > (Intercept) 504.9071 10.3897 48.60 >>> > Condicion1B -0.5751 12.8853 -0.04 >>> > Condicion2Y -5.6312 12.8853 -0.44 >>> > Condicion1B:Condicion2Y -5.5012 18.2226 -0.30 >>> > >>> > Correlation of Fixed Effects: >>> > (Intr) Cndc1B Cndc2Y >>> > Condicion1B -0.620 >>> > Condicion2Y -0.620 0.500 >>> > Cndcn1B:C2Y 0.438 -0.707 -0.707 >>> > > >>> > > pamer.fnc(mod) >>> > Df Sum Sq Mean Sq F value upper.den.df >>> upper.p.val >>> > Condicion1 1 54.0666 54.0666 0.1332 16 >>> 0.7199 >>> > Condicion2 1 343.4881 343.4881 0.8463 16 >>> 0.3713 >>> > Condicion1:Condicion2 1 36.9835 36.9835 0.0911 16 >>> 0.7666 >>> > lower.den.df lower.p.val expl.dev.(%) >>> > Condicion1 12 0.7215 0.6186 >>> > Condicion2 12 0.3757 3.9298 >>> > Condicion1:Condicion2 12 0.7679 0.4231 >>> > > sessionInfo() >>> > R version 2.15.2 (2012-10-26) >>> > Platform: x86_64-w64-mingw32/x64 (64-bit) >>> > >>> > locale: >>> > [1] LC_COLLATE=Spanish_Spain.1252 LC_CTYPE=Spanish_Spain.1252 >>> > [3] LC_MONETARY=Spanish_Spain.1252 LC_NUMERIC=C >>> > [5] LC_TIME=Spanish_Spain.1252 >>> > >>> > attached base packages: >>> > [1] stats graphics grDevices utils datasets methods base >>> > >>> > other attached packages: >>> > [1] LMERConvenienceFunctions_2.0 lme4_0.999999-2 >>> > [3] Matrix_1.0-9 lattice_0.20-10 >>> > >>> > loaded via a namespace (and not attached): >>> > [1] grid_2.15.2 nlme_3.1-105 stats4_2.15.2 >>> > >>> > # -------------------------------------------------------- >>> > Con R 2.15.2 Uubntu FUNCIONA >>> > # -------------------------------------------------------- >>> > > require(lme4) >>> > > require( >>> > LMERConvenienceFunctions) >>> > > dat <- data.frame(row.names= 1:20) >>> > > dat$Subject <- >>> > + factor(rep(x= c("S1","S2","S3","S4"), each= 5)) >>> > > dat$RT <- rnorm( 20, mean= 500,sd= 20) >>> > > dat$Condicion1 <- >>> > + factor(rep(x= c("A","B"), each= 2)) >>> > > dat$Condicion2 <- >>> > + factor(rep(x= c("X","Y"))) >>> > > mod <- lmer( RT ~ Condicion1 * Condicion2 + (1|Subject), data=dat) >>> > > summary(mod) >>> > Linear mixed model fit by REML >>> > Formula: RT ~ Condicion1 * Condicion2 + (1 | Subject) >>> > Data: dat >>> > AIC BIC logLik deviance REMLdev >>> > 163.7 169.6 -75.83 177.1 151.7 >>> > Random effects: >>> > Groups Name Variance Std.Dev. >>> > Subject (Intercept) 0.00 0.000 >>> > Residual 511.81 22.623 >>> > Number of obs: 20, groups: Subject, 4 >>> > >>> > Fixed effects: >>> > Estimate Std. Error t value >>> > (Intercept) 499.096 10.117 49.33 >>> > Condicion1B 15.992 14.308 1.12 >>> > Condicion2Y 7.018 14.308 0.49 >>> > Condicion1B:Condicion2Y -34.872 20.235 -1.72 >>> > >>> > Correlation of Fixed Effects: >>> > (Intr) Cndc1B Cndc2Y >>> > Condicion1B -0.707 >>> > Condicion2Y -0.707 0.500 >>> > Cndcn1B:C2Y 0.500 -0.707 -0.707 >>> > > pamer.fnc(mod) >>> > Df Sum Sq Mean Sq F value upper.den.df >>> > upper.p.val lower.den.df lower.p.val expl.dev.(%) >>> > Condicion1 1 10.4232 10.4232 0.0204 16 >>> > 0.8883 12 0.8889 0.0965 >>> > Condicion2 1 542.6392 542.6392 1.0602 16 >>> > 0.3185 12 0.3235 5.0234 >>> > Condicion1:Condicion2 1 1520.0902 1520.0902 2.9700 16 >>> > 0.1041 12 0.1105 14.0720 >>> > > sessionInfo() >>> > R version 2.15.2 (2012-10-26) >>> > Platform: x86_64-pc-linux-gnu (64-bit) >>> > >>> > locale: >>> > [1] LC_CTYPE=es_ES.UTF-8 LC_NUMERIC=C >>> > LC_TIME=es_ES.UTF-8 LC_COLLATE=es_ES.UTF-8 >>> > [5] LC_MONETARY=es_ES.UTF-8 LC_MESSAGES=es_ES.UTF-8 >>> > LC_PAPER=C LC_NAME=C >>> > [9] LC_ADDRESS=C LC_TELEPHONE=C >>> > LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C >>> > >>> > attached base packages: >>> > [1] stats graphics grDevices utils datasets methods base >>> > >>> > other attached packages: >>> > [1] LMERConvenienceFunctions_2.0 lme4_0.999999-2 >>> > Matrix_1.0-11 lattice_0.20-13 >>> > >>> > loaded via a namespace (and not attached): >>> > [1] grid_2.15.2 nlme_3.1-108 stats4_2.15.2 tools_2. >>> > >>> > >>> > -- >>> > >>> > [[alternative HTML version deleted]] >>> > >>> > >>> > _______________________________________________ >>> > R-help-es mailing list >>> > R-help-es@r-project.org >>> > https://stat.ethz.ch/mailman/listinfo/r-help-es >>> > >>> > >>> >>> [[alternative HTML version deleted]] >>> >>> >>> _______________________________________________ >>> R-help-es mailing list >>> R-help-es@r-project.org >>> https://stat.ethz.ch/mailman/listinfo/r-help-es >>> >>> >> >> >> -- >> Daniel >> > > > > -- > >-- [[alternative HTML version deleted]]