>>>>> David Winsemius <dwinsem...@comcast.net> >>>>> on Thu, 3 Sep 2009 22:34:05 -0400 writes:
> I'm having difficulties with plot.locfit.3d, at least I think that is > the problem. I have a large dataframe (about 4 MM cases) and was > hoping to see a non-parametric estimate of the hazard plotted against > two variables: >> fit <- locfit(~surv.yr+ ur_protein + ur_creatinine, data=TRdta, > cens = 1-death, family = "hazard", xlim=c(0,10)) > # it took somewhere between 1 and 2 hours to complete, but it did > complete and reported no errors or warnings. >> plot(fit, pv=c("ur_protein", "ur_creatinine")) > Error in if (from == to) rep.int(from, length.out) else > as.vector(c(from, : > missing value where TRUE/FALSE needed well, either 'from' or 'to' will be NaN or NA .. [probably because some part of the locfit code was not written with so many observations in mind .. ] Why don't you repeat the plot() call *after* saying options(error=recover) and then inspect 'from' and 'to' ? maybe also debug(plot.locfit.3d) plot(.........) and evaluate stepwisely, using ls.str() to quickly get a picture of the function's local variables? >> plot(fit, type="persp") > Error in if (from == to) rep.int(from, length.out) else > as.vector(c(from, : > missing value where TRUE/FALSE needed >> plot(fit, pv=c("ur_protein", "ur_creatinine"), type="persp", > xlim=c(0,400), ylim=c(0,400)) > Error in if (from == to) rep.int(from, length.out) else > as.vector(c(from, : > missing value where TRUE/FALSE needed > I am guessing this may be a missing parameter needed by persp() but I > cannot figure out what to offer. well, it should give a better error message, if it really needs another argument . A reproducible example *would* be very useful here, indeed, I see you tried .. but still. Hoping the above helps, Martin Maechler, ETH Zurich > My efforts to construct a minimal example are also hitting a dead end: > # From first of Harrell's cph() examples >> n <- 1000 >> set.seed(731) >> age <- 50 + 12*rnorm(n) >> label(age) <- "Age" >> sex <- factor(sample(c('Male','Female'), n, > + rep=TRUE, prob=c(.6, .4))) >> cens <- 15*runif(n) >> h <- .02*exp(.04*(age-50)+.8*(sex=='Female')) >> dt <- -log(runif(n))/h >> label(dt) <- 'Follow-up Time' >> e <- ifelse(dt <= cens,1,0) >> dt <- pmin(dt, cens) >> cfit <- locfit( ~ dt + age + sex, cens=cens, family = "hazard", > xlim=c(0, max(dt)) ) > Error in lfproc(x, y, weights = weights, cens = e, base = base, geth = > geth, : > NA/NaN/Inf in foreign function call (arg 1) > In addition: Warning message: > In lfproc(x, y, weights = weights, cens = cens, base = base, geth = > geth, : > NAs introduced by coercion > Running the example on the locfit help page works fine, .... just > like Loader's book, which I have been trying to follow in chapter 7. > David Winsemius, MD > Heritage Laboratories > West Hartford, CT > ______________________________________________ > 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. ______________________________________________ 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.