G
Guest
I need to calculate an appropriate mean and variance when there are "missing"
data. Let me explain with a dataset from some fisheries sampling we
conducted:
I have two tables and a one to many relationship.
Table 1 is the parent record and is the sampling event table. It records the
sample ID, date, site & replicate #. Table 2 is the child and contains the
information of what I caught in the sample by species and number
A simple example view of the Data might look like the below.
Table 1
sID date site rep
1 1/1/05 1 1
2 1/1/05 1 2
3 1/2/05 1 3
4 1/2/05 1 4
Table 2
sID spp number
1 a 1
1 b 2
1 c 1
2 a 5
2 c 3
2 d 1
3 b 2
3 c 1
3 d 1
4 a 2
4 c 1
4 e 2
Thus, average catch rates for the 5 species caught by site would be:
a = (1+5+0+2)/4 = 2.0
b = (2+0+2+0)/4 = 1.0
c = (1+3+1+1)/4 = 1.5
d = (0+1+1+0)/4 = 0.5
e = (0+0+0+2)/4 = 0.5
Question is can I either generate a query that inserts the needed zero's or
write a function to derive the mean and sd for each spp by site. Preferrably,
this could be called "on the fly" in a Pivot chart so I can look at mean
catch rates of multiple species simultaneously over time.
Any guidance or pointers in the right direction would be greatly appreciated.
data. Let me explain with a dataset from some fisheries sampling we
conducted:
I have two tables and a one to many relationship.
Table 1 is the parent record and is the sampling event table. It records the
sample ID, date, site & replicate #. Table 2 is the child and contains the
information of what I caught in the sample by species and number
A simple example view of the Data might look like the below.
Table 1
sID date site rep
1 1/1/05 1 1
2 1/1/05 1 2
3 1/2/05 1 3
4 1/2/05 1 4
Table 2
sID spp number
1 a 1
1 b 2
1 c 1
2 a 5
2 c 3
2 d 1
3 b 2
3 c 1
3 d 1
4 a 2
4 c 1
4 e 2
Thus, average catch rates for the 5 species caught by site would be:
a = (1+5+0+2)/4 = 2.0
b = (2+0+2+0)/4 = 1.0
c = (1+3+1+1)/4 = 1.5
d = (0+1+1+0)/4 = 0.5
e = (0+0+0+2)/4 = 0.5
Question is can I either generate a query that inserts the needed zero's or
write a function to derive the mean and sd for each spp by site. Preferrably,
this could be called "on the fly" in a Pivot chart so I can look at mean
catch rates of multiple species simultaneously over time.
Any guidance or pointers in the right direction would be greatly appreciated.