mirror of https://github.com/msberends/AMR.git
65 lines
2.0 KiB
R
65 lines
2.0 KiB
R
% Generated by roxygen2: do not edit by hand
|
|
% Please edit documentation in R/g.test.R
|
|
\name{ratio}
|
|
\alias{ratio}
|
|
\title{Transform vector to ratio}
|
|
\usage{
|
|
ratio(x, ratio)
|
|
}
|
|
\arguments{
|
|
\item{x}{vector of values}
|
|
|
|
\item{ratio}{vector with ratios of \code{x} and with same length (like \code{ratio = c(1, 2, 1)}) or a text with characters \code{":"}, \code{"-"} or \code{","} (like \code{ratio = "1:2:1"} or even \code{ratio = "1:2:1.25"})}
|
|
}
|
|
\description{
|
|
Transform vector to ratio
|
|
}
|
|
\examples{
|
|
# = EXAMPLE 1 =
|
|
# Shivrain et al. (2006) crossed clearfield rice (which are resistant
|
|
# to the herbicide imazethapyr) with red rice (which are susceptible to
|
|
# imazethapyr). They then crossed the hybrid offspring and examined the
|
|
# F2 generation, where they found 772 resistant plants, 1611 moderately
|
|
# resistant plants, and 737 susceptible plants. If resistance is controlled
|
|
# by a single gene with two co-dominant alleles, you would expect a 1:2:1
|
|
# ratio.
|
|
|
|
x <- c(772, 1611, 737)
|
|
x.expected <- ratio(x, "1:2:1")
|
|
x.expected
|
|
# 780 1560 780
|
|
|
|
g.test(x, x.expected)
|
|
# p = 0.12574.
|
|
|
|
# There is no significant difference from a 1:2:1 ratio.
|
|
# Meaning: resistance controlled by a single gene with two co-dominant
|
|
# alleles, is plausible.
|
|
|
|
|
|
# = EXAMPLE 2 =
|
|
# Red crossbills (Loxia curvirostra) have the tip of the upper bill either
|
|
# right or left of the lower bill, which helps them extract seeds from pine
|
|
# cones. Some have hypothesized that frequency-dependent selection would
|
|
# keep the number of right and left-billed birds at a 1:1 ratio. Groth (1992)
|
|
# observed 1752 right-billed and 1895 left-billed crossbills.
|
|
|
|
x <- c(1752, 1895)
|
|
x.expected <- ratio(x, ratio = c(1, 1))
|
|
x.expected
|
|
# 1823.5 1823.5
|
|
|
|
g.test(x, x.expected)
|
|
# p = 0.01787343
|
|
|
|
# There is a significant difference from a 1:1 ratio.
|
|
# Meaning: there are significantly more left-billed birds.
|
|
|
|
}
|
|
\references{
|
|
McDonald, J.H. 2014. \strong{Handbook of Biological Statistics (3rd ed.)}. Sparky House Publishing, Baltimore, Maryland.
|
|
}
|
|
\seealso{
|
|
\code{\link{g.test}}
|
|
}
|