Hi R-helpers I have a dataframe DF (lets say with the variables, y, x1, x2, x3, ..., clust) containing relatively many NAs. When I fit an ordinal regression model with the function lrm from the Design library: model.lrm <- lrm(y ~ x1 + x2, data=DF, x=TRUE, y=TRUE) it will by default delete missing values in the variables y, x1, x2. Based on model.lrm, I want to apply the robust covariance estimator using a cluster variable: model.robcov.lrm <- robcov(model.lrm, cluster=clust) How can I remove observations in the cluster variable clust that contain NAs in y, x1, and x2? Thanks, Christof
I was pointed by Andy Liaw to use rownames(model.lrm$x) as index to clus. Thanks! Christof> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Christof Bigler > Sent: Monday, March 22, 2004 5:11 PM > To: R-help > Subject: [R] Handling of NAs in functions lrm and robcov > > > Hi R-helpers > > I have a dataframe DF (lets say with the variables, y, x1, > x2, x3, ..., > clust) containing relatively many NAs. > When I fit an ordinal regression model with the function lrm from the > Design library: > model.lrm <- lrm(y ~ x1 + x2, data=DF, x=TRUE, y=TRUE) > it will by default delete missing values in the variables y, x1, x2. > Based on model.lrm, I want to apply the robust covariance estimator > using a cluster variable: > model.robcov.lrm <- robcov(model.lrm, cluster=clust) > How can I remove observations in the cluster variable clust that > contain NAs in y, x1, and x2?
On Mon, 22 Mar 2004 15:10:59 -0700 Christof Bigler <christof.bigler at colorado.edu> wrote:> Hi R-helpersBest term for that?> > I have a dataframe DF (lets say with the variables, y, x1, x2, x3, ..., > clust) containing relatively many NAs. > When I fit an ordinal regression model with the function lrm from the > Design library: > model.lrm <- lrm(y ~ x1 + x2, data=DF, x=TRUE, y=TRUE) > it will by default delete missing values in the variables y, x1, x2. > Based on model.lrm, I want to apply the robust covariance estimator > using a cluster variable: > model.robcov.lrm <- robcov(model.lrm, cluster=clust) > How can I remove observations in the cluster variable clust that > contain NAs in y, x1, and x2?robcov is supposed to do that. If you have an example otherwise, kindly reproduce it with the most trivial dataset you can simulate, and send the code and I'll debug. -Frank --- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University