project_points: project_points

View source: R/project_points.R

project_pointsR Documentation

project_points

Description

projects data points onto the curve defined by the model function

Usage

project_points(x, y, xylim, best.model, plot = door_default_values("plot"),
  points_cex = door_default_values("points.cex"),
  title = door_default_values("title"), ...)

Arguments

x, y

numeric vectors of data values, coordinate vectors of points to plot, the coordinates can contain NA values.

xylim

numeric vectors, x, y limits of the plot.

best.model

a list, containing the parameters, function, inverse function, Leibniz's notation for distance calculation and MD value. if missing, the best model will be generated automatically.

plot

logical, If FALSE, plotting is suppressed. Default is FALSE.

points_cex

a numerical value, giving the magnification level of symbols relative to the default size.

title

logical, If TRUE, title is shown. Default is FALSE.

...

further graphical parameters

Details

For internal use in the merging process (see also model_response). The model function is choosen by calculate_model. project_points then projects the data points from the datasets to be merged onto the curve defined by the model function. It computes the closest distance from a data point to a point on the curve by numerical optimisation.

A list with two data frames "double.observations" and "single.observations" is returned, which give the coordinates of double observations (defined as (x,y)) and coordinates of single observation (defined as (x,NA) or (NA,y)). Both data frames contain seven columns: "ID" indicating the original position of data x and y, "x", "y" indicating the coordinate of observation, "X", "Y" indicating the coordinate of projected point on the function, "distance" indicating the distances between (xmin, f(xmin)) and all points on the functional line, "NDR" indicating the normalized distances across all the distance values.

Author(s)

Shouwen Ma <shouwen.ma@uni-konstanz.de>

See Also

calculate_model, optimize, integrate

Examples

# load data
library(DoOR.data)
data(Or23a)

# normalize two example data sets
x <- door_norm(Or23a[,'Hallem.2004.EN'])
y <- door_norm(Or23a[,'Hallem.2006.EN'])

# find the best fitting function and project the remaining points (measured
# only in one of the data sets) onto the fit.
project_points(x = x, y = y, plot = TRUE)


ropensci/DoOR.functions documentation built on Feb. 22, 2024, 9:44 a.m.