[R] Resampling to find Confidence intervals
benjamin.ward at bathspa.org
Tue Jan 4 01:03:40 CET 2011
Hi, I'm doing some modelling (lm) for my 3rd year dissertation and I
want to do some resampling, especially as I'm working with microbes,
getting them to evolve resistance to antimicrobial compounds, and after
each exposure I'm measuring the minimum concentration required to kill
them (which I'm expecting to rise over time, or exposures), I have 5
lineages per cleaner, and I'm using 2 cleaners(of different chemical
origin, and it's these two different origins I'm interested in, or
rather, and differences in concentration results between them). So the
amount of data I get is small, hence my desire to resample. But thats
not so important.
I have used help from Kaplans Book: Statistical Modelling A Fresh
Approach, to get write the following code for my project:
samps = do(500)*
coef(lm(MIC. ~ 1 + Challenge + Cleaner + Replicate,
But the "resample" and "do" operators are functions specific to a
workspace that comes with the book, not a normal R setup. So I was
thinking of ways I could achive the same result, or sort of result
because the resample should be different each time, I think the
following would work to the same effect:
resampled_ecoli = sample(ecoli, 500, replace=T)
coefs = (coef(lm(MIC. ~ 1 + Challenge + Cleaner + Replicate,
And then I can work out confidence intervals by multiplying the standard
errors by 2.
Although I'm not used to doing this sort of operation in R so I don't
want to do the wrong thing.
If anyon could tell me if that would work or what I need to do instead
I'd be eternally greatful.
More information about the R-help