"to use the

**one-way ANOVA test** to determine whether there is a

**statistically significant relationship** between the density of beech and oak trees and altitude"

Put that way, I believe 1-way Anova (or, better, a t-test since you have 2 groups) would test if there is a significant difference in elevation between the two species, which does not sound very much like what you're after....

I was thinking from a spatial analysis point of view: if you're interested to know if there is a spatial relation between the location of a specie and an underlying spatial covariate (elevation), one could adopt the approach I have implemented in a function (pointsCovarCum()) of my R package (

GmAMisc):

Quoting from my function's help:

"The function plots the cumulative distribution of the values of the covariate at the locations of the input point pattern, and adds an acceptance interval (with significance level equal to 0.05; sensu Baddeley et al., "Spatial Point Patterns. Methodology and Applications with R", CRC Press 2016, 208) that allows to assess the statistical significance of the observed cumulative distribution. The interval is built by calculating the cumulative distribution of B realizations of a Complete Spatial Random process, and keeping the middle 95percent of those B distributions. B is set by default to 200, but can be increased by the user. The number of random points drawn during each of the B simulations is equal to the number of features of the input point pattern."

This entails that you have the coordinates of the location of your trees (by specie) and an elevation dataset (like a Digital Terrain Model raster).

Maybe this is not something you have at your disposal; just wanted to offer an alternative view.

Best

Gm