Question: First we need a measure to compare between plots to meet the above criteria of the unpaired, independent sample, t-test, 'dependent variable is measured on
First we need a measure to compare between plots to meet the above criteria of the unpaired, independent sample, t-test, 'dependent variable is measured on an incremental level, such as ratios or intervals.'
[32]:
myplot1 = 'BUCA'
[33]:
# Select a particular plot name based on examination of mapped data and descriptions in the plot description dataset.PLT = myplot1 # Put the name for study hear, i.e ='STRD'data1 = MSH_YEAR.where('PLOT_NAME',are.contained_in(PLT)).sort('YEAR',descending=False)data1
[33]:
| PLOT_ID | PLOT_NAME | PLOT_NUMBER | YEAR | RICHNESS | COVER_% | HPRIME | EVENNESS | FREQUENCY |
|---|---|---|---|---|---|---|---|---|
| BUCA011980 | BUCA | 1 | 1980 | 10 | 15.5 | 1.886 | 0.819 | 29.5 |
| BUCA031980 | BUCA | 3 | 1980 | 15 | 32.2 | 1.433 | 0.529 | 21.5 |
| BUCA041980 | BUCA | 4 | 1980 | 9 | 18.5 | 1.754 | 0.798 | 31.4 |
| BUCA011981 | BUCA | 1 | 1981 | 15 | 50.7 | 1.656 | 0.612 | 26.9 |
| BUCA031981 | BUCA | 3 | 1981 | 17 | 71.2 | 1.324 | 0.467 | 18.8 |
| BUCA041981 | BUCA | 4 | 1981 | 14 | 55.5 | 1.787 | 0.677 | 26.7 |
| BUCA011982 | BUCA | 1 | 1982 | 16 | 39.6 | 1.765 | 0.637 | 26.1 |
| BUCA031982 | BUCA | 3 | 1982 | 20 | 46.9 | 1.424 | 0.475 | 20.8 |
| BUCA041982 | BUCA | 4 | 1982 | 16 | 38.7 | 1.931 | 0.697 | 29.5 |
| BUCA011983 | BUCA | 1 | 1983 | 16 | 43.2 | 1.408 | 0.508 | 23.7 |
... (64 rows omitted)
[34]:
YEAR1 = data1['YEAR'].min() YEAR2 = data1['YEAR'].max()
[35]:
growth1 = data1.where('YEAR',YEAR1)['COVER_%']/data1.where('YEAR',YEAR2)['COVER_%']growth1
[35]:
array([ 0.30273438, 0.50234009, 0.33944954])
[36]:
s1 = np.std(growth1)
[37]:
myplot2 = 'PUPL'
[38]:
# Select a particular plot name based on examination of mapped data and descriptions in the plot description dataset.PLT = myplot2 # Put the name for study hear, i.e ='STRD'data2 = MSH_YEAR.where('PLOT_NAME',are.contained_in(PLT)).sort('YEAR',descending=False)data2.sort('YEAR')
[38]:
| PLOT_ID | PLOT_NAME | PLOT_NUMBER | YEAR | RICHNESS | COVER_% | HPRIME | EVENNESS | FREQUENCY |
|---|---|---|---|---|---|---|---|---|
| PUPL011989 | PUPL | 1 | 1989 | 5 | 0.5 | 1.609 | 1 | 3.4 |
| PUPL021989 | PUPL | 2 | 1989 | 7 | 0.7 | 1.946 | 1 | 4.1 |
| PUPL031989 | PUPL | 3 | 1989 | 4 | 0.4 | 1.386 | 1 | 2.5 |
| PUPL041989 | PUPL | 4 | 1989 | 7 | 0.7 | 1.946 | 1 | 2.1 |
| PUPL051989 | PUPL | 5 | 1989 | 5 | 0.5 | 1.609 | 1 | 2.6 |
| PUPL061989 | PUPL | 6 | 1989 | 5 | 0.5 | 1.609 | 1 | 5 |
| PUPL071989 | PUPL | 7 | 1989 | 0 | 0 | 0 | 0 | 0 |
| PUPL081989 | PUPL | 8 | 1989 | 1 | 0.1 | 0 | 0 | 1 |
| PUPL091989 | PUPL | 9 | 1989 | 7 | 1 | 1.748 | 0.898 | 5.7 |
| PUPL101989 | PUPL | 1 | 1989 | 5 | 0.5 | 1.609 | 1 | 2.4 |
... (242 rows omitted)
[39]:
YEAR1 = data2['YEAR'].min() YEAR2 = data2['YEAR'].max()
[40]:
growth2 = data2.where('YEAR',YEAR1)['COVER_%']/data2.where('YEAR',YEAR2)['COVER_%']growth2
[40]:
array([ 0.04385965, 0.04216867, 0.03174603, 0.03825137, 0.0625 , 0.13888889, 0. , 0.00512821, 0.03846154, 0.02645503, 0.01385042, 0. ])
[41]:
s2 = np.std(growth2)
[42]:
diffmean = np.mean(growth2) - np.mean(growth1)
[43]:
se1 = s1/np.sqrt(n)se2 = s2/np.sqrt(n)std_error = np.sqrt((se1**2+se2**2)/2)paired_std_error = s/np.sqrt(n)print(f'The mean COVER_% change is: {diff_means:.2f}')print(f'The standard deviation of the COVER_% differences is: {s:.3f}')print(f'The paired standard error is: {paired_std_error:.4f}')print(f'The degrees of freedom is: {dof}')
The mean COVER_% change is: 14.67 The standard deviation of the COVER_% differences is: 3.496 The paired standard error is: 0.2202 The degrees of freedom is: 502
[44]:
t = 14.67/0.2202print("The t value is:", t)
The t value is: 66.62125340599455
[45]:
p = 0.05
Outcome of Hypothesis Test and conclusion about selected plots...
Part 2: Testing a trend
Question 6
Now we will look at the time trend of COVER_% and RICHNESS using the changes function you developed and used in Part 2 of Lab 07. With changes we are looking at the number of increases minus decreases over the time period.
changes function:
[54]:
def diff_n(values, n): ''' Parameters: values is an array of numbers n is the offset (how far apart the numbers are in the array) ''' return np.array(values)[n:] - np.array(values)[:-n]
[55]:
def changes(array, years = 1): "Return the number of increases minus the number of decreases" differences = diff_n(array, years) increases = np.count_nonzero(differences > 0) decreases = np.count_nonzero(differences < 0) return increases - decreases
[56]:
test_stat = np.sum(....column('...'))print('Total increases minus total decreases, across all years:', test_stat)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
