On 10/20/2010 08:34 PM, Peter Francis wrote:
Dear List,
I am relatively new to R and am trying to create more attractive plots than
excel can manage!
I have looked through the various programmes ggplot, lattice, hmisc etc but my
case seems to be not metnioned, maybe it is but i have not noticed - if this is
the case i apologise.
*****************************************************************************************************************
#I have a series of simulated values, which are means
sim<-
c(0.0012,0.0009,2,2,9,12,0.0009,2,19,1,1,0.0013,1,0.0009,0.0009,1,26,3,1,2,1,0.0009,1,0.2323,4,2,0.0009,0.0009,0.0009,52,49,1,3,7)
#and actual values
actual<-
c(0,0,2,0,13,20,0,3,38,0,0,0,1,0,0,0,27,2,0,0,1,0,1,0,4,2,0,0,0,54,21,0,4,11)
#The "X" axes is family, ranging from 1-35, where the "Y" axes is sim and
actual values.
#What i want to do is plot the simulated values with the 95% CI values, and
then plot the actual values and see if they fall in the CI'S which they do. The
idea is that there is no significant difference between the actual values and
the simulated values.
Your problem is that they don't.
#I thave Ci for sim and this is where the trouble begins!
simCI<-
c(0.000908781,0.001248025,0.000928731,0.000885441,0.002384808,0.002700088,0.005377963,0.006202863,0.000918969,0.002566072,0.007687229,0.001593536,0.001578519,0.001299327,0.00217493,0.000908781,0.00090428,0.001550469,0.008840134,0.003300862,0.001546501,0.002775418,0.0014778,0.00090428,0.001546201,0.000898151,0.003446757,0.002854941,0.000863444,0.000918969,0.000924599,0.011732253,0.011488353,0.001788464)
# i then put this in a dataframe
simvsact<- data.frame(sim = sim, actual = actual, simCI.lower = sim - simCI,
simCI.upper = sim + simCI, fam = factor(paste('Family', 1:34, sep = '')))
Hi Peter,
As the other Jim mentioned, the CIs for sim are very small and as far as
I can see, the actual values are far outside the CIs, apart from some of
the "essentially zero" values. Try this and you may see what I mean:
plot(sim,ylim=range(c(sim,actual)),
main="sim vs actual",xlab="Family",type="b")
library(plotrix)
# if I try to plot a confidence band,
# it is so narrow it doesn't appear
dispersion(1:35,sim,simCI,col="red")
points(actual,pch=2,lty=2,col=4,type="b")
Jim
______________________________________________
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.