Learn R Programming

biogeom (version 1.5.0)

fitGS: Data-Fitting Function for the Geometric Series of Size Distribution Measurements

Description

fitGS is used to estimate the model parameters of a geometric series, i.e., the first term and common ratio.

Usage

fitGS(A, ini.val = NULL, control = list(), par.list = FALSE, fig.opt = TRUE)

Value

x

the ascending number from 1 to length(A).

y

the observed size distribution measurements (\(y\) values) sorted in ascending order.

y.theo

the predicted size distribution measurements (\(y\) values) sorted in ascending order by the geometric seires.

z

the observed cumulative size distribution measurements (\(z\) values) sorted in ascending order.

z.theo

the predicted cumulative size distribution measurements (\(z\) values) sorted in ascending order by the geometric seires.

par

the estimates of the model parameters corresponding to the first term and common ratio, respectively.

r.sq

the coefficient of determination between the observed and predicted \(y\) values.

RSS

the residual sum of squares between the observed and predicted \(y\) values.

sample.size

the number of data points used in the data fitting.

RMSE1

the root mean square error between the observed and predicted \(y\) values.

MAPE1

the mean absolute percent error between the observed and predicted \(y\) values (in %).

RMSE2

the root mean square error between the observed and predicted \(z\) values.

MAPE2

the mean absolute percent error between the observed and predicted \(z\) values (in %).

Arguments

A

A sequence of size distribution measurements, e.g., the temporal or spatial progression of leaf area in an individual plant.

ini.val

the list of initial values for the model parameters.

control

the list of control parameters for using the optim function in package stats.

par.list

an optional argument to show the list of parameters on the screen.

fig.opt

an optional argument to draw (i) the observed and predicted \(y\) values (size distribution measurements) sorted in ascending order, and (ii) the the observed and predicted \(z\) values (cumulative size distribution measurements) sorted in ascending order.

Author

Peijian Shi pjshi@njfu.edu.cn, Johan Gielis johan.gielis@uantwerpen.be, Brady K. Quinn Brady.Quinn@dfo-mpo.gc.ca.

Details

In general, there is no need to set the initial values for model parameters by users (i.e., ini.val = NULL). The approach proposed by Yan et al. (2025) is used to find the suitable initial values for model parameters. The Nelder-Mead algorithm (Nelder and Mead, 1965) is used to carry out the optimization of minimizing the residual sum of squares (RSS) between the observed and predicted \(y\) values (Deng et al., 2025; Yan et al. 2025). The optim function in package stats was used to carry out the Nelder-Mead algorithm. fig.opt = TRUE generates two panels (i.e., \(y\) vs. \(\hat{y}\), and \(z\) vs. \(\hat{z}\)) in a figure.

References

Deng, L., Wang, J., Zhang, L., Hölscher, D., Shi, P. (2025) Testing the validity of the Koyama-Smith equation and the power-law equation using 3231 tepals of a Magnolia species. Trees \(-\) Structure and Function 39, 74. tools:::Rd_expr_doi("10.1007/s00468-025-02645-7")

Nelder, J.A., Mead, R. (1965) A simplex method for function minimization. Computer Journal 7, 308\(-\)313. tools:::Rd_expr_doi("10.1093/comjnl/7.4.308")

Shi, P., Gielis, J., Quinn, B.K., Niklas, K.J., Ratkowsky, D.A., Schrader, J., Ruan, H., Wang, L., Niinemets, Ü. (2022) 'biogeom': An R package for simulating and fitting natural shapes. Annals of the New York Academy of Sciences 1516, 123\(-\)134. tools:::Rd_expr_doi("10.1111/nyas.14862")

Yan, C., Shi, P., Yao, W., Yu, K., Niinemets, Ü. (2025) A nonlinear fitting method provides strong support for geometric series of stomatal area in 12 Magnoliaceae species. Plants 14, 893. tools:::Rd_expr_doi("10.3390/plants14060893")

Examples

Run this code
  # A sequence of tepal area measurements of a Magnolia flower (Deng et al., 2025)
  A   <- c(56.65, 43.37, 49.61, 56.27, 56.66, 49.45, 46.56, 43.42, 44.80)
  ReS <- fitGS(A)
  names( ReS)

  graphics.off()

Run the code above in your browser using DataLab