# requires "care" R package version 1.1.1 library("care") # diabetes data data(efron2004) x = efron2004$x y = efron2004$y xnames = colnames(x) ##### # ordering suggested by CAR scores car = carscore(x, y, lambda=0) ocar = order(car^2, decreasing=TRUE) xnames[ocar] # plot regression coefficients for all possible CAR models p = ncol(x) car.predlist = make.predlist(ocar, numpred = 1:p, name="CAR") cm = slm.models(x, y, car.predlist, lambda=0, lambda.var=0) bmat= cm$coefficients[,-1] bmat plot(1:p, bmat[,1], type="l", ylab="estimated regression coefficients", xlab="number of included predictors", main="CAR Regression Models for Diabetes Data", xlim=c(1,p+1), ylim=c(min(bmat), max(bmat))) for (i in 2:p) lines(1:p, bmat[,i], col=i, lty=i) for (i in 1:p) points(1:p, bmat[,i], col=i) for (i in 1:p) text(p+0.5, bmat[p,i], xnames[i])