Data-Fitting Function for the Explicit Preston Equation
Data-Fitting Function for the Explicit Preston Equation
fitEPE is used to estimate the parameters of the explicit Preston equation or one of its simplified versions.
UTF-8
fitEPE(x, y, ini.val, simpver =NULL, control = list(), par.list =FALSE, stand.fig =TRUE, angle =NULL, fig.opt =FALSE, np =2000, xlim =NULL, ylim =NULL, unit =NULL, main =NULL)
Arguments
x: the x coordinates of an egg's profile.
y: the y coordinates of an egg's profile.
ini.val: the list of initial values for the model parameters.
simpver: an optional argument to use the simplified version of the explicit Preston equation.
control: the list of control parameters for using the optim function in package stats.
par.list: the option of showing the list of parameters on the screen.
stand.fig: the option of drawing the observed and predicted profiles of an egg at the standard state (i.e., the egg's centre is located at (0, 0), and the mid-line is aligned to the x-axis).
angle: the angle between the mid-line and the x-axis, which can be defined by the user.
fig.opt: an optional argument of drawing the observed and predicted profiles of an egg at arbitrary angle between the major axis and the x-axis.
np: the number of data points on the predicted explicit Preston curve.
xlim: the range of the x-axis over which to plot the Preston curve.
ylim: the range of the y-axis over which to plot the Preston curve.
unit: the unit of the x-axis and the y-axis when showing the Preston curve.
main: the main title of the figure.
Details
The simpver argument should correspond to EPE. Here, the major axis (i.e., the mid-line of an egg's profile) is the straight line trhough the two ends of the egg's length. 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. The optim function in package stats was used to carry out the Nelder-Mead algorithm. When angle = NULL, the observed egg's profile will be shown at its initial angle in the scanned image; when angle is a numerical value (e.g., π/4) defined by the user, it indicates that the major axis is rotated by the amount (π/4) counterclockwise from the x-axis.
Returns
par: the estimates of the model parameters.
scan.length: the observed length of the egg's profile.
scan.width: the observed width of the egg's profile.
scan.area: the observed area of the egg's profile.
scan.perimeter: the observed perimeter of the egg's profile.
r.sq: the coefficient of determination between the observed and predicted y values on the Preston curve.
RSS: the residual sum of squares between the observed and predicted y values on the Preston curve.
sample.size: the number of data points used in the data fitting.
x.stand.obs: the observed x coordinates of the points on the Preston curve at the standard state.
y.stand.obs: the observed y coordinates of the points on the Preston curve at the standard state.
y.stand.pred: the predicted y coordinates of the points on the Preston curve at the standard state.
x.obs: the observed x coordinates of the points on the Preston curve at the transferred polar angles as defined by the user.
y.obs: the observed y coordinates of the points on the Preston curve at the transferred polar angles as defined by the user.
y.pred: the predicted y coordinates of the points on the Preston curve at the transferred polar angles as defined by the user.
Note
In the outputs, there are no x.stand.pred and x.pred, because y.stand.obs and y.stand.pred share the same x values (i.e., x.stand.obs), and y.obs and y.pred share the same x values (i.e., x.obs).
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")
Preston, F.W. (1953) The shapes of birds' eggs. The Auk 70, 160−182.
Shi, P., Chen, L., Quinn, B.K., Yu, K., Miao, Q., Guo, X., Lian, M., Gielis, J., Niklas, K.J. (2023) A simple way to calculate the volume and surface area of avian eggs. Annals of the New York Academy of Sciences 1524, 118−131. tools:::Rd_expr_doi("10.1111/nyas.15000")
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")
Shi, P., Wang, L., Quinn, B.K., Gielis, J. (2023) A new program to estimate the parameters of Preston's equation, a general formula for describing the egg shape of birds. Symmetry