[R] problem with effects : 'subscript out of bounds'
Nicole Marie Ford
nmford at uwm.edu
Sat Mar 10 06:58:36 CET 2012
hello. help with effects plots. here's the last bit of code before running the model and then the effects, then the error.
nor.dem <- norway$v162 ## nor.dem is my DV & it is continuous.
nor.dem <- as.numeric(nor.dem)-5
(i had to do a great deal of coding here so i am snipping down to the end)
tmp[which(norway$v128 == "trust completely" & norway$v127 == "trust completely")] <- "generalized"
tmp <- factor(tmp, levels=c("particular", "generalized", "other"))
norway$trust <- tmp
nor.trust <- as.factor(norway$trust) #### nor.trust is my IV, a factor as you can see.
n.diversity <- norway$v221 ## control
n.net <- norway$v228 ##control (there are others but they were coded the same)
n.mod1 <- lm(nor.dem ~ nor.trust + n.diversity + n.age + n.sex + n.educ + famecon + n.net) ### 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.
> plot(effect("nor.trust", 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.
More information about the R-help