Re: [R] exclusion rules for propensity score matchng (pattern rec)
hi, thanks for the reply to my query about exclusion rules for propensity score matching. Exclusion can be based on the non-overlap regions from the propensity. It should not be done in the individual covariate space. i want a rule inspired by non-overlap in propensity score space, but that binds in the space of the Xs. because i don't really know how to interpret the fact that i've excluded, say, people with scores .87, but i DO know what it means to say that i've excluded people from country XYZ over age Q because i can't find good matches for them. if i make my rule based on Xs, i know who i can and cannot make inference for, and i can explain to other people who are the units that i can and cannot make inference for. after posting to the list last night, i thought of using the RGENOUD package (genetic algorithm) to search over the space of exclusion rules (eg., var 1 = 1, var 2 = 0 var 3 = 1 or 0, var 4 = 0); the loss function associated with a rule should be increasing in # of tr units w/out support excluded and decreasing in # of tr units w/ support excluded. it might be tricky to get the right loss function, and i know this idea is kind of nutty, but it's the only automated search method i could think of. any comments? alexis I tend to look at the 10th smallest and largest values of propensity for each of the two treatment groups for making the decision. You will need to exclude non-overlap regions whether you use matching or covariate adjustment of propensity but covariate adjustment (using e.g. regression splines in the logit of propensity) is often a better approach once you've been careful about non-overlap. Frank Harrell On Tue, 5 Apr 2005, Frank E Harrell Jr wrote: [EMAIL PROTECTED] wrote: Dear R-list, i have 6 different sets of samples. Each sample has about 5000 observations, with each observation comprised of 150 baseline covariates (X), 125 of which are dichotomous. Roughly 20% of the observations in each sample are treatment and the rest are control units. i am doing propensity score matching, i have already estimated propensity scores(predicted probabilities) using logistic regression, and in each sample i am going to have to exclude approximately 100 treated observations for which I cannot find matching control observations (because the scores for these treated units are outside the support of the scores for control units). in each sample, i must identify an exclusion rule that is interpretable on the scale of the X's that excludes these unmatchable treated observations and excludes as FEW of the remaining treated observations as possible. (the reason is that i want to be able to explain, in terms of the Xs, who the individuals are that I making causal inference about.) i've tried some simple stuff over the past few days and nothing's worked. is there an R-package or algorithm, or even estimation strategy that anyone could recommend? (i am really hoping so!) thank you, alexis diamond -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] how to suppress whiskers in a bwplot?
dear R-help, i have looked carefully through the R-help archives for information on how to suppress whiskers in a bwplot. someone asked this question a while ago, but the answer he received is not available in the archives. but i did manage to get my hands on a panel function (called my.panel) that is supposed to do this (the function is reproduced at the end of the email, below). the problem is that i get an error message when i use it in the following way: data(singer) bwplot(voice.part ~ height, data=singer, xlab=Height (inches), panel = my.panel) ### the error message is: Error in segments(x1 = structure(c(NA, NA, NA, NA), .Names = c(, , : Argument x0 is missing, with no default ### i don't know if the problem is this panel function, or how I am (mis)using it. (i've never used a homegrown lattice panel function before.) i realize that there is an excellent function in Hmisc that generates cool bwplots sans whiskers, but those plots are too fancy for my current needs. all i need are regular boxy bwplots without whiskers (or umbrellas, as i guess they're also called). as a quick fix, i've also tried changing the color of the whiskers to the background color to make the whiskers invisible, but this doesn't work well when the whiskers perfectly align with the border of the box. thank you for your help, alexis diamond [EMAIL PROTECTED] ### my.panel, the function that I've been told can suppress whiskers, ### when outline = F my.panel - function(x, y, box.ratio = 1, font = box.dot$font, pch = box.dot$pch, cex = box.dot$cex, col = box.dot$col, outline = T, ...) { ok - !is.na(x) !is.na(y) x - x[ok] y - y[ok] y.unique - sort(unique(y)) width - box.ratio/(1 + box.ratio) w - width/2 e - par(cxy)[1] for(Y in y.unique) { X - x[y == Y] q - quantile(X, c(0.75, 0.5, 0.25)) iqr - q[1] - q[3] d - q[c(1, 3)] + c(1, -1) * 1.5 * iqr up.w - max(X[X = d[1]], q[1]) lo.w - min(X[X = d[2]], q[3]) outliers - X[X lo.w | X up.w] X - c(up.w, q, lo.w) median.value - list(x = X[3], y = Y) Box - list(x1 = X[c(2, 4, 4, 2)], y1 = Y + c( - w, - w, w, w), x2 = X[c(4, 4, 2, 2)], y2 = Y + c( - w, w, w, - w)) e - par(cxy)[1] e.l - min(e, (X[4] - X[5])/2) # prevent lower staple ends from touching box e.u - min(e, (X[1] - X[2])/2) # prevent upper staple ends from touching box staple.ends - list(x1 = rep(c(X[5], max(X[1] - e.u, X[2])), 2), y1 = c(rep(Y - w, 2), rep(Y + w, 2)), x2 = rep(c(min(X[5] + e.l, X[4]), X[1]), 2), y2 = c(rep(Y - w, 2), rep(Y + w, 2))) staple.body - list(x1 = X[c(1, 5)], y1 = rep(Y - w, 2), x2 = X[c(1, 5)], y2 = rep(Y + w, 2)) dotted.line - list(x1 = X[c(1, 4)], y1 = c(Y, Y), x2 = X[c(2, 5)], y2 = c(Y, Y)) box.umbrella - trellis.par.get(box.umbrella) box.dot - trellis.par.get(box.dot) box.dot.par - c(list(pch = pch, cex = cex, col = col, font = font), ...) do.call(segments, c(staple.ends, box.umbrella)) do.call(segments, c(staple.body, box.umbrella)) do.call(segments, c(dotted.line, box.umbrella)) do.call(segments, c(Box, trellis.par.get( box.rectangle))) do.call(points, c(median.value, box.dot.par)) if(outline length(outliers) 0) { outliers - list(x = outliers, y = rep(Y, length(outliers))) do.call(points, c(outliers, trellis.par.get( plot.symbol), cex = cex)) } } } __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] wireframe: how to remove the frame around my plot?
Hi, I've got a wireframe 3D surface plot, but I don't want a frame around it. Is there any way to remove the frame, or (worst case) change the color of the frame to the background color (which looks like grey). I'm using ver 1.7.1 I've tried frame.plot = F, but that doesn't seem to work for 'wireframe'. Many thanks, Alexis Diamond __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] wireframe: how to remove the frame around my plot?
hi jerome, thank you for your quick reply. your advice removes the 3D box in which the 3D plot is generated, but i like THAT box. (sorry for being unclear earlier) what i want to do is remove the 2D frame (a box of thin black lines) that circumscribes all of my plot area. any ideas? thanks again, alexis On Thu, 24 Jul 2003, Jerome Asselin wrote: You can specify some options in par.box. Use col=NA to make the frame transparent. See example below (which was modified from the help file). See also the scales parameter if you want to remove the arrows as well. Cheers, Jerome library(lattice) x - seq(-pi, pi, len = 20) y - seq(-pi, pi, len = 20) g - expand.grid(x = x, y = y) g$z - sin(sqrt(g$x^2 + g$y^2)) wireframe(z ~ x * y, g, drape = TRUE, perspective = FALSE, aspect = c(3,1), colorkey = FALSE, par.box = list(col=NA)) On July 24, 2003 12:44 pm, Alexis J. Diamond wrote: Hi, I've got a wireframe 3D surface plot, but I don't want a frame around it. Is there any way to remove the frame, or (worst case) change the color of the frame to the background color (which looks like grey). I'm using ver 1.7.1 I've tried frame.plot = F, but that doesn't seem to work for 'wireframe'. Many thanks, Alexis Diamond __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] wireframe: how to remove the frame around my plot?
hi jake, thanks for your e-mail. what i am actually trying to do is remove the 'picture frame' 2D box (the super-frame) that circumscribes the entire figure-- for example, the left vertical side of this box i'm concerned about is to the left of the 'z' axis label. i hope i'm finally making my query clear. both of your examples below retain this pictureframe box (jerome's examples do too), when the output is viewed as a .eps file in ghostcript viewer, so i am still stuck, unfortunately. there's got to be a parameter that modifies this picureframe box's color and style, right? thanks again, alexis On Thu, 24 Jul 2003, Jake Bowers wrote: Hi Y'all, Alexis, I think Jerome's example works except for one change: This one has a box but no wires: wireframe(z ~ x * y, g, drape = TRUE, perspective = FALSE, aspect = c(3,1), colorkey = FALSE, par.box = list(col=1),col=NA) versus with no box and no wires: wireframe(z ~ x * y, g, drape = TRUE, perspective = FALSE, aspect = c(3,1), colorkey = FALSE, par.box = list(col=NA),col=NA) Hope this helps! Jake - Jake Bowers Dept of Political Science University of Michigan On Thu, 24 Jul 2003, Alexis J. Diamond wrote: hi jerome, thank you for your quick reply. your advice removes the 3D box in which the 3D plot is generated, but i like THAT box. (sorry for being unclear earlier) what i want to do is remove the 2D frame (a box of thin black lines) that circumscribes all of my plot area. any ideas? thanks again, alexis On Thu, 24 Jul 2003, Jerome Asselin wrote: You can specify some options in par.box. Use col=NA to make the frame transparent. See example below (which was modified from the help file). See also the scales parameter if you want to remove the arrows as well. Cheers, Jerome library(lattice) x - seq(-pi, pi, len = 20) y - seq(-pi, pi, len = 20) g - expand.grid(x = x, y = y) g$z - sin(sqrt(g$x^2 + g$y^2)) wireframe(z ~ x * y, g, drape = TRUE, perspective = FALSE, aspect = c(3,1), colorkey = FALSE, par.box = list(col=NA)) On July 24, 2003 12:44 pm, Alexis J. Diamond wrote: Hi, I've got a wireframe 3D surface plot, but I don't want a frame around it. Is there any way to remove the frame, or (worst case) change the color of the frame to the background color (which looks like grey). I'm using ver 1.7.1 I've tried frame.plot = F, but that doesn't seem to work for 'wireframe'. Many thanks, Alexis Diamond __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] contourplot: how to ensure all (or certain) 'cuts' get labelled
hi all, contourplot generates a nice plot, but there are cut lines that don't have labels in my figure. i think this is because there's a high ridge stretching north-west/south-east entirely across the plot, diagonal-to-diagonal, and contourplot only wants to label each elevation-level only once, which means only lines in the upper-right quadrant got labelled. is there some way to *identify* and label a cutpoint that has no label, or to force contourplot to label each (or a particular) cutpoint? if i knew what the label should be on a given label-less cutpoint, i could probably insert it in as text myself. but i don't even know what it should be. by the way, does anyone know why i got only 5 cuts, when i specified cuts = 10? thanks, alexis ps-- i am open to using *contour* instead of *contourplot* if this gives me more control over the output. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help