Description Usage Format Source References Examples

Do female Platyfish prefer male Platyfish with yellow swordtails? A.L. Basolo proposed and tested a selection model in which females have a pre-existing bias for a male trait even before the males possess it. Six pairs of males were surgically given artificial, plastic swordtails—one pair received a bright yellow sword, the other a transparent sword. Females were given the opportunity to engage in courtship activity with either of the males. Of the total time spent by each female engaged in courtship during a 20 minute observation period, the percentages of time spent with the yellow-sword male were recorded.

1 |

A data frame with 84 observations on the following 3 variables.

- Percentage
The percentage of courtship time spent by 84 females with the yellow-sword males

- Pair
Factor variable with 6 levels—

`"Pair1"`

,`"Pair2"`

,`"Pair3"`

,`"Pair4"`

,`"Pair5"`

and`"Pair6"`

- Length
Body size of the males

Ramsey, F.L. and Schafer, D.W. (2013). *The Statistical Sleuth: A
Course in Methods of Data Analysis (3rd ed)*, Cengage Learning.

Basolo, A.L. (1990). Female Preference Predates the Evolution of the
Sword in Swordtail Fish, *Science* **250**: 808–810.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | ```
str(case0602)
attach(case0602)
## EXPLORATION
plot(Percentage ~ Length,
xlab="Length of the Two Males",
ylab="Percentage of Time Female Spent with Yellow-Sword Male",
main="Percentage of Time Spent with Yellow Rather than Transparent Sword Male")
abline(h=50) # Draw a horizontal line at 50% (i.e. the "no preference" line)
myAov <- aov(Percentage ~ Pair)
plot(myAov, which=1) # Resdiual plot
summary(myAov)
# Explore possibility of linear effect, as in Display 6.5
myAov2 <- aov(Percentage ~ Pair - 1) # Show the estimated means.
myContrast <- rbind(c(5, -3, 1, 3, -9, 3))
if(require(multcomp)){ # Use the multcomp library
myComparison <- glht(myAov2, linfct=myContrast)
summary(myComparison, test=adjusted("none"))
}
# Simpler exploration of linear effect, via regression (Ch. 7)
myLm <- lm(Percentage ~ Length)
summary(myLm)
# ONE-SAMPLE t-TEST THAT MEAN PERCENTAGE = 50%, IGNORING MALE PAIR EFFECT
t.test(Percentage, mu=50, alternative="greater") # Get 1-sided p-value
t.test(Percentage, alternative="two.sided") # Get C.I.
## SCATTERPLOT FOR PRESENTATION
plot(Percentage ~ Length,
xlab="Length of the Two Males (mm)",
ylab="Percentage of Time Female Spent with Yellow-Sword Male",
main="Female Preference for Yellow Rather than Transparent Sword Male",
pch=21, lwd=2, bg="green", cex=1.5 )
abline(h=50,lty=2,col="blue",lwd=2)
text(29.5,52,"50% (no preference)", col="blue")
detach(case0602)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.