[R] design package (plot problems)

chr.schulz@email.de chr.schulz at email.de
Fri Sep 13 20:24:52 CEST 2002


Hi,
just making some experiments with
design library i get an error if 
i want plot(fit) - show below from 
onlineHelp !?

..perhaps is here another mask problem?, but
label from xtable which was my first problem
is now off !


Thanks for advance & regards,
Christian



$ n <- 1000    # define sample size
$ set.seed(17) # so can reproduce the results
$ age            <- rnorm(n, 50, 10)
$ blood.pressure <- rnorm(n, 120, 15)
$ cholesterol    <- rnorm(n, 200, 25)
$ sex            <- factor(sample(c('female','male'), n, T))
$ label(age)            <- 'Age' 
$ label(cholesterol)    <- 'Total Cholesterol'
$ label(blood.pressure) <- 'Systolic Blood Pressure'
$ label(sex)            <- 'Sex'
$ units(cholesterol)    <- 'mg/dl'   # uses units.default in Hmisc
$ units(blood.pressure) <- 'mmHg'
$ 
$ # Specify population model for log odds that Y=1
$ L <- .4*(sex=='male') + .045*(age-50) +
+         (log(cholesterol - 10)-5.2)*(-2*(sex=='female') + 2*(sex=='male'))
$ # Simulate binary y to have Prob(y=1) = 1/[1+exp(-L)]
$ y <- ifelse(runif(n) < plogis(L), 1, 0)
$ 
$ ddist <- datadist(age, blood.pressure, cholesterol, sex)
$ options(datadist='ddist')
$ 
$ fit <- lrm(y ~ blood.pressure + sex * (age + rcs(cholesterol,4)),x=T, y=T)
$ 
$ par(mfrow=c(2,2))
$ plot(fit)                # Plot effects of all 4 predictors
Error in "oldClass<-"(*tmp*, value = "keep") : 
        attempt to set an attribute on NULL
$ par(mfrow=c(1,2))
$ plot(fit, name=c('age','cholesterol'))   # Make 2 plots
Error in "oldClass<-"(*tmp*, value = "keep") : 
        attempt to set an attribute on NULL
$ par(mfrow=c(1,1))
$ plot(fit, age=seq(20,80,length=100), sex=NA, conf.int=F)
Error in "oldClass<-"(*tmp*, value = "keep") : 
        attempt to set an attribute on NULL



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list