# probeSmoothing

0th

Percentile

##### Compares, for a set of specified values of df and different smoothing methods, a response and the smooths of it, possibly along with growth rates calculated from the smooths

Takes a response and, for each individual, uses splitSplines to smooth its values for each individual using the degrees of freedom values in df. Provided get.rates is TRUE, both the Absolute Growth Rates (AGR) and the Relative Growth Rates (RGR) are calculated for each smooth, either using differences or first derivatives. A combination of the unsmoothed and smoothed values, as well as the AGR and RGR, can be plotted for each value in smoothing methods in combination with df. Note that the arguments that modify the plots apply to all plots that are produced. The handling of missing values is controlled via na.x.action and na.y.action

Keywords
manip, hplot
##### Usage
probeSmoothing(data, response = "Area", x = NULL, xname="xDays",
times.factor = "Days", individuals="Snapshot.ID.Tag",
na.x.action="exclude", na.y.action = "exclude",
df, smoothing.methods = "direct", correctBoundaries = FALSE,
get.rates = TRUE, rates.method="differences",
facet.x = "Treatment.1", facet.y =   "Smarthouse",
labeller = NULL, x.title = NULL,
colour = "black", colour.column=NULL,
colour.values=NULL, alpha = 0.1,
trait.types = c("response", "AGR", "RGR"),
propn.types = c(0.1, 0.5, 0.75), propn.note = TRUE,
which.plots = "smoothedonly",
deviations.plots = "none", alpha.med.devn = 0.5,
ggplotFuncs = NULL, ggplotFuncsMedDevn = NULL,
...)
##### Arguments
data

A data.frame containing the data.

response

A character specifying the response variable to be supplied to smooth.spline and that is to be plotted on the y-axis.

x

A character giving the variable to be plotted on the x-axis; it may incorporate an expression, it being that x may incorporate an expression. If x is NULL then xname is used.

xname

A character giving the name of the numeric that contains the values of the predictor variable to be supplied to smooth.spline and from which x is derived.

times.factor

A character giving the name of the column in data containing the factor for times at which the data was collected. Its levels will be used in calculating growth rates and should be numeric values stored as characters.

individuals

A character giving the name(s) of the factor(s) that define the subsets of the data for which each subset corresponds to the response values for an individual.

na.x.action

A character string that specifies the action to be taken when values of x are NA. The possible values are fail, exclude or omit. For exclude and omit, predictions and derivatives will only be obtained for nonmissing values of x. The difference between these two codes is that for exclude the returned data.frame will have as many rows as data, the missing values have been incorporated.

na.y.action

A character string that specifies the action to be taken when values of y, or the response, are NA. The possible values are fail, exclude, omit, allx, trimx, ltrimx or rtrimx. For all options, except fail, missing values in y will be removed before smoothing. For exclude and omit, predictions and derivatives will be obtained only for nonmissing values of x that do not have missing y values. Again, the difference between these two is that, only for exclude will the missing values be incorporated into the returned data.frame. For allx, predictions and derivatives will be obtained for all nonmissing x. For trimx, they will be obtained for all nonmissing x between the first and last nonmissing y values that have been ordered for x; for ltrimx and utrimx either the lower or upper missing y values, respectively, are trimmed.

df

A numeric specifying the set of degrees of freedom to be probed.

smoothing.methods

A character giving one or more methods to use for smoothing. Currently, the two possibilites are (i) "direct", for directly smoothing the observed response, and (ii) "logarithmic", for smoothing the log-transformed response, followed by taking exponentials of the fitted values to back-trasnform them.

correctBoundaries

A logical indicating whether the fitted spline values are to have the method of Huang (2001) applied to them to correct for estimation bias at the end-points. Note that if rates.method is set to "derivatives" then it is not possible to have correctBoundaries set to TRUE.

get.rates

A logical specifying whether or not the growth rates (AGR and RGR) are to be computed and stored.

rates.method

A character specifying the method to use in calculating the growth rates. The two possibilities are "differences" and "derivates".

facet.x

