This is a discussion on Calculating some formulas from database data within the MySQL Database forums, part of the Database Forums category; I am doing a project on beetle diversity and need to calculate a few diversity indices for a load of ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I am doing a project on beetle diversity and need to calculate a few
diversity indices for a load of data i have collected. I thought that maybe i could make a program in php to do that for, and save a bit of time (as well as prevent calculation errors). I imagine this could be quite a bit of programming but i have dreamweaver to help me. Now what i have is a MySQL database full of data on beetle diversity with the following tables: Date - the date the sample is from Habitat - one of 9 habitats that i am testing between (ie. grass, stones, birch woodland, etc) Replica - ie 'Repeats', there were two replicas for each habitat from each date (A and B) Trap number - from each replica there were 6 traps Species - the species of beetle that was found in the trap (of course there are often more than one per trap) Number of Individuals - the number of individuals of that species found in that trap What i need to do is calculate Shannon-Weiner, Shannon Equitability and Margalefs Diversity indices for each replica from each date for each habitat (the data for the individual traps will be merged together). I have an idea of how to do it but what i am stumbling at is how to create a recordset which will calculate the total number of individuals for that species from that replica, date & habitat (I) and calculate the number of different species for that replica, date & habitat (S). Once i have S and I i should be able to write the formula in php to create the indices. Ideally this could be done in a way to allow for each repeating areas to be assigned so that all of the indices for that habitat (for each date and replica) could be shown on one page (to save a lot of clicking). Anyone know of a good way of going about this, any help will be greatly appreciated. |