mirror of https://github.com/msberends/AMR.git
61 lines
1.9 KiB
R
61 lines
1.9 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)
|
|
E <- ratio(x, "1:2:1")
|
|
E
|
|
# 780 1560 780
|
|
|
|
G <- g.test(x, p = c(1, 2, 1) / 4)
|
|
# G$p.value = 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)
|
|
g.test(x)
|
|
# 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}}
|
|
}
|