[R] problem with effects : 'subscript out of bounds'

Nicole Marie Ford nmford at uwm.edu
Sat Mar 10 07:20:15 CET 2012


if that is  not specific (or not general) enough:

newDV <- dat$DV  ## newDV is my DV & it is continuous.
newDV <- as.numeric(newDV)-5
str(newDV)


(i had to do a great deal of coding here so i am snipping down to the end)


tmp[which(dat$v1 == "stuff" & dat$v2 == "more stuff")] <- "lots of stuff"
tmp <- factor(tmp, levels=c("la", "la la", "fa la la"))
dat$v3 <- tmp
newIV <- as.factor(dat$v3)  ####  newIV is my IV, a factor as you can see.

n.var4 <- dat$v4 ## control

n.var5 <- dat$v5  ##control  (there are others but they were coded the same)


n.mod1 <- lm(newDV ~ newIV + v4 + v5 + v6 + v7 + v8 + v9, data=dat)  ### linear model.  all of these variables already are specific to the dataset which i called 'norway' so there is no need to specify in the model.

summary(n.mod1)

> plot(effect("newIV", n.mod1), multiline=T)
Error in plot(effect("nor.trust", n.mod1), multiline = T) : 
  error in evaluating the argument 'x' in selecting a method for function 'plot': Error in apply(mod.matrix[, components], 1, prod) : 
  subscript out of bounds



~~this ran perfectly on my previous dataset so i am unsure of the issue.  thanks in advance.

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list