John Smith wrote: > Dear All: > > I tried to replicate a case study described by Prof. Harrell in Chapter 7 of > his Regression Modeling Strategies book, but failed on using anova.Design to > reproduce his table 7.1, Following is the code: > > rm(list=ls()) > library(Hmisc) > library(Design) > > getHdata(counties) > counties$older <- counties$age6574 + counties$age75 > label(counties$older) <- '% age >= 65, 1990' > counties$pdensity <- log10(counties$pop.density+1) > label(counties$pdensity) <- 'log 10 of 1992 pop per 1990 miles^2' > > dd <- datadist(counties) > options(datadist='dd') > > f <- ols(democrat ~ rcs(pdensity,4) + rcs(pop.change,3) + rcs(older,3) + > crime + rcs(college,5) > + rcs(income,4) + rcs(college,5) %ia% rcs(income,4) + rcs(farm,3) + > rcs(white,5) + > rcs(turnout,3), data=counties) > f > > an <- anova(f) > > > and the error message reads as: > > Error in solvet(cov[idx, idx], coef[idx], tol = tol) : > apparently singular matrix > > Does anyone have a clue?
add the tol argument to the anova call, e.g. tol=1e-13 Frank -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University ______________________________________________ R-help@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.