# dtr: Data transformations In reyzaguirre/st4gi: Statistical tools for genetic improvement

## Description

This function performs different data transformations.

## Usage

 ```1 2``` ```dtr(trait, type = c("none", "logy", "logy1", "sqrty", "sqrty1", "arcsin"), base = 10, n = NULL, data) ```

## Arguments

 `trait` The trait to transform. `type` The transformation type. See details. `base` Base for the logarithmic transformation. Base 10 by default. `n` Additional parameter for arc-sine transformation. See details. `data` The name of the data frame containing the data.

## Details

Available transformations are:

`none` for no transformation.

`logy` for the logarithmic transformation log(y). This transformation is recommended for data that follow a multiplicative instead of an additive model.

`logy1` for the logarithmic transformation log(y + 1). The same as the previous case, but when the data set includes small values (e.g. less than 10).

`sqrty` for the square root transformation sqrt(y). This transformation is recommended for count data, which typically follow a Poisson distribution where the variance is proportional to the mean. It is also recommended for percentage data where the range is between 0 and 20% or between 80 and 100%. However, note that for Poisson data a Poisson regression model could be a better option.

`sqrty1` for the square root transformation sqrt(y + 0.5). The same as the previous case but when most of the values in the data set are less than 10, especially if zeros are present.

`arcsin` for the arc-sine transformation arcsin(y^0.5). This transformation is recommended for data on proportions, which typically follow a binomial distribution. Data must lie between 0 and 1. Where the values of 0 or 1 are present, these should be substituted by 1/4n and 1-1/4n, where `n` is the denominator for the computation of the proportions. When the proportions are in the range 0.2 to 0.8 no transformation could be needed, and where some are on either the range 0 to 0.2 or 0.8 to 1 a square root transformation could be useful. Finally, Note that for binomial data, a binomial regression model could be a better option.

## Value

It returns the transformed trait.

Raul Eyzaguirre.

## Examples

 `1` ```dtr("nonc", "logy", data = pjpz09) ```

reyzaguirre/st4gi documentation built on July 17, 2018, 9:25 a.m.