Stratford, Jeffrey
2013-Jul-04 19:00 UTC
[R] coding variables which are independent or grouped
Hi everyone,
I have observations of the habitats of birds that I consider independent. I
also have observations of habitats from several forest fragments with
several observations within each fragment that are non-independent.
I'm curious to know the best strategy to code these observations for
analysis (JAGS or WinBUGS through R)
Using R 3.0.1 in Windows.
Here's what I have so far:
"code" indicates the individual fragment (four digits) and the bird
species
(one digit and nine species), "type" indicates fragment size (in
hectares)
and species (now two digits). "species" just lets me know what species
are
which (taken out later) and "leafno" is the average number of dead
leaves
in a plot.
Let me know if there's anything I can clarify.
Thanks so much,
Jeff
structure(list(code = c(1112L, 1112L, 2107L, 2107L, 2107L, 2107L,
2108L, 2108L, 2108L, 2108L, 3114L, 3114L, 3114L, 3114L, 3114L,
3114L, 4101L, 4101L, 4101L, 4101L, 1212L, 1212L, 1212L, 1212L,
1212L, 1212L, 1212L, 1212L, 2206L, 2206L, 2206L, 2206L, 2206L,
2206L, 2206L, 2206L, 3209L, 3209L, 3209L, 3209L, 3209L, 3209L,
3209L, 3209L, 4201L, 4201L, 4201L, 4201L, 4201L, 4201L, 4201L,
4201L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L,
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 9L, 9L, 9L, 9L, 9L, 9L,
9L, 9L, 9L, 9L, 9L, 9L, 2303L, 2303L, 2303L, 2303L, 2303L, 2303L,
2303L, 2303L, 2303L, 2303L, 2303L, 2303L, 2303L, 2303L, 2303L,
3304L, 3304L, 3304L, 3304L, 3304L, 3304L, 3304L, 3304L, 3304L,
3304L, 3304L, 3304L, 3304L, 3304L, 3304L, 3304L), type = c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 91L, 91L, 91L, 91L,
92L, 92L, 92L, 92L, 92L, 92L, 92L, 92L, 92L, 92L, 92L, 92L, 92L,
93L, 93L, 93L, 93L, 93L, 93L, 93L, 93L, 93L, 93L, 93L, 93L, 93L,
93L, 93L, 93L, 94L, 94L, 94L, 94L, 94L, 94L, 94L, 94L, 94L, 94L,
94L, 94L, 94L, 94L, 94L, 94L, 94L, 95L, 95L, 95L, 95L, 96L, 96L,
96L, 97L, 97L, 97L, 97L, 97L, 97L, 97L, 97L, 98L, 98L, 98L, 98L,
98L, 98L, 98L, 98L, 98L, 98L, 98L, 98L, 98L, 98L, 98L, 98L, 98L,
98L, 98L, 98L, 98L, 98L, 98L, 99L, 99L, 99L, 99L, 99L, 99L, 99L,
99L, 99L, 99L, 99L, 99L, 100L, 100L, 100L, 100L, 100L, 100L,
100L, 100L, 100L, 100L, 100L, 100L, 100L, 100L, 100L, 100L, 100L,
100L, 100L, 100L, 100L, 100L, 100L, 100L, 100L, 100L, 100L, 100L,
100L, 100L, 100L), species = structure(c(11L, 11L, 11L, 11L,
11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L,
11L, 11L, 11L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 1L, 1L, 1L, 1L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L,
5L, 5L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 9L, 9L, 9L,
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L,
9L, 9L, 9L, 9L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 10L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
6L, 6L, 6L), .Label = c("CA", "CT", "FA",
"FC", "GV", "HFR",
"HM", "MC", "MF", "MT", "OFR",
"TFR"), class = "factor"), leafno = c(1.8,
2.65, 1.25, 2.6, 1.55, 2.35, 2.3, 1.7, 2.2, 3.2, 3.1, 1.25, 2.35,
1.9, 1.75, 2.8, 1.95, 2.45, 1.55, 1.65, 0.85, 1, 1.85, 1.45,
2.55, 4.05, 3.4, 2.1, 2.05, 1.95, 2.75, 2.6, 1.95, 2.15, 2.2,
2.1, 1.7, 2.2, 1.65, 2.2, 2.95, 2, 2.05, 1.45, 1.55, 0.7, 1.45,
2.05, 1.6, 1.4, 1.25, 2.25, 2.35, 2.4, 2.15, 1.65, 1.8, 2.25,
1.45, 2.15, 2.05, 1.5, 2, 1.7, 1.15, 1.25, 1, 1.15, 1.95, 1.05,
2.4, 1.1, 1.75, 1.7, 1.7, 1.75, 1.1, 1.05, 1.8, 1.45, 2.05, 1.9,
1.15, 2, 1.15, 2.9, 1.6, 2.65, 2.1, 2.35, 1.25, 1.8, 0.85, 1.6,
2.35, 1.75, 1.5, 1.75, 1.3, 1.8, 1.05, 1.45, 0.85, 0.9, 1.7,
2.05, 1.55, 1.55, 1.4, 1.8, 1.5, 1.2, 1.3, 2, 1.4, 2.6, 2.05,
1.05, 2.55, 2.4, 0.4, 2.1, 1.65, 1.65, 1.5, 1.5, 1.55, 2.4, 1.8,
2.2, 1.7, 1.05, 1.45, 1.5, 1.1, 0.95, 0.6, 1.3, 1.95, 1.3, 1.9,
1.55, 1.75, 1.65, 2.35, 3.2, 1.55, 1.65, 1.05, 2.6, 1.75, 1.6,
2.35, 1.2, 1.35, 2.5, 0.95, 2.15, 2.15, 2.55, 1.6, 2.1, 1.9,
0.95, 2.1, 2.4, 2.4, 1.7, 2.45, 1.85, 1.15, 1.25, 0.65, 1.35,
1.8, 1.4, 1.15, 2.75, 2.25, 2, 1.75, 1.4, 2.25)), .Names = c("code",
"type", "species", "leafno"), class =
"data.frame", row.names = c(NA,
-183L))
--
********************************************************
Jeffrey A. Stratford, PhD
Department of Biology and Health Sciences
Wilkes University, PA 18766 USA
570-332-2942
http://web.wilkes.edu/jeffrey.stratford/
********************************************************
[[alternative HTML version deleted]]