Mächler Marc Jacques
2010-May-20 15:39 UTC
[R] Comparing three groups, data: present, absent
Dear R-Experts, Dear friends of dung. I have a statistical Problem, to which nobody I asked could give me an answer. Maybe you can. I was in the African-Savanna and made a Dung-Monitoring. This means I walked randomly over the field and for every Dung-Event I found I noted following parameters: Species (Waterbuck, Giraffe, Reedbuck); Age-Category (less than a week, more than a week & less than a month, more than a month); Termites present (0 or 1); Now I want to compare for every species, if the percentage of Termites attack differ between the different Age-Categories and if the percentage of attacks of Species differ between the same Age-Categories. I only found a lot of very complicated models for "Presence / Absence". But I do not need to find a treshold, I just want to compare groups. My Question now: - What test do I have to use to compare groups. - Do I have to transform the data (Termite.Attack which is 0 and 1)? I really appreciate every hint. Thanks a lot, Dung-Master Marc-Jacques from the swiss federal institute of technology
## Dung observations
## Create a sample original data
data <- data.frame(Species=sample(c("W", "G",
"R"), 200, replace=TRUE),
Age=sample(c("days", "weeks",
"months"),200,replace=TRUE),
Termites=sample(c(0,1),200,replace=TRUE))
## Show what original data look like
head(data)
Species Age Termites
1 W months 0
2 R weeks 0
3 W weeks 0
4 G weeks 0
5 R months 1
6 W days 1
## Analyze each species
## Here we just tabulate Waterbuck as an example
data.w <- data[data$Species == "W",]
table.w <- table(data.w[,2:3])
## The results table looks like
table.w
Termites
Age 0 1
days 18 9
months 9 11
weeks 10 18
## Apply Chi-squared Test
chisq.test(table.w)
## Usually use Pearson's Chi-squared Test
## If your data are not suitable for the Pearson's Chi-squared Test, it
seems that R will tell you.
## H0 : All three age groups have same Termites attack percentage.
## H1 : All situations except H0.
-----
A R learner.
--
View this message in context:
http://r.789695.n4.nabble.com/Comparing-three-groups-data-present-absent-tp2224751p2225612.html
Sent from the R help mailing list archive at Nabble.com.
Reasonably Related Threads
- Boxplot position on X-axis relative to it's value
- Could not set file on ensure: undefined method `[]'' for nil:NilClass
- Re: (THIS IS SO REAL PEOPLE) IM ASKING FOR DONATIONS FOR HEART SURGERY
- R - box design-scatter plot für means/regression/lme?
- compare results of glms