Could you then at least give the summary of the lm? It's really impossible to tell where your problem is without any information about the fit. It's a strange error, I never had it in this context, and this kind of errors often indicate that what goes in is wrong. Your lm() object is not well formed, so the problem should come from the fit itself. And as I can't see any obvious errors in your model formula, it has to be a problem with your data. Did you get no warning at all when fitting the model?
Cheers Joris On Fri, Jun 18, 2010 at 10:19 AM, Jonas Mandel <jonas.man...@curie.fr> wrote: > Hello, > > Sorry for the lack of clarity, I thought I was clear about the package : > it's the function allEffects from the package effects. > > Here is my example again (unfortunately I can't give the data) : > The data concerns effects of 3 treatments on the tumoral volume of mice. > >> head(data) > Id Série Traitement vTum temps Volume > 55656.1 55656 7 3 1 1 14.03 > 55805.1 55805 7 3 3 1 59.92 > 55829.1 55829 7 3 1 1 15.31 > 55806.1 55806 7 3 2 1 28.01 > 50725.1 50725 7 3 2 1 34.48 > 55737.1 55737 7 3 2 1 43.56 > > vTum is a factor coding for the qualitative initial volume, from small > to big, temps is the time (integer) in month since beginning of > treatment, and Série is a factor coding for the batch. Data is unbalanced. > > I fit a linear model as follows: >> lm1=lm(Volume ~ temps + Traitement:temps + Série , data) > > And then I try to use allEffects to compute (and then plot) the effects > of the interaction: >> eff.lm1 <- allEffects(mod=lm1, xlevels=list(temps=c(1:3), Traitement=1:3)) > > And here is the error I get: > Error in apply(mod.matrix[, components], 1, prod) : index out of range > > In the example given in the help page there are factor variables and > numeric variables so I don't think the problem comes from here. Any help > is welcome here. > > Cheers, > Jonas > > > Joris Meys a écrit : >> Please, read the posting guide: >> - provide a minimal example >> - tell us from which package the function is coming >> >> I guess you used the function allEffects() from the package effects, and did >> : >> eff.lm1 <- allEffect(lm1) >> >> Then I guess that there's something wrong with the variables you put >> into the model. Sure they're factor variables and not numeric? >> >> Cheers >> Joris >> >> >> >> On Thu, Jun 17, 2010 at 6:03 PM, Jonas Mandel <jonas.man...@curie.fr> wrote: >>> Dear R users, >>> >>> I have some trouble using the allEffects() function to compute and >>> display effect plots for a linear model. >>> My data is quite simple, it concerns effects of 3 treatments on the >>> tumoral volume of mice. vTum codes for the qualitative initial volume, >>> from small to big, temps is the time in month since beginning of >>> treatment, and Série codes for the batch. Data is unbalanced. >>> >>>> head(data) >>> Id Série Traitement vTum temps Volume >>> 55656.1 55656 7 3 1 1 14.03 >>> 55805.1 55805 7 3 3 1 59.92 >>> 55829.1 55829 7 3 1 1 15.31 >>> 55806.1 55806 7 3 2 1 28.01 >>> 50725.1 50725 7 3 2 1 34.48 >>> 55737.1 55737 7 3 2 1 43.56 >>> >>> >>> The linear model is also quite simple : >>>> lm1=lm(Volume ~ temps + Traitement:temps + Série , data) >>> But when I try to use allEffects() I get this error: >>>> eff.lm1 <- allEffect(mod=lm1, >>> Error in apply(mod.matrix[, components], 1, prod) : index out of range >>> >>> I read the help and the example but I don't understand the reason why it >>> doesn't work. Can you help me ? >>> Thanks >>> >>> >>> -- >>> Jonas Mandel >>> >>> ______________________________________________ >>> 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. >>> >> >> >> > -- Joris Meys Statistical consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control tel : +32 9 264 59 87 joris.m...@ugent.be ------------------------------- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php ______________________________________________ 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.