Error in eval (expr, envir, enc): object not found using xYplot

I use the Frank Harrell rms package in R to fit the linear model. When I try to construct the residuals after the ols , I get a message that the object was not found, despite the fact that it successfully included the corresponding object / variable in the match.

 str(school.uni) 'data.frame': 18262 obs. of 6 variables: $ student : int 206 565 292 602 1391 1230 1292 1111 789 1426 ... $ entry : Factor w/ 2 levels "direct","indirect": 1 1 1 1 1 1 1 1 1 1 ... $ band : Factor w/ 12 levels "Band45","Band50",..: 1 1 1 1 1 1 1 1 1 1 ... $ school : num 5.35 10.8 11.95 12.6 14.3 ... $ uni : num 42 32.5 19.5 76.1 29.4 ... $ school70 : num -64.7 -59.2 -58 -57.4 -55.7 . ddist <<- datadist(school.uni) options( datadist = 'ddist') fit.ols.all.school.entry <<- ols(uni ~ school70 * entry, x=TRUE, y=TRUE, data=school.uni) r <- resid( fit.ols.all.school.entry) xYplot(r ~ fitted(fit.ols.all.school.entry)) 

The previous xYplot command creates the expected schedule, but when I try to build the balances on a group of records, I get an error

 xYplot(r ~ fitted(fit.ols.all.school.entry), groups=entry) 

Error in eval (expr, envir, enc): object 'entry' not found

I would appreciate help finding a problem.

0
source share
1 answer

You should try the following:

 xYplot(r ~ fitted(fit.ols.all.school.entry), groups=school.uni$entry) 

or you can use attach (school.uni) after downloading the data.

+1
source

All Articles