Here is a test data set and code. I am including the data set after the code and discussion to make reading easier. Apologies for the size of the data set, but my problem occurs when there are a lot of Z variables. Thanks for your time.
# Enter data below # Sample code library(lme4) mb<- length(unique(testsamp$WYear)) # Create the formula for the set of identically distributed random effects Zs<- paste("Z",2:(mb-1)),sep="") Trendformula <-as.formula(paste("LogY ~ WYear + (1+WYear|Site) + (1|", randommodel=paste(paste(Zs,collapse="+"), ")"))) fittest<-lmer(Trendformula, data = testsamp) summary(fittest) # Here I get an error because the name of the random effect is too long to print # in the random effects output (I think). # The error message is: Error in names(bars) <- unlist(lapply(bars, function(x) # deparse(x[[3]]))) : 'names' attribute [3] must be the same length as the vector [2] # However, when fewer Z variables are used in the random portion of the model, # there is no error. # Using only Z2 + + Z9 for the random intercept Zs2<- paste("Z",2:9,sep="") Trendformula2 <-as.formula(paste("LogY ~ WYear + (1+WYear|Site) + (1|", randommodel=paste(paste(Zs2,collapse="+"), ")"))) fittest2<-lmer(Trendformula2, data = testsamp) summary(fittest2) # Is there a way to either name the set of iid random effects something else or # to define a random variable that could be used in the model to create a # random intercept? # I have had some success in lme, but it would be helpful for my simulation if I # could conduct this analysis with lmer. My model in lme is not correctly # estimating one of the variance components (random Site intercept). # I am using: detach(package:lme4) library(nlme) random.model.lme <-as.formula(paste("~-1+",paste(paste("Z",2:(mb-1),sep=""),collapse="+"))) n<-dim(testsamp)[1] testsampgroup <- rep(1,n) testsamp.lme <-cbind(testsamp,testsampgroup) testgroupSamp<- groupedData(LogY ~ WYearCen|testsampgroup, inner= ~Site, data= data.frame(testsamp.lme)) fittest3<-lme(LogY ~ WYearCen, random= pdBlocked(list(pdIdent(~-1+WYearCen:as.factor(Site)), pdIdent(~-1+as.factor(Site)), pdIdent(random.model.lme))),data= testgroupSamp) summary(fittest3) VarCorr(fittest3) # Data testsamp <- structure(list(Year = c(2008, 2008, 2008, 2008, 2008, 2008, 2008, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2022, 2022, 2022, 2022, 2022, 2022, 2022), WYear = c(0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14), Site = c(4, 18, 26, 40, 67, 75, 94, 4, 18, 26, 40, 67, 75, 94, 4, 18, 26, 40, 67, 75, 94, 4, 18, 26, 40, 67, 75, 94, 4, 18, 26, 40, 67, 75, 94, 4, 18, 26, 40, 67, 75, 94, 4, 18, 26, 40, 67, 75, 94, 4, 18, 26, 40, 67, 75, 94, 4, 18, 26, 40, 67, 75, 94, 4, 18, 26, 40, 67, 75, 94, 4, 18, 26, 40, 67, 75, 94, 4, 18, 26, 40, 67, 75, 94, 4, 18, 26, 40, 67, 75, 94, 4, 18, 26, 40, 67, 75, 94, 4, 18, 26, 40, 67, 75, 94), LogY = c(0.848648866298552, 0.809143925760456, 0.734173952725014, 1.46749967704437, 0.716106254860468, 0.843871512951468, 1.09120092433378, 0.800893809796851, 0.996674977596997, 0.917613604481207, 1.71928772722884, 0.797853604855215, 0.922298691760041, 0.964654422529188, 0.782903180421921, 1.13457969553106, 1.21628917384868, 2.03084776647495, 0.872954085910578, 1.02192794559856, 0.746307251774509, 0.439812203188778, 1.11164109549224, 1.18414357836729, 2.00157711459358, 0.66577753155877, 0.856374433428581, 0.343862060001402, 0.278505653147057, 1.20632152691478, 1.32289150679746, 2.19814430598707, 0.538363941164496, 0.820038163290321, 0.070054765524828, 0.0479738684639024, 1.29137364087568, 1.52436357249377, 2.32150525025777, 0.595507040392793, 0.851417610550757, -0.115908144193410, 0.0118306018140099, 1.39448009350962, 1.71677754106603, 2.59146662837284, 0.595750060671620, 0.855387479311679, -0.430729785591898, 0.0178423104900579, 1.60964246000316, 1.99184029256509, 2.86865842252168, 0.695124899993409, 0.96175860396451, -0.600991172113926, -0.174420349224615, 1.73794158380868, 2.06718359946362, 3.04502112974038, 0.730730638403177, 0.961110819398807, -0.856693722990918, -0.549458074126028, 1.52302453916110, 2.05923417821491, 2.95885487422314, 0.302432275785407, 0.718537282886428, -1.41807557701934, -0.474811468779057, 1.88486023048201, 2.47921637905194, 3.31076232685622, 0.600331824659821, 0.997014319132077, -1.36760375228162, -0.491828047247449, 2.09353379020743, 2.74721582678157, 3.58818112810645, 0.65742631492698, 1.06027358323846, -1.58298244571648, -0.934472752299038, 1.83456803880667, 2.62936515021684, 3.56971226362308, 0.389323036788794, 0.748060984171013, -2.13928096660883, -1.26100797232926, 1.83430218924218, 2.65380472944419, 3.62529901196750, 0.271765247781891, 0.639379726021376, -2.50138714617066, -1.36434864536697, 1.95417376162485, 2.84537426171405, 3.76029816545047, 0.171262422338166, 0.63595411426061, -2.72648123827278), Y = c(2.33648781083889, 2.24598443402562, 2.08375999711081, 4.33837423214822, 2.04644932501053, 2.32535220351989, 2.97784809630864, 2.22753102803039, 2.70925849019601, 2.50330936997246, 5.5805521729813, 2.22076916113014, 2.51506510968675, 2.62388074570782, 2.18781467519546, 3.10986617752641, 3.37464176115807, 7.62054406285807, 2.39397241834575, 2.77854648986394, 2.10919688492552, 1.55241565242538, 3.03934215461328, 3.26788693363161, 7.40071868133414, 1.94600301201132, 2.35460841009671, 1.41038407371191, 1.32115407405314, 3.34117160999488, 3.75426116973332, 9.0082813655785, 1.71320166935217, 2.27058648893032, 1.07256691933604, 1.04914323924183, 3.63778012876121, 4.59222002395514, 10.1910027761430, 1.81395045797806, 2.34296591199978, 0.89055702237416, 1.01190086017652, 4.03287730840125, 5.56656151506009, 13.3493357676049, 1.81439133829339, 2.35228566604212, 0.650034535742804, 1.01800243542715, 5.00102284245171, 7.32900887997844, 17.6133726381587, 2.00395935282089, 2.61629345414488, 0.548267938797843, 0.839943753736141, 5.68562798048777, 7.90253504257589, 21.0104751440743, 2.07659729526341, 2.61459920843830, 0.424563488824068, 0.577262559146385, 4.58607500338397, 7.83996349588931, 19.2758857986172, 1.35314603256567, 2.05143035272921, 0.242179624775457, 0.622002312266844, 6.58543393476032, 11.9319106582846, 27.4060098478603, 1.82272352466727, 2.71017801013783, 0.254716592899401, 0.611507507191544, 8.11353609874542, 15.5991406590765, 36.1682306843681, 1.92981919064962, 2.8871607600197, 0.20536170381795, 0.392792910103641, 6.26242843503692, 13.8649649375266, 35.5063752059022, 1.47598127057995, 2.11289909722918, 0.117739471204143, 0.283368255138982, 6.26076379244682, 14.2079935097071, 37.5359451785784, 1.31227890476568, 1.89530490631499, 0.0819712136688162, 0.2555470735606, 7.0580849532232, 17.2079977586343, 42.961233624846, 1.18680215155599, 1.88882343537745, 0.065449185044807 ), Z2 = c(0.47227027821606, 0.47227027821606, 0.47227027821606, 0.47227027821606, 0.47227027821606, 0.47227027821606, 0.47227027821606, 0.269868730409177, 0.269868730409177, 0.269868730409177, 0.269868730409177, 0.269868730409177, 0.269868730409177, 0.269868730409177, 0.0986058822648916, 0.0986058822648916, 0.0986058822648916, 0.0986058822648916, 0.0986058822648916, 0.0986058822648916, 0.0986058822648916, -0.0415182662167964, -0.0415182662167964, -0.0415182662167964, -0.0415182662167964, -0.0415182662167964, -0.0415182662167964, -0.0415182662167964, -0.150503715035887, -0.150503715035887, -0.150503715035887, -0.150503715035887, -0.150503715035887, -0.150503715035887, -0.150503715035887, -0.228350464192381, -0.228350464192381, -0.228350464192381, -0.228350464192381, -0.228350464192381, -0.228350464192381, -0.228350464192381, -0.275058513686277, -0.275058513686277, -0.275058513686277, -0.275058513686277, -0.275058513686277, -0.275058513686277, -0.275058513686277, -0.290627863517575, -0.290627863517575, -0.290627863517575, -0.290627863517575, -0.290627863517575, -0.290627863517575, -0.290627863517575, -0.275058513686277, -0.275058513686277, -0.275058513686277, -0.275058513686277, -0.275058513686277, -0.275058513686277, -0.275058513686277, -0.228350464192381, -0.228350464192381, -0.228350464192381, -0.228350464192381, -0.228350464192381, -0.228350464192381, -0.228350464192381, -0.150503715035887, -0.150503715035887, -0.150503715035887, -0.150503715035887, -0.150503715035887, -0.150503715035887, -0.150503715035887, -0.0415182662167965, -0.0415182662167965, -0.0415182662167965, -0.0415182662167965, -0.0415182662167965, -0.0415182662167965, -0.0415182662167965, 0.0986058822648916, 0.0986058822648916, 0.0986058822648916, 0.0986058822648916, 0.0986058822648916, 0.0986058822648916, 0.0986058822648916, 0.269868730409177, 0.269868730409177, 0.269868730409177, 0.269868730409177, 0.269868730409177, 0.269868730409177, 0.269868730409177, 0.47227027821606, 0.47227027821606, 0.47227027821606, 0.47227027821606, 0.47227027821606, 0.47227027821606, 0.47227027821606 ), Z3 = c(-0.456256435177108, -0.456256435177108, -0.456256435177108, -0.456256435177108, -0.456256435177108, -0.456256435177108, -0.456256435177108, -0.0651794907395872, -0.0651794907395872, -0.0651794907395872, -0.0651794907395872, -0.0651794907395872, -0.0651794907395872, -0.0651794907395872, 0.175483244298888, 0.175483244298888, 0.175483244298888, 0.175483244298888, 0.175483244298888, 0.175483244298888, 0.175483244298888, 0.290800804838157, 0.290800804838157, 0.290800804838157, 0.290800804838157, 0.290800804838157, 0.290800804838157, 0.290800804838157, 0.305842225778062, 0.305842225778062, 0.305842225778062, 0.305842225778062, 0.305842225778062, 0.305842225778062, 0.305842225778062, 0.245676542018443, 0.245676542018443, 0.245676542018443, 0.245676542018443, 0.245676542018443, 0.245676542018443, 0.245676542018443, 0.135372788459142, 0.135372788459142, 0.135372788459142, 0.135372788459142, 0.135372788459142, 0.135372788459142, 0.135372788459142, 4.80758108354045e-17, 4.80758108354045e-17, 4.80758108354045e-17, 4.80758108354045e-17, 4.80758108354045e-17, 4.80758108354045e-17, 4.80758108354045e-17, -0.135372788459142, -0.135372788459142, -0.135372788459142, -0.135372788459142, -0.135372788459142, -0.135372788459142, -0.135372788459142, -0.245676542018443, -0.245676542018443, -0.245676542018443, -0.245676542018443, -0.245676542018443, -0.245676542018443, -0.245676542018443, -0.305842225778062, -0.305842225778062, -0.305842225778062, -0.305842225778062, -0.305842225778062, -0.305842225778062, -0.305842225778062, -0.290800804838157, -0.290800804838157, -0.290800804838157, -0.290800804838157, -0.290800804838157, -0.290800804838157, -0.290800804838157, -0.175483244298888, -0.175483244298888, -0.175483244298888, -0.175483244298888, -0.175483244298888, -0.175483244298888, -0.175483244298888, 0.0651794907395869, 0.0651794907395869, 0.0651794907395869, 0.0651794907395869, 0.0651794907395869, 0.0651794907395869, 0.0651794907395869, 0.456256435177108, 0.456256435177108, 0.456256435177108, 0.456256435177108, 0.456256435177108, 0.456256435177108, 0.456256435177108), Z4 = c(0.393641410895141, 0.393641410895141, 0.393641410895141, 0.393641410895141, 0.393641410895141, 0.393641410895141, 0.393641410895141, -0.168703461812203, -0.168703461812203, -0.168703461812203, -0.168703461812203, -0.168703461812203, -0.168703461812203, -0.168703461812203, -0.341732653414463, -0.341732653414463, -0.341732653414463, -0.341732653414463, -0.341732653414463, -0.341732653414463, -0.341732653414463, -0.276846706563615, -0.276846706563615, -0.276846706563615, -0.276846706563615, -0.276846706563615, -0.276846706563615, -0.276846706563615, -0.0979187925203697, -0.0979187925203697, -0.0979187925203697, -0.0979187925203697, -0.0979187925203697, -0.0979187925203697, -0.0979187925203697, 0.0987052888458345, 0.0987052888458345, 0.0987052888458345, 0.0987052888458345, 0.0987052888458345, 0.0987052888458345, 0.0987052888458345, 0.244207109056825, 0.244207109056825, 0.244207109056825, 0.244207109056825, 0.244207109056825, 0.244207109056825, 0.244207109056825, 0.297295611025701, 0.297295611025701, 0.297295611025701, 0.297295611025701, 0.297295611025701, 0.297295611025701, 0.297295611025701, 0.244207109056826, 0.244207109056826, 0.244207109056826, 0.244207109056826, 0.244207109056826, 0.244207109056826, 0.244207109056826, 0.0987052888458344, 0.0987052888458344, 0.0987052888458344, 0.0987052888458344, 0.0987052888458344, 0.0987052888458344, 0.0987052888458344, -0.0979187925203697, -0.0979187925203697, -0.0979187925203697, -0.0979187925203697, -0.0979187925203697, -0.0979187925203697, -0.0979187925203697, -0.276846706563615, -0.276846706563615, -0.276846706563615, -0.276846706563615, -0.276846706563615, -0.276846706563615, -0.276846706563615, -0.341732653414463, -0.341732653414463, -0.341732653414463, -0.341732653414463, -0.341732653414463, -0.341732653414463, -0.341732653414463, -0.168703461812203, -0.168703461812203, -0.168703461812203, -0.168703461812203, -0.168703461812203, -0.168703461812203, -0.168703461812203, 0.393641410895141, 0.393641410895141, 0.393641410895141, 0.393641410895141, 0.393641410895141, 0.393641410895141, 0.393641410895141), Z5 = c(-0.307723646230283, -0.307723646230283, -0.307723646230283, -0.307723646230283, -0.307723646230283, -0.307723646230283, -0.307723646230283, 0.351684167120324, 0.351684167120324, 0.351684167120324, 0.351684167120324, 0.351684167120324, 0.351684167120324, 0.351684167120324, 0.300960489170276, 0.300960489170276, 0.300960489170276, 0.300960489170276, 0.300960489170276, 0.300960489170276, 0.300960489170276, 0.0135263141200131, 0.0135263141200131, 0.0135263141200131, 0.0135263141200131, 0.0135263141200131, 0.0135263141200131, 0.0135263141200131, -0.230869588730213, -0.230869588730213, -0.230869588730213, -0.230869588730213, -0.230869588730213, -0.230869588730213, -0.230869588730213, -0.307416230000283, -0.307416230000283, -0.307416230000283, -0.307416230000283, -0.307416230000283, -0.307416230000283, -0.307416230000283, -0.207505955250191, -0.207505955250191, -0.207505955250191, -0.207505955250191, -0.207505955250191, -0.207505955250191, -0.207505955250191, 2.73029795708800e-17, 2.73029795708800e-17, 2.73029795708800e-17, 2.73029795708800e-17, 2.73029795708800e-17, 2.73029795708800e-17, 2.73029795708800e-17, 0.207505955250191, 0.207505955250191, 0.207505955250191, 0.207505955250191, 0.207505955250191, 0.207505955250191, 0.207505955250191, 0.307416230000283, 0.307416230000283, 0.307416230000283, 0.307416230000283, 0.307416230000283, 0.307416230000283, 0.307416230000283, 0.230869588730212, 0.230869588730212, 0.230869588730212, 0.230869588730212, 0.230869588730212, 0.230869588730212, 0.230869588730212, -0.0135263141200123, -0.0135263141200123, -0.0135263141200123, -0.0135263141200123, -0.0135263141200123, -0.0135263141200123, -0.0135263141200123, -0.300960489170277, -0.300960489170277, -0.300960489170277, -0.300960489170277, -0.300960489170277, -0.300960489170277, -0.300960489170277, -0.351684167120323, -0.351684167120323, -0.351684167120323, -0.351684167120323, -0.351684167120323, -0.351684167120323, -0.351684167120323, 0.307723646230283, 0.307723646230283, 0.307723646230283, 0.307723646230283, 0.307723646230283, 0.307723646230283, 0.307723646230283), Z6 = c(0.219001863703187, 0.219001863703187, 0.219001863703187, 0.219001863703187, 0.219001863703187, 0.219001863703187, 0.219001863703187, -0.438003727406375, -0.438003727406375, -0.438003727406375, -0.438003727406375, -0.438003727406375, -0.438003727406375, -0.438003727406375, -0.084231486039687, -0.084231486039687, -0.084231486039687, -0.084231486039687, -0.084231486039687, -0.084231486039687, -0.084231486039687, 0.269540755326999, 0.269540755326999, 0.269540755326999, 0.269540755326999, 0.269540755326999, 0.269540755326999, 0.269540755326999, 0.301701868178519, 0.301701868178519, 0.301701868178519, 0.301701868178519, 0.301701868178519, 0.301701868178519, 0.301701868178519, 0.076574078217897, 0.076574078217897, 0.076574078217897, 0.076574078217897, 0.076574078217897, 0.076574078217897, 0.076574078217897, -0.191435195544744, -0.191435195544744, -0.191435195544744, -0.191435195544744, -0.191435195544744, -0.191435195544744, -0.191435195544744, -0.306296312871592, -0.306296312871592, -0.306296312871592, -0.306296312871592, -0.306296312871592, -0.306296312871592, -0.306296312871592, -0.191435195544745, -0.191435195544745, -0.191435195544745, -0.191435195544745, -0.191435195544745, -0.191435195544745, -0.191435195544745, 0.0765740782178983, 0.0765740782178983, 0.0765740782178983, 0.0765740782178983, 0.0765740782178983, 0.0765740782178983, 0.0765740782178983, 0.301701868178517, 0.301701868178517, 0.301701868178517, 0.301701868178517, 0.301701868178517, 0.301701868178517, 0.301701868178517, 0.269540755327, 0.269540755327, 0.269540755327, 0.269540755327, 0.269540755327, 0.269540755327, 0.269540755327, -0.0842314860396875, -0.0842314860396875, -0.0842314860396875, -0.0842314860396875, -0.0842314860396875, -0.0842314860396875, -0.0842314860396875, -0.438003727406375, -0.438003727406375, -0.438003727406375, -0.438003727406375, -0.438003727406375, -0.438003727406375, -0.438003727406375, 0.219001863703188, 0.219001863703188, 0.219001863703188, 0.219001863703188, 0.219001863703188, 0.219001863703188, 0.219001863703188), Z7 = c(-0.141858517577507, -0.141858517577507, -0.141858517577507, -0.141858517577507, -0.141858517577507, -0.141858517577507, -0.141858517577507, 0.42557555273252, 0.42557555273252, 0.42557555273252, 0.42557555273252, 0.42557555273252, 0.42557555273252, 0.42557555273252, -0.185507292216737, -0.185507292216737, -0.185507292216737, -0.185507292216737, -0.185507292216737, -0.185507292216737, -0.185507292216737, -0.338278003454058, -0.338278003454058, -0.338278003454058, -0.338278003454058, -0.338278003454058, -0.338278003454058, -0.338278003454058, -0.0327365809794237, -0.0327365809794237, -0.0327365809794237, -0.0327365809794237, -0.0327365809794237, -0.0327365809794237, -0.0327365809794237, 0.272804841495205, 0.272804841495205, 0.272804841495205, 0.272804841495205, 0.272804841495205, 0.272804841495205, 0.272804841495205, 0.272804841495207, 0.272804841495207, 0.272804841495207, 0.272804841495207, 0.272804841495207, 0.272804841495207, 0.272804841495207, 4.25663509926017e-16, 4.25663509926017e-16, 4.25663509926017e-16, 4.25663509926017e-16, 4.25663509926017e-16, 4.25663509926017e-16, 4.25663509926017e-16, -0.272804841495207, -0.272804841495207, -0.272804841495207, -0.272804841495207, -0.272804841495207, -0.272804841495207, -0.272804841495207, -0.272804841495206, -0.272804841495206, -0.272804841495206, -0.272804841495206, -0.272804841495206, -0.272804841495206, -0.272804841495206, 0.0327365809794244, 0.0327365809794244, 0.0327365809794244, 0.0327365809794244, 0.0327365809794244, 0.0327365809794244, 0.0327365809794244, 0.338278003454055, 0.338278003454055, 0.338278003454055, 0.338278003454055, 0.338278003454055, 0.338278003454055, 0.338278003454055, 0.185507292216741, 0.185507292216741, 0.185507292216741, 0.185507292216741, 0.185507292216741, 0.185507292216741, 0.185507292216741, -0.425575552732522, -0.425575552732522, -0.425575552732522, -0.425575552732522, -0.425575552732522, -0.425575552732522, -0.425575552732522, 0.141858517577507, 0.141858517577507, 0.141858517577507, 0.141858517577507, 0.141858517577507, 0.141858517577507, 0.141858517577507), Z8 = c(0.083314261738317, 0.083314261738317, 0.083314261738317, 0.083314261738317, 0.083314261738317, 0.083314261738317, 0.083314261738317, -0.345159084344455, -0.345159084344455, -0.345159084344455, -0.345159084344455, -0.345159084344455, -0.345159084344455, -0.345159084344455, 0.379949655180232, 0.379949655180232, 0.379949655180232, 0.379949655180232, 0.379949655180232, 0.379949655180232, 0.379949655180232, 0.143739990032049, 0.143739990032049, 0.143739990032049, 0.143739990032049, 0.143739990032049, 0.143739990032049, 0.143739990032049, -0.284733356050736, -0.284733356050736, -0.284733356050736, -0.284733356050736, -0.284733356050736, -0.284733356050736, -0.284733356050736, -0.251773867890516, -0.251773867890516, -0.251773867890516, -0.251773867890516, -0.251773867890516, -0.251773867890516, -0.251773867890516, 0.114442667222960, 0.114442667222960, 0.114442667222960, 0.114442667222960, 0.114442667222960, 0.114442667222960, 0.114442667222960, 0.320439468224296, 0.320439468224296, 0.320439468224296, 0.320439468224296, 0.320439468224296, 0.320439468224296, 0.320439468224296, 0.114442667222965, 0.114442667222965, 0.114442667222965, 0.114442667222965, 0.114442667222965, 0.114442667222965, 0.114442667222965, -0.251773867890520, -0.251773867890520, -0.251773867890520, -0.251773867890520, -0.251773867890520, -0.251773867890520, -0.251773867890520, -0.284733356050731, -0.284733356050731, -0.284733356050731, -0.284733356050731, -0.284733356050731, -0.284733356050731, -0.284733356050731, 0.143739990032042, 0.143739990032042, 0.143739990032042, 0.143739990032042, 0.143739990032042, 0.143739990032042, 0.143739990032042, 0.379949655180234, 0.379949655180234, 0.379949655180234, 0.379949655180234, 0.379949655180234, 0.379949655180234, 0.379949655180234, -0.345159084344455, -0.345159084344455, -0.345159084344455, -0.345159084344455, -0.345159084344455, -0.345159084344455, -0.345159084344455, 0.0833142617383167, 0.0833142617383167, 0.0833142617383167, 0.0833142617383167, 0.0833142617383167, 0.0833142617383167, 0.0833142617383167), Z9 = c(-0.0440394305225472, -0.0440394305225472, -0.0440394305225472, -0.0440394305225472, -0.0440394305225472, -0.0440394305225472, -0.0440394305225472, 0.239071194265257, 0.239071194265257, 0.239071194265257, 0.239071194265257, 0.239071194265257, 0.239071194265257, 0.239071194265257, -0.436038757151818, -0.436038757151818, -0.436038757151818, -0.436038757151818, -0.436038757151818, -0.436038757151818, -0.436038757151818, 0.16647872637096, 0.16647872637096, 0.16647872637096, 0.16647872637096, 0.16647872637096, 0.16647872637096, 0.16647872637096, 0.318922908948979, 0.318922908948979, 0.318922908948979, 0.318922908948979, 0.318922908948979, 0.318922908948979, 0.318922908948979, -0.120987446490507, -0.120987446490507, -0.120987446490507, -0.120987446490507, -0.120987446490507, -0.120987446490507, -0.120987446490507, -0.326666105524386, -0.326666105524386, -0.326666105524386, -0.326666105524386, -0.326666105524386, -0.326666105524386, -0.326666105524386, 1.6560876488147e-15, 1.6560876488147e-15, 1.6560876488147e-15, 1.6560876488147e-15, 1.6560876488147e-15, 1.6560876488147e-15, 1.6560876488147e-15, 0.326666105524385, 0.326666105524385, 0.326666105524385, 0.326666105524385, 0.326666105524385, 0.326666105524385, 0.326666105524385, 0.120987446490508, 0.120987446490508, 0.120987446490508, 0.120987446490508, 0.120987446490508, 0.120987446490508, 0.120987446490508, -0.318922908948989, -0.318922908948989, -0.318922908948989, -0.318922908948989, -0.318922908948989, -0.318922908948989, -0.318922908948989, -0.166478726370943, -0.166478726370943, -0.166478726370943, -0.166478726370943, -0.166478726370943, -0.166478726370943, -0.166478726370943, 0.436038757151805, 0.436038757151805, 0.436038757151805, 0.436038757151805, 0.436038757151805, 0.436038757151805, 0.436038757151805, -0.239071194265252, -0.239071194265252, -0.239071194265252, -0.239071194265252, -0.239071194265252, -0.239071194265252, -0.239071194265252, 0.0440394305225465, 0.0440394305225465, 0.0440394305225465, 0.0440394305225465, 0.0440394305225465, 0.0440394305225465, 0.0440394305225465 ), Z10 = c(0.0207056819701757, 0.0207056819701757, 0.0207056819701757, 0.0207056819701757, 0.0207056819701757, 0.0207056819701757, 0.0207056819701757, -0.141981819224062, -0.141981819224062, -0.141981819224062, -0.141981819224062, -0.141981819224062, -0.141981819224062, -0.141981819224062, 0.371109530696229, 0.371109530696229, 0.371109530696229, 0.371109530696229, 0.371109530696229, 0.371109530696229, 0.371109530696229, -0.392270282599825, -0.392270282599825, -0.392270282599825, -0.392270282599825, -0.392270282599825, -0.392270282599825, -0.392270282599825, -0.0361780597061064, -0.0361780597061064, -0.0361780597061064, -0.0361780597061064, -0.0361780597061064, -0.0361780597061064, -0.0361780597061064, 0.356774827793781, 0.356774827793781, 0.356774827793781, 0.356774827793781, 0.356774827793781, 0.356774827793781, 0.356774827793781, -0.0061434441010547, -0.0061434441010547, -0.0061434441010547, -0.0061434441010547, -0.0061434441010547, -0.0061434441010547, -0.0061434441010547, -0.344032869658285, -0.344032869658285, -0.344032869658285, -0.344032869658285, -0.344032869658285, -0.344032869658285, -0.344032869658285, -0.00614344410104096, -0.00614344410104096, -0.00614344410104096, -0.00614344410104096, -0.00614344410104096, -0.00614344410104096, -0.00614344410104096, 0.356774827793798, 0.356774827793798, 0.356774827793798, 0.356774827793798, 0.356774827793798, 0.356774827793798, 0.356774827793798, -0.0361780597061478, -0.0361780597061478, -0.0361780597061478, -0.0361780597061478, -0.0361780597061478, -0.0361780597061478, -0.0361780597061478, -0.392270282599797, -0.392270282599797, -0.392270282599797, -0.392270282599797, -0.392270282599797, -0.392270282599797, -0.392270282599797, 0.371109530696221, 0.371109530696221, 0.371109530696221, 0.371109530696221, 0.371109530696221, 0.371109530696221, 0.371109530696221, -0.141981819224062, -0.141981819224062, -0.141981819224062, -0.141981819224062, -0.141981819224062, -0.141981819224062, -0.141981819224062, 0.0207056819701758, 0.0207056819701758, 0.0207056819701758, 0.0207056819701758, 0.0207056819701758, 0.0207056819701758, 0.0207056819701758 ), Z11 = c(-0.00849937774690609, -0.00849937774690609, -0.00849937774690609, -0.00849937774690609, -0.00849937774690609, -0.00849937774690609, -0.00849937774690609, 0.0716376124382085, 0.0716376124382085, 0.0716376124382085, 0.0716376124382085, 0.0716376124382085, 0.0716376124382085, 0.0716376124382085, -0.248910348302249, -0.248910348302249, -0.248910348302249, -0.248910348302249, -0.248910348302249, -0.248910348302249, -0.248910348302249, 0.43225406827121, 0.43225406827121, 0.43225406827121, 0.43225406827121, 0.43225406827121, 0.43225406827121, 0.43225406827121, -0.307191795709549, -0.307191795709549, -0.307191795709549, -0.307191795709549, -0.307191795709549, -0.307191795709549, -0.307191795709549, -0.146917815339487, -0.146917815339487, -0.146917815339487, -0.146917815339487, -0.146917815339487, -0.146917815339487, -0.146917815339487, 0.360616455833108, 0.360616455833108, 0.360616455833108, 0.360616455833108, 0.360616455833108, 0.360616455833108, 0.360616455833108, 2.37442501121216e-14, 2.37442501121216e-14, 2.37442501121216e-14, 2.37442501121216e-14, 2.37442501121216e-14, 2.37442501121216e-14, 2.37442501121216e-14, -0.360616455833123, -0.360616455833123, -0.360616455833123, -0.360616455833123, -0.360616455833123, -0.360616455833123, -0.360616455833123, 0.146917815339424, 0.146917815339424, 0.146917815339424, 0.146917815339424, 0.146917815339424, 0.146917815339424, 0.146917815339424, 0.307191795709669, 0.307191795709669, 0.307191795709669, 0.307191795709669, 0.307191795709669, 0.307191795709669, 0.307191795709669, -0.432254068271316, -0.432254068271316, -0.432254068271316, -0.432254068271316, -0.432254068271316, -0.432254068271316, -0.432254068271316, 0.248910348302301, 0.248910348302301, 0.248910348302301, 0.248910348302301, 0.248910348302301, 0.248910348302301, 0.248910348302301, -0.0716376124382226, -0.0716376124382226, -0.0716376124382226, -0.0716376124382226, -0.0716376124382226, -0.0716376124382226, -0.0716376124382226, 0.00849937774690764, 0.00849937774690764, 0.00849937774690764, 0.00849937774690764, 0.00849937774690764, 0.00849937774690764, 0.00849937774690764), Z12 = c(0.00295373795124409, 0.00295373795124409, 0.00295373795124409, 0.00295373795124409, 0.00295373795124409, 0.00295373795124409, 0.00295373795124409, -0.0299593420769036, -0.0299593420769036, -0.0299593420769036, -0.0299593420769036, -0.0299593420769036, -0.0299593420769036, -0.0299593420769036, 0.132074282677049, 0.132074282677049, 0.132074282677049, 0.132074282677049, 0.132074282677049, 0.132074282677049, 0.132074282677049, -0.323223324378965, -0.323223324378965, -0.323223324378965, -0.323223324378965, -0.323223324378965, -0.323223324378965, -0.323223324378965, 0.450234056282428, 0.450234056282428, 0.450234056282428, 0.450234056282428, 0.450234056282428, 0.450234056282428, 0.450234056282428, -0.27385370433672, -0.27385370433672, -0.27385370433672, -0.27385370433672, -0.27385370433672, -0.27385370433672, -0.27385370433672, -0.15317241090017, -0.15317241090017, -0.15317241090017, -0.15317241090017, -0.15317241090017, -0.15317241090017, -0.15317241090017, 0.389893409563986, 0.389893409563986, 0.389893409563986, 0.389893409563986, 0.389893409563986, 0.389893409563986, 0.389893409563986, -0.153172410899934, -0.153172410899934, -0.153172410899934, -0.153172410899934, -0.153172410899934, -0.153172410899934, -0.153172410899934, -0.273853704336934, -0.273853704336934, -0.273853704336934, -0.273853704336934, -0.273853704336934, -0.273853704336934, -0.273853704336934, 0.450234056282481, 0.450234056282481, 0.450234056282481, 0.450234056282481, 0.450234056282481, 0.450234056282481, 0.450234056282481, -0.323223324378928, -0.323223324378928, -0.323223324378928, -0.323223324378928, -0.323223324378928, -0.323223324378928, -0.323223324378928, 0.132074282677017, 0.132074282677017, 0.132074282677017, 0.132074282677017, 0.132074282677017, 0.132074282677017, 0.132074282677017, -0.0299593420768935, -0.0299593420768935, -0.0299593420768935, -0.0299593420768935, -0.0299593420768935, -0.0299593420768935, -0.0299593420768935, 0.00295373795124293, 0.00295373795124293, 0.00295373795124293, 0.00295373795124293, 0.00295373795124293, 0.00295373795124293, 0.00295373795124293), Z13 = c(-0.000820388989417742, -0.000820388989417742, -0.000820388989417742, -0.000820388989417742, -0.000820388989417742, -0.000820388989417742, -0.000820388989417742, 0.00984466787301128, 0.00984466787301128, 0.00984466787301128, 0.00984466787301128, 0.00984466787301128, 0.00984466787301128, 0.00984466787301128, -0.0533252843121323, -0.0533252843121323, -0.0533252843121323, -0.0533252843121323, -0.0533252843121323, -0.0533252843121323, -0.0533252843121323, 0.170640909798784, 0.170640909798784, 0.170640909798784, 0.170640909798784, 0.170640909798784, 0.170640909798784, 0.170640909798784, -0.351946876459913, -0.351946876459913, -0.351946876459913, -0.351946876459913, -0.351946876459913, -0.351946876459913, -0.351946876459913, 0.469262501946444, 0.469262501946444, 0.469262501946444, 0.469262501946444, 0.469262501946444, 0.469262501946444, 0.469262501946444, -0.351946876459763, -0.351946876459763, -0.351946876459763, -0.351946876459763, -0.351946876459763, -0.351946876459763, -0.351946876459763, 1.30897668096353e-14, 1.30897668096353e-14, 1.30897668096353e-14, 1.30897668096353e-14, 1.30897668096353e-14, 1.30897668096353e-14, 1.30897668096353e-14, 0.351946876459646, 0.351946876459646, 0.351946876459646, 0.351946876459646, 0.351946876459646, 0.351946876459646, 0.351946876459646, -0.469262501946203, -0.469262501946203, -0.469262501946203, -0.469262501946203, -0.469262501946203, -0.469262501946203, -0.469262501946203, 0.351946876459683, 0.351946876459683, 0.351946876459683, 0.351946876459683, 0.351946876459683, 0.351946876459683, 0.351946876459683, -0.170640909798657, -0.170640909798657, -0.170640909798657, -0.170640909798657, -0.170640909798657, -0.170640909798657, -0.170640909798657, 0.0533252843120879, 0.0533252843120879, 0.0533252843120879, 0.0533252843120879, 0.0533252843120879, 0.0533252843120879, 0.0533252843120879, -0.009844667873002, -0.009844667873002, -0.009844667873002, -0.009844667873002, -0.009844667873002, -0.009844667873002, -0.009844667873002, 0.000820388989416903, 0.000820388989416903, 0.000820388989416903, 0.000820388989416903, 0.000820388989416903, 0.000820388989416903, 0.000820388989416903), Z14 = c(0.000157883934625923, 0.000157883934625923, 0.000157883934625923, 0.000157883934625923, 0.000157883934625923, 0.000157883934625923, 0.000157883934625923, -0.00221037508476475, -0.00221037508476475, -0.00221037508476475, -0.00221037508476475, -0.00221037508476475, -0.00221037508476475, -0.00221037508476475, 0.0143674380509829, 0.0143674380509829, 0.0143674380509829, 0.0143674380509829, 0.0143674380509829, 0.0143674380509829, 0.0143674380509829, -0.0574697522039801, -0.0574697522039801, -0.0574697522039801, -0.0574697522039801, -0.0574697522039801, -0.0574697522039801, -0.0574697522039801, 0.158041818561072, 0.158041818561072, 0.158041818561072, 0.158041818561072, 0.158041818561072, 0.158041818561072, 0.158041818561072, -0.316083637122359, -0.316083637122359, -0.316083637122359, -0.316083637122359, -0.316083637122359, -0.316083637122359, -0.316083637122359, 0.474125455683776, 0.474125455683776, 0.474125455683776, 0.474125455683776, 0.474125455683776, 0.474125455683776, 0.474125455683776, -0.541857663638757, -0.541857663638757, -0.541857663638757, -0.541857663638757, -0.541857663638757, -0.541857663638757, -0.541857663638757, 0.474125455683927, 0.474125455683927, 0.474125455683927, 0.474125455683927, 0.474125455683927, 0.474125455683927, 0.474125455683927, -0.316083637122536, -0.316083637122536, -0.316083637122536, -0.316083637122536, -0.316083637122536, -0.316083637122536, -0.316083637122536, 0.158041818561182, 0.158041818561182, 0.158041818561182, 0.158041818561182, 0.158041818561182, 0.158041818561182, 0.158041818561182, -0.0574697522040225, -0.0574697522040225, -0.0574697522040225, -0.0574697522040225, -0.0574697522040225, -0.0574697522040225, -0.0574697522040225, 0.0143674380509932, 0.0143674380509932, 0.0143674380509932, 0.0143674380509932, 0.0143674380509932, 0.0143674380509932, 0.0143674380509932, -0.00221037508476627, -0.00221037508476627, -0.00221037508476627, -0.00221037508476627, -0.00221037508476627, -0.00221037508476627, -0.00221037508476627, 0.00015788393462604, 0.00015788393462604, 0.00015788393462604, 0.00015788393462604, 0.00015788393462604, 0.00015788393462604, 0.00015788393462604), WYearCen = c(-7, -7, -7, -7, -7, -7, -7, -6, -6, -6, -6, -6, -6, -6, -5, -5, -5, -5, -5, -5, -5, -4, -4, -4, -4, -4, -4, -4, -3, -3, -3, -3, -3, -3, -3, -2, -2, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7)), .Names = c("Year", "WYear", "Site", "LogY", "Y", "Z2", "Z3", "Z4", "Z5", "Z6", "Z7", "Z8", "Z9", "Z10", "Z11", "Z12", "Z13", "Z14", "WYearCen"), row.names = c(4L, 18L, 26L, 40L, 67L, 75L, 94L, 104L, 118L, 126L, 140L, 167L, 175L, 194L, 204L, 218L, 226L, 240L, 267L, 275L, 294L, 304L, 318L, 326L, 340L, 367L, 375L, 394L, 404L, 418L, 426L, 440L, 467L, 475L, 494L, 504L, 518L, 526L, 540L, 567L, 575L, 594L, 604L, 618L, 626L, 640L, 667L, 675L, 694L, 704L, 718L, 726L, 740L, 767L, 775L, 794L, 804L, 818L, 826L, 840L, 867L, 875L, 894L, 904L, 918L, 926L, 940L, 967L, 975L, 994L, 1004L, 1018L, 1026L, 1040L, 1067L, 1075L, 1094L, 1104L, 1118L, 1126L, 1140L, 1167L, 1175L, 1194L, 1204L, 1218L, 1226L, 1240L, 1267L, 1275L, 1294L, 1304L, 1318L, 1326L, 1340L, 1367L, 1375L, 1394L, 1404L, 1418L, 1426L, 1440L, 1467L, 1475L, 1494L), class = "data.frame") At 11:17 AM 5/22/2009 -0700, spencerg wrote: > The first exaample on the "lmer" help page uses a formula "Reaction > ~ Days + (Days|Subject)". Here, "Subject" is the name of a column in the > data.frame "sleepstudy", with levels "308", "309", ... . > > Does this answer your question? If no, please provide commented, > minimal, self-contained, reproducible code, as requested in the posting > guide "http://www.R-project.org/posting-guide.html". Your example is not > "self-contained, reproducible". > > Hope this helps. Spencer > > >Leigh Ann Starcevich wrote: >>Dear guRus: >> >>I am using lmer for a mixed model that includes a random intercept for a >>set of effects that have the same distribution, Normal(0, sig2b). This >>set of effects is of variable size, so I am using an as.formula statement >>to create the formula for lmer. For example, if the set of random >>effects has dimension 8, then the lmer call is: >> >>Zs<- paste("Z",1:mb,sep="") >>Trendformula <-as.formula(paste("LogY ~ WYear + (1+WYear|Site) + (1|", >>paste(paste(Zs,collapse="+"), ")"))) >>fit2.4a<-lmer(Trendformula, data = testsamp) >> >>which, for mb=8, expands to: >> >>fit1<-lmer(LogY ~ WYear + (1 | Site) + (1 | Year) + (1 | Z1+ Z2 + Z3 + Z4 >>+ Z5 + Z6 + Z7 + Z8), data = testsamp) >> >> >>I have no problems with this. However, if the set of random effects has >>a dimension of 30, then the lmer call is: >> >>fit2<-lmer(LogY ~ WYear + (1 | Site) + (1 | Year) + (1 | Z1+Z2 + Z3 + Z4 >>+ Z5 + Z6 + Z7 + Z8 + Z9 + Z10 + Z11 + Z12 + Z13 + Z14 + Z15 + Z16 + Z17 >>+ Z18 + Z19 + Z20 + Z21 + Z22 + Z23 + Z24 + Z25 + Z26 + Z27 + Z28 + Z29+ >>Z30), data = testsamp) >> >>In this case, I get an error because the name "Z1+Z2 + Z3 + Z4 + Z5 + Z6 >>+ Z7 + Z8 + Z9 + Z10 + Z11 + Z12 + Z13 + Z14 + Z15 + Z16 + Z17 + Z18 + >>Z19 + Z20 + Z21 + Z22 + Z23 + Z24 + Z25 + Z26 + Z27 + Z28 + Z29+ Z30" is >>too long to print in the output. Is there any way to name the random >>effect in lmer so that the shorter (and more descriptive) name may be >>used and the error avoided? Or is there a way to combine these into a >>single variable prior to the lmer function call? In SAS, I am able to >>parameterize these as a Toeplitz structure with bandwidth 1. >> >>Thanks for any help. >> >>Leigh Ann Starcevich >>Doctoral student >>Oregon State University >>Corvallis, Oregon >> [[alternative HTML version deleted]] >> >>______________________________________________ >>R-help@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. >> >> > [[alternative HTML version deleted]]
______________________________________________ R-help@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.