GP.fit: Fit Gaussian process curves to species data

Description Usage Arguments Value Examples

View source: R/phylocurve.R

Description

Transforms raw data into regression curves using the GP_fit function in the GPfit package. The response data can be constrained between minima and maxima (for example, the default sets any negative predicted y value to 0).

Usage

1
2
GP.fit(data, x_variable, y_variable, min_x = -Inf, max_x = Inf,
  min_y = 0, max_y = Inf, eval_length = 30, ...)

Arguments

data

Data frame with function-valued species data along with a column named "species"

x_variable

The name of the column in data corresponding to the predictor (x) variable

y_variable

The name of the column in data corresponding to the response (y) variable

min_x

Lower range to remove from raw x data

max_x

Upper range to remove from raw x data

min_y

Lower range to remove from predicted response (for example, for response data in which only positive values are allowed, the min_y can be set to 0 (the default)).

max_y

Upper range to remove from predicted response.

eval_length

How many points to evaluate along the range of x.

...

Optional further arguments to pass to the GP_fit function.

Value

X

X (formatted for phylocurve.generalized)

Y

Y (formatted for phylocurve.generalized)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
x_length <- 50
nspecies <- 25
sim_data <- sim.curves(nspecies = nspecies,x_length = x_length)

# Fit nonlinear curves to raw data
# NOT RUN (takes several minutes)
#curve_data <- GP.fit(data = sim_data$data,x_variable = "x",y_variable = "y",min_y = 0)

# Align curve data using dynamic time warping
# P <- phylocurve.generalized(tree = sim_data$tree,X = curve_data$X,Y = curve_data$Y)

phylocurve documentation built on Dec. 16, 2019, 1:35 a.m.