Hello, I have a bar plot where I am already using colour to distinguish one set of samples from another. I would also like to highlight a few of these bars as ones that should be looked at in detail. I was thinking of using hatching, but I can't work out how or if you can have a background colour and hatching which is different between bars. Any suggestions on how I should do this? Thanks Dan -- ************************************************************** Daniel Brewer, Ph.D. Institute of Cancer Research Molecular Carcinogenesis Email: daniel.brewer at icr.ac.uk ************************************************************** The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company Limited by Guarantee, Registered in England under Company No. 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP. This e-mail message is confidential and for use by the a...{{dropped:2}}
Hello Daniel, something like that might work: x <- runif(6) marker1 <- rep(c("red", "blue"), 3) marker2 <- c(rep(0,5), 10) barplot(x, col = marker1) barplot(x, density = marker2, add=T) But I'd be interested if you learn about other solutions... -Heinrich.> -----Urspr?ngliche Nachricht----- > Von: r-help-bounces at r-project.org > [mailto:r-help-bounces at r-project.org] Im Auftrag von Daniel Brewer > Gesendet: Donnerstag, 09. September 2010 16:03 > An: r-help at stat.math.ethz.ch > Betreff: [R] Highlighting a few bars in a barplot > > > Hello, > > I have a bar plot where I am already using colour to > distinguish one set > of samples from another. I would also like to highlight a > few of these > bars as ones that should be looked at in detail. I was thinking of > using hatching, but I can't work out how or if you can have a > background > colour and hatching which is different between bars. Any > suggestions on > how I should do this? > > Thanks > > Dan > > -- > ************************************************************** > Daniel Brewer, Ph.D. > > Institute of Cancer Research > Molecular Carcinogenesis > Email: daniel.brewer at icr.ac.uk > ************************************************************** > > The Institute of Cancer Research: Royal Cancer Hospital, a > charitable Company Limited by Guarantee, Registered in > England under Company No. 534147 with its Registered Office > at 123 Old Brompton Road, London SW7 3RP. > > This e-mail message is confidential and for use by the > a...{{dropped:2}} > > ______________________________________________ > R-help at 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. >
windows Vista R 2.10.1 (1) How can I get the complete table of for the fixed effects from lmer. As can be seen from the example below, fixef(fit2) only give the estimates and not the SE or t value> fit3<- lmer(y~time + (1|Subject) + (time|Subject),data=data.frame(data)) > summary(fit3)Linear mixed model fit by REML Formula: y ~ time + (1 | Subject) + (time | Subject) Data: data.frame(data) AIC BIC logLik deviance REMLdev -126.2 -116.4 70.1 -152.5 -140.2 Random effects: Groups Name Variance Std.Dev. Corr Subject (Intercept) 2.9311e+01 5.41396385 Subject (Intercept) 0.0000e+00 0.00000000 time 0.0000e+00 0.00000000 NaN Residual 8.1591e-07 0.00090328 Number of obs: 30, groups: Subject, 10 Fixed effects: Estimate Std. Error t value (Intercept) 14.998216 1.712046 9 time -0.999779 0.000202 -4950 Correlation of Fixed Effects: (Intr) time -0.001> fixef(fit3)(Intercept) time 14.9982158 -0.9997793 (2) lmer does not give p values or confidence intervals for the fixed effects. How we are to interpret the estimates given that no p value or CI is given for the estimates? John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing) Confidentiality Statement: This email message, including any attachments, is for th...{{dropped:6}}
Try coef(summary(fit3)) On Thu, Sep 9, 2010 at 11:00 PM, John Sorkin <jsorkin at grecc.umaryland.edu> wrote:> windows Vista > R 2.10.1 > > > (1) How can I get the complete table of for the fixed effects from lmer. As can be seen from the example below, fixef(fit2) only give the estimates and not the SE or t value > >> fit3<- lmer(y~time + (1|Subject) + (time|Subject),data=data.frame(data)) >> summary(fit3) > Linear mixed model fit by REML > Formula: y ~ time + (1 | Subject) + (time | Subject) > ? Data: data.frame(data) > ? ?AIC ? ?BIC logLik deviance REMLdev > ?-126.2 -116.4 ? 70.1 ? -152.5 ?-140.2 > Random effects: > ?Groups ? Name ? ? ? ?Variance ? Std.Dev. ? Corr > ?Subject ?(Intercept) 2.9311e+01 5.41396385 > ?Subject ?(Intercept) 0.0000e+00 0.00000000 > ? ? ? ? ?time ? ? ? ?0.0000e+00 0.00000000 ? NaN > ?Residual ? ? ? ? ? ? 8.1591e-07 0.00090328 > Number of obs: 30, groups: Subject, 10 > > Fixed effects: > ? ? ? ? ? ? Estimate Std. Error t value > (Intercept) 14.998216 ? 1.712046 ? ? ? 9 > time ? ? ? ?-0.999779 ? 0.000202 ? -4950 > > Correlation of Fixed Effects: > ? ? (Intr) > time -0.001 >> fixef(fit3) > (Intercept) ? ? ? ?time > ?14.9982158 ?-0.9997793 > > (2) lmer does not give p values or confidence intervals for the fixed effects. How we are to interpret the estimates given that no p value or CI is given for the estimates? > > > > > John David Sorkin M.D., Ph.D. > Chief, Biostatistics and Informatics > University of Maryland School of Medicine Division of Gerontology > Baltimore VA Medical Center > 10 North Greene Street > GRECC (BT/18/GR) > Baltimore, MD 21201-1524 > (Phone) 410-605-7119 > (Fax) 410-605-7913 (Please call phone number above prior to faxing) > > Confidentiality Statement: > This email message, including any attachments, is for th...{{dropped:6}} > > ______________________________________________ > R-help at 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. >
Bert, I appreciate you comments, and I have read Doug Bates writing about p values in mixed effects regression. It is precisely because I read Doug's material that I asked "how are we to interpret the estimates" rather than "how can we compute a p value". My question is a simple question whose answer is undoubtedly complex, but one that needs an answer. Without p values, or confidence intervals, I am not certain what to make of the results of my analysis. Does my analysis suggest, or does it not suggest that there is a relation between time and y? If I can't answer this question after running the analysis, I don't have any more information than I did before I ran the analysis, and a fair question would be why did I run the analysis? I am asking for help not in calculation a p value or a CI, but rather to know what I can and can't say about the results of the analysis. If this basic question can not be answered, I am at a loss to interpret my results. Thank you, John John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing)>>> Bert Gunter <gunter.berton at gene.com> 9/9/2010 11:21 PM >>> John: Search on this issue in the list archives. Doug Bates has addressed it at length. Basically, he does not calculate CI's or p-values because he does not know how to reliably do so. However, the key remark in your query was:> (2) lmer does not give p values or confidence intervals for the fixed effects. How we are to interpret the estimates given that no p value or CI is given for the estimates?Think about it. A statistical analysis -- ANY statistical analysis -- treats the data in isolation: it is not informed by physics, thermodynamics, biology, other similar data, prior experience, or, indeed, any part of the body of relevant scientific knowledge. Do you really think that any such analysis, especially when predicated upon often tenuous or even (necessarily) unverifiable assumptions and simplifications should be considered authoritative? Classical statistical inference is just another piece of the puzzle, and not even particularly useful when, as if typically the case, hypotheses are formulated AFTER seeing the data (this invalidates the probability calculations -- hypotheses must be formulated before seeing the data to be meaningfully assessed). Leo Breiman called this statistics' "quiet scandal" something like 20 years ago, and he was no dummy. It is comforting, perhaps, but illusory to believe that statistical inference can be relied on to give sound, objective scientific results. True, without such a framework, science seems rather subjective, perhaps closer to religion and arbitrary cultural archetypes than we care to admit. But see Thomas Kuhn and Paul Feuerabend for why this is neither surprising nor necessarily a bad thing. Cheers, Bert Gunter On Thu, Sep 9, 2010 at 8:00 PM, John Sorkin <jsorkin at grecc.umaryland.edu> wrote:> windows Vista > R 2.10.1 > > > (1) How can I get the complete table of for the fixed effects from lmer. As can be seen from the example below, fixef(fit2) only give the estimates and not the SE or t value > >> fit3<- lmer(y~time + (1|Subject) + (time|Subject),data=data.frame(data)) >> summary(fit3) > Linear mixed model fit by REML > Formula: y ~ time + (1 | Subject) + (time | Subject) > Data: data.frame(data) > AIC BIC logLik deviance REMLdev > -126.2 -116.4 70.1 -152.5 -140.2 > Random effects: > Groups Name Variance Std.Dev. Corr > Subject (Intercept) 2.9311e+01 5.41396385 > Subject (Intercept) 0.0000e+00 0.00000000 > time 0.0000e+00 0.00000000 NaN > Residual 8.1591e-07 0.00090328 > Number of obs: 30, groups: Subject, 10 > > Fixed effects: > Estimate Std. Error t value > (Intercept) 14.998216 1.712046 9 > time -0.999779 0.000202 -4950 > > Correlation of Fixed Effects: > (Intr) > time -0.001 >> fixef(fit3) > (Intercept) time > 14.9982158 -0.9997793 > > (2) lmer does not give p values or confidence intervals for the fixed effects. How we are to interpret the estimates given that no p value or CI is given for the estimates? > > > > > John David Sorkin M.D., Ph.D. > Chief, Biostatistics and Informatics > University of Maryland School of Medicine Division of Gerontology > Baltimore VA Medical Center > 10 North Greene Street > GRECC (BT/18/GR) > Baltimore, MD 21201-1524 > (Phone) 410-605-7119 > (Fax) 410-605-7913 (Please call phone number above prior to faxing) > > Confidentiality Statement: > This email message, including any attachments, is for ...{{dropped:25}}
Daniel Brewer <daniel.brewer <at> icr.ac.uk> writes:> > Hello, > > I have a bar plot where I am already using colour to distinguish one set > of samples from another. I would also like to highlight a few of these > bars as ones that should be looked at in detail. I was thinking of > using hatching, but I can't work out how or if you can have a background > colour and hatching which is different between bars. Any suggestions on > how I should do this? > > Thanks > > DanHi Dan, The following code was part of a response to another person off-list recently. She wanted to use different hatching angles to highlight different bars which were already black-and-white coded stacked bars. This approach basically superimposes hatched bars over the coloured bars, using base graphics. It uses the "add=TRUE" argument to superimpose the plots. The same principle should work for what you want. X1 <- c(2300,2110) X2 <- c(1300,2220) X3 <- c(1300,1100) X4 <- c(450,650) data <- cbind (X1,X2,X3,X4) colnames(data) <- c("sample 1","sample 2","sample 3","sample 4") par(las=1) par(mar=c(5,5,4,2)) barplot( data, beside=FALSE, horiz=TRUE, col=c("black","white"), xlim = c(0,5000) ) barplot( cbind(X1,NA,X3), # NA is necessary to correctly space the bars names.arg=rep("",3), # so that the labels are not overwritten xlim = c(0,5000), beside=FALSE, horiz=TRUE, density=8, # how dark the cross-hatching lines are angle=0, # angle of hatch lines col="black", # colour of hatch lines add=TRUE # superimposes cross-hatched bars over original bars ) barplot( cbind(NA,X2,NA,X4), names.arg=rep("",4), # a second superimposed plot xlim = c(0,5000), # is necessary because of the beside=FALSE, # limitations of the angle argument horiz=TRUE, density=8, angle=90, col="black", add=TRUE ) Hope it helps, Michael Bibo michael_bibo<at>health.qld.gov.au