A data.frame giving the variable to be used to form subsets to be plotted in separate columns of plots. Use "." if a split into columns is not wanted. For which.plots set to methodscompare or dfcompare , facet.x is ignored.

facet.y

A data.frame giving the variable to be used to form subsets to be plotted in separate rows of plots. Use "." if a split into columns is not wanted.

labeller

A ggplot function for labelling the facets of a plot produced using the ggplot function. For more information see ggplot.

x.title

Title for the x-axis. If NULL then set to times.factor.

colour

A character specifying a single colour to use in drawing the lines for the profiles. If colouring according to the values of a variable is required then use colour.column.

colour.column

A character giving the name of a column in data over whose values the colours of the lines are to be varied. The colours can be specified using colour.values .

colour.values

A character vector specifying the values of the colours to use in drawing the lines for the profiles. If this is a named vector, then the values will be matched based on the names. If unnamed, values will be matched in order (usually alphabetical) with the limits of the scale.

alpha

A numeric specifying the degrees of transparency to be used in plotting. It is a ratio in which the denominator specifies the number of points (or lines) that must be overplotted to give a solid cover.

trait.types

A character giving the trait.types that are to be produced. One of more of response, AGR and RGR. If all, all three traits are produced. The unsmoothed growth rates are not calculated if only smoothed plots are requested.

propn.types

A numeric giving the proportion of the median values of each of the trait.types that are to be plotted in the compare.medians plots of the deviations of the observed values from the smoothed values. If set to NULL, the plots of the proprotions of the median values of the traits are omitted.

propn.note

A logical indicating whether a note giving the proportion of the median values plotted in the compare.medians plots.

which.plots

A character giving the plots that are to be produced. If none, no plots are produced. If smoothedonly, plots of the smoothed traits are plotted. If bothseparately, plots of the unsmoothed trait followed by the smoothed traits are produced for each trait. If methodscompare, a combined plot of the unsmoothed trait and the smoothed traits for each smoothing.methods is produced for each value of df. if dfcompare a combined plot of the smoothed trait for each df is produced for each smoothing.methods.

deviations.plots

A character specifying one or more of the absolute.boxplots, relative.boxplots deviations of the values of a trait from their smoothed values are to be produced (observed - smoothed). In additon, the option compare.medians results in a plot that compares the medians of the deviations over the times.factor for each combination of the smoothing.methods and the df. If none, no plots are produced. The argument trait.types controls the traits for which boxplots are produced.

alpha.med.devn

A numeric specifying the degrees of transparency to be used in plotting a median deviations plot. It is a ratio in which the denominator specifies the number of points (or lines) that must be overplotted to give a solid cover.

ggplotFuncs

A list, each element of which contains the results of evaluating a ggplot function. It is created by calling the list function with a ggplot function call for each element. Note that these functions are applied to all three plots produced.

ggplotFuncsMedDevn

A list, each element of which contains the results of evaluating a ggplot function. It is created by calling the list function with a ggplot function call for each element. Note that these functions are applied to the compare.median deviations plots only.

...

allows passing of arguments to plotLongitudinal.

##### Value

A data.frame containing individuals, times.factor, facet.x, facet.y, xname, response, and, for each df, the smoothed response, the AGR and the RGR. It is returned invisibly. The names of the new data are constructed by joining elements separated by full stops (.). In all cases, the last element is the value of df. For the smoothed response, the other elements are response and "smooth"; for AGR and RGR, the other elements are the name of the smoothed response and either "AGR" or "RGR".

splitSplines, splitContGRdiff, smooth.spline, ggplot.

##### Aliases
• probeSmoothing
##### Examples
# NOT RUN {
data(exampleData)
vline <- list(ggplot2::geom_vline(xintercept=20, linetype="longdash", size=1),
ggplot2::scale_x_continuous(breaks=seq(12, 36, by=2)))
probeSmoothing(data = longi.dat, response = "Area", df = c(4,7), x="xDays+24.16666667",
ggplotFuncs=vline)
# }

Documentation reproduced from package growthPheno, version 1.0-13, License: GPL (>= 2)

### Community examples

Looks like there are no examples yet.