allometric / allometric Goto Github PK
View Code? Open in Web Editor NEWStructured Allometric Models for Trees
License: Other
Structured Allometric Models for Trees
License: Other
See, e.g., montero_2005
models
[ins] r$> allometric_models %>% filter(country == "ES", genus == "Pinus", component == "foliage")
# A tibble: 3 x 13
id component measure country region family genus species model pub_id family_name covt_name pub_year
<chr> <chr> <chr> <list> <list> <chr> <chr> <chr> <list> <chr> <list> <list> <dbl>
1 d91bb101 foliage biomass <chr [1]> <list [1]> Pinaceae Pinus pinea <FxdEffcM> montero_2005 <chr [3]> <chr [1]> 2005
2 cc9dca58 foliage biomass <chr [1]> <list [1]> Pinaceae Pinus radiata <FxdEffcM> montero_2005 <chr [3]> <chr [1]> 2005
3 7b50b22c foliage biomass <chr [1]> <list [1]> Pinaceae Pinus sylvestris <FxdEffcM> montero_2005 <chr [3]> <chr [1]> 2005
[ins] r$> allometric_models %>% filter(country == "ES", genus == "Pinus", component == "foliage") %>% unnest_models("region")
# A tibble: 3 x 13
id component measure country region family genus species model pub_id family_name covt_name pub_year
<chr> <chr> <chr> <list> <list> <chr> <chr> <chr> <list> <chr> <list> <list> <dbl>
1 d91bb101 foliage biomass <chr [1]> <chr [3]> Pinaceae Pinus pinea <FxdEffcM> montero_2005 <chr [3]> <chr [1]> 2005
2 cc9dca58 foliage biomass <chr [1]> <chr [1]> Pinaceae Pinus radiata <FxdEffcM> montero_2005 <chr [3]> <chr [1]> 2005
3 7b50b22c foliage biomass <chr [1]> <chr [2]> Pinaceae Pinus sylvestris <FxdEffcM> montero_2005 <chr [3]> <chr [1]> 2005
Provide a citation of the publication you want us to add.
@article{eleoterio2019aboveground,
title={Aboveground biomass quantification and tree-level prediction models for the Brazilian subtropical Atlantic Forest},
author={Eleot{\'e}rio, Jackson Roberto and Uller, Heitor Felippe and Zimermann Oliveira, Laio and Klitzke, Aline Renata and Fantini, Alfredo Celso and Vibrans, Alexander Christian},
journal={Southern Forests: a Journal of Forest Science},
volume={81},
number={3},
pages={261--271},
year={2019},
publisher={NISC (Pty) Ltd}
}
We should have >= 500 models before 1.0.0 release
Using a few FIA plots from SW Oregon, make a vignette showing an example analysis of total volume
If a region is defined, it must be matched with the corresponding country, otherwise it (ModelSet, AllometricModel) are invalid.
If a country is defined it must exist inside a database of ISO 3166-1 character codes, likewise for regions and ISO 3166-2.
Provide a citation of the publication you want us to add.
@article{rustagi1991compatible,
title={Compatible variable-form volume and stem-profile equations for Douglas-fir},
author={Rustagi, Krishna P and Loveless Jr, Robert S},
journal={Canadian journal of forest research},
volume={21},
number={2},
pages={143--151},
year={1991},
publisher={NRC Research Press Ottawa, Canada}
}
Right now predict
only takes a vector of parameters and a dataframe of covariates. For mixed effects models, the predict function will need a vector of y's for the target group as well.
Here is a sketch of some possibilities
# Just playing with the idea here...
setClass(
'MixedEffectsModel',
contains = 'ParametricModel'
)
setGeneric('predict', function(mod, covariates, ranefs) {
# This leaves it up to the author to provide random effect estimates
mod@predict_fn(mod@parameters, covariates, ranefs)
})
# Alternatively we just provide a ... to predict for ParametricModel, the
# structure of ranefs is not always the same, and maybe this is the most
# general way to allow for it. Ranefs are functions of the parameters, covariates
# *and* observations within the target grouping...so a user would need to
# at least provide those observations, or predict the random effects themselves
# using the model. The ranefs can enter non-linearly
This should happen in update_allometric_models
Right now, Montero et al. (2005) branch biomass models have a special response variable name. I think it makes more sense to rework these as model descriptors, since it appears to be a very specialized case
The datatypes and instantiation of ParametricModel
are unclear. It is fine for the user to give a list, since that is easiest for most users, but these datatypes should be converted to tbl_df
on instantiation. This way, descriptors
tables can support nested lists, see issue #34
Provide a citation of the publication you want us to add.
@article{woodall2011methods,
title={Methods and equations for estimating aboveground volume, biomass, and carbon for trees in the US forest inventory, 2010},
author={Woodall, Christopher W and Heath, Linda S and Domke, Grant M and Nichols, Michael C},
journal={Gen. Tech. Rep. NRS-88. Newtown Square, PA: US Department of Agriculture, Forest Service, Northern Research Station. 30 p.},
volume={88},
pages={1--30},
year={2011}
}
https://ww2.arb.ca.gov/sites/default/files/cap-and-trade/protocols/usforest/2014/woodall_2011.pdf
A Publication
can be defined with a descriptor, e.g., region = "OR"
A ModelSet
can be defined with a descriptor, e.g. region = "Western OR"
Likewise, a Model
can be defined with a descriptor, e.g., region = "Clackamas"
This should be handled when model sets are added to a publication. An error should be thrown when this case is detected, the user should be forced to select a unique name.
The current number of models by component-measurement should summarised in a table in the README. Optionally, we should track models added with each update in NEWS.md after the minimal update is released.
Provide a citation of the publication you want us to add.
@article{poudel2019estimating,
title={Estimating individual-tree aboveground biomass of tree species in the western USA},
author={Poudel, Krishna P and Temesgen, Hailemariam and Radtke, Philip J and Gray, Andrew N},
journal={Canadian Journal of Forest Research},
volume={49},
number={6},
pages={701--714},
year={2019},
publisher={NRC Research Press}
}
Provide a citation of the publication you want us to add.
@article{montero2020production,
title={Biomass production and carbon sequestration by Spanish shrublands and by the superficial organic horizon of forest soils},
author={Montero, G and L{\'o}pez-Leiva, C and Ruiz-Peinado, R and L{\'o}pez-Senespleda, E and Onrubia, R and Pasalodos, M},
journal={Ministry of Agriculture, Fisheries and Food{\'o}n: Madrid, Spain},
year={2020}
}
Paco says these may need some checking
Write something that looks nice for print(publication)
Provide a citation of the publication you want us to add.
@article{trasobares2022nationwide,
title={Nationwide climate-sensitive models for stand dynamics and forest scenario simulation},
author={Trasobares, Antoni and Mola-Yudego, Blas and Aquilu{\'e}, N{\'u}ria and Gonz{\'a}lez-Olabarria, Jos{\'e} Ram{\'o}n and Garcia-Gonzalo, Jordi and Garc{\'\i}a-Vald{\'e}s, Ra{\'u}l and De C{\'a}ceres, Miquel},
journal={Forest Ecology and Management},
volume={505},
pages={119909},
year={2022},
publisher={Elsevier}
}
Some covariates do not have units, such as indicator variables. units::unitless
may do the trick but throws an error when compiling models
vsa [ft3]: volume of the entire stem, including top and stump
dsob [in]: diameter of the stem, outside bark at breast height
should look like
vsa [ft3]: volume of the entire stem, including top and stump
dsob [in]: diameter of the stem, outside bark at breast height
its the details!
fit_species
seems to be inadequate or at least unclear. Sometimes a model is fit for an entire genus, or a set of species within a genus, etc etc
We should have something more general/flexible, but I still think using the taxonomic hierarchy is a good idea. I will wait until I add a few more equations before committing to anything
The parameters of a model are determined by "subtracting" the covariates of a predict_fn
from the set of all named variables. This is ok, but users may want to define intermediate parameters, such as in the case of Hann (2011) which involves many intermediate steps.
One solution may be to require users to write the final line of predict_fn
as a mathematical expression (as they are required to now), but allow this expression to have intermediate variables.
Ideally, the package should be performant for a very large number of models.
My initial idea of writing out functions programmatically is prohibitively slow (to document, build website and install!) at around 10000 equations. That is a super big number of equations, but we should start with something that can deal with that.
So...back to the drawing board.
My other idea is to not directly load allometric functions at all. Instead, the user calls them from a locally stored data structure. The question is, how do data structures like .RDS or .Rdata handle this. Do they need to be loaded into memory? How fast is this?
Referring to models with component
and measure
can be awkward. Instead, we can make something more general called model_type
which will link certain response variable names to more typically used names.
For example, dsoh
and dsih
refer to diameter outside/inside bark at a specificed height. These are taper models, so the table can look something like
response_name model_type
dsoh taper
dsih taper
There can be a set of pre-specified model types, and then the rest are just filled in with paste(component, measure)
as before. Finally, we get something nice, like allometric_models %>% filter(model_type == "taper")
instead of the more awkward allometric_models %>% filter(component == "stem", measure == "diameter")
. Another example is hstix**
which refer to site index models.
Provide a citation of the publication you want us to add.
@book{chojnacky1985pinyon,
title={Pinyon-juniper volume equations for the central Rocky Mountain States},
author={Chojnacky, David C},
volume={339},
year={1985},
publisher={US Department of Agriculture, Forest Service, Intermountain Forest and Range~…}
}
It should be possible to create covariate names that are not in the set of defined variables. One motivating example is in Chojnacky (1985), which uses an indicator variable for multi-stemmed juniper trees. Its unlikely that a shared pool of covariate names will ever cover all cases.
This could be covered by optional arguments to ModelSet and AllometricModel that allow for user-defined variable names and definitions. Appropriate validity checks should also be implemented, but this is larger scope than this issue
It should be easy to access the citation for a given model using cite
. Will require having a reference to publication@citation
in the model object.
Provide a citation of the publication you want us to add.
@article{feldpausch2012tree,
title={Tree height integrated into pantropical forest biomass estimates},
author={Feldpausch, Ted R and Lloyd, Jon and Lewis, Simon L and Brienen, Roel JW and Gloor, Manuel and Monteagudo Mendoza, Abel and Lopez-Gonzalez, Gabriela and Banin, Lindsay and Abu Salim, Kamariah and Affum-Baffoe, Kofi and others},
journal={Biogeosciences},
volume={9},
number={8},
pages={3381--3403},
year={2012},
publisher={Copernicus GmbH}
}
Describe where the models are in the report.
https://bg.copernicus.org/articles/9/3381/2012/bg-9-3381-2012.pdf
Table 3
See, e.g.,
https://brycefrank.com/allometric/reference/vibrans_2015.html
Only the last line of the function should be used
Provide a citation of the publication you want us to add.
@article{vibrans2015generic,
title={Generic and specific stem volume models for three subtropical forest types in southern Brazil},
author={Vibrans, Alexander C and Moser, Paolo and Oliveira, Laio Z and de Ma{\c{c}}aneiro, Jo{\~a}o P},
journal={Annals of Forest Science},
volume={72},
number={6},
pages={865--874},
year={2015},
publisher={BioMed Central}
}
Describe where the models are in the report.
Table 3
Provide a citation of the publication you want us to add.
@article{hibbs2007stem,
title={Stem taper and volume of managed red alder},
author={Hibbs, David and Bluhm, Andrew and Garber, Sean},
journal={Western Journal of Applied Forestry},
volume={22},
number={1},
pages={61--66},
year={2007},
publisher={Oxford University Press}
}
Provide a citation of the publication you want us to add.
https://drive.google.com/file/d/1vTu-gdnAsD5TX4Lj4J9WxjsMcaPlvIa7/view
Temesgen et al. (2008) published a mixed effects model that relies on iteratively solving a system of equations. This is out of scope for the initial release, but I am sure it can be handled easily inside predict_fn
. For now, just flag the model with fixed_only = TRUE
Right now, Publication
objects are loaded when install_models
runs. This is undesirable since it occupies memory that is not really used. Instead, we should remove these objects from memory as they are processed in update_models
and optionally cache the publication objects for interested users.
S4 classes cannot inherit tbl_df
, but S3 classes can, and mixing class structures is no problem as long as it is done well. We should extend tbl_df
for select_model
and to prepare for "tidy" use of allometric models in larger inventories (a task for a future milestone)
Right now, model summaries are ambiguous to the order of arguments given the predict
. It should be easy to make a model_call
method that can retrieve this and print it in the summary.
Model Form:
vso = k * (a * hso + b * dsob * hso + c * dsob^2 * hso + d * (hsdop67 - vso = 1.37)) + e * dsob * (hsdop67 - 1.37) + f * dsob^2 * (hsdop67 - vso = 1.37)
Note the weird vso = 1.37
Provide a citation of the publication you want us to add.
@book{montero2005production,
title={Biomass production and CO2 fixation by Spanish forests},
author={Montero, Gregorio and Ruiz-Peinado, Ricardo and Munoz, Marta},
volume={13},
year={2005},
publisher={INIA-National Institute for Agricultural and Food Research{\'\i}and Technology~…}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.