In this vignette, the fullfact
package is explored using
simple (functions designated by no number) for the standard model,
i.e. containing random effects for dam, sire, and dam by sire, for
non-normal error structures (e.g. binary, proportion, and/or count data
types).
Advanced (functions designated by the number 2) for the standard model with the options of including additional random effects for one position (e.g. tank) and/or one block effect (e.g. several blocks of 2 \(\times\) 2 factorial matings) is explored in the vignette Advanced Non-Normal Data Example.
Expert (functions designated by the number 3) for the standard model with the ability of the user to include additional fixed and/or random effects, such as a model including environment treatments and their interactions is explored in the vignette Expert Non-Normal Data Example.
Normal error structure or data type is explored in another three vignettes: (1) Simple Normal Data Example, (2) Advanced Normal Data Example, and (3) Expert Normal Data Example.
The example data set is an 11 \(\times\) 11 full factorial mating: 11 dams and 11 sires with all combinations resulting in 121 families. There are two replicates per family.
library("fullfact")
data(chinook_survival)
head(chinook_survival)
#> family repli dam sire tray cell alive dead egg_size
#> 1 f1 r1 d1 s1 t7 1A 136 14 7.27
#> 2 f1 r2 d1 s1 t8 1A 146 4 7.27
#> 3 f2 r1 d1 s2 t7 1B 128 22 7.27
#> 4 f2 r2 d1 s2 t8 1B 132 18 7.27
#> 5 f3 r1 d1 s3 t7 1C 142 8 7.27
#> 6 f3 r2 d1 s3 t8 1C 144 6 7.27
Displayed are columns for family identities (ID), replicate ID, dam ID, sire ID, incubation tray ID, incubation cell ID (within tray), Chinook salmon number of offspring alive, number of offspring dead, and dam egg size (mm). The total number of offspring per family is 300 with 150 per replicate.
For data that were recorded at the replicate-level, such as the number of offspring dead or alive for survival in the example data set, these data should be converted to the individual-level to not underestimate phenotypic variance and influence variance component estimates (see Puurtinen et al. 2009).
Puurtinen M, Ketola T, Kotiaho JS. 2009. The good-genes and compatible-genes benefits of mate choice. The American Naturalist 174(5): 741-752. DOI: 10.1086/606024
The buildBinary
function can assign a binary number
(i.e. ‘0’ or ‘1’) to two columns containing the number of offspring and
copy information by the number of times equal to the number of
offspring. The final data set will have a number of rows matching the
total number of offspring.
one
is the column name of counts to assign a ‘1’ value,
e.g. alive. zero
is the column name of counts to assign a
‘0’ value, e.g. dead.
copy
is a vector of column numbers (to copy the
contents). Does not need to contain the one and zero column names.
The buildMulti
function is similar and can assign
multiple numbers to multiple columns. multi
is a list
containing the numbers to assign and matching column names,
e.g. list(c(2,1,0),c(“black”,“gray”,“white”)).
chinook_survival2<- buildBinary(dat=chinook_survival,copy=c(1:6,9),one="alive",zero="dead")
rm(chinook_survival) #remove original
head(chinook_survival2)
#> status family repli dam sire tray cell egg_size
#> 1 1 f1 r1 d1 s1 t7 1A 7.27
#> 1.1 1 f1 r1 d1 s1 t7 1A 7.27
#> 1.2 1 f1 r1 d1 s1 t7 1A 7.27
#> 1.3 1 f1 r1 d1 s1 t7 1A 7.27
#> 1.4 1 f1 r1 d1 s1 t7 1A 7.27
#> 1.5 1 f1 r1 d1 s1 t7 1A 7.27
#Multinomial example
#>chinook_survival$total<- chinook_survival$alive + chinook_survival$dead
#>chinook_survival3<- buildMulti(dat=chinook_survival,copy=c(1:6,9),multi=list(c(2,1,0),
#>c("total","alive","dead")))
#>head(chinook_survival3)
A new column is produced named “status” containing the 1 and 0 values
for the offspring. The “alive” and “dead” columns are not included
because their column numbers (7 and 8) were not in
copy
.
Model random effects are dam, sire, and dam by sire. Extracts the dam, sire, dam, and dam by sire variance components. Calculates the residual and total variance component. Calculates the additive genetic, non-additive genetic, and maternal variance components.
The residual variance component for the binomial and Poisson error structures with four links are described by Nakagawa and Schielzeth (2010, 2013). Specifically, the residual variance component for binomial errors with the logit link is \(\pi\)2/3; binomial errors with the probit link is 1; Poisson errors with the log link is ln(1/exp(\(\beta\)0) + 1), where \(\beta\)0 is the intercept value from the model without any fixed effects and containing only the random effects; and Poisson errors with the square-root link is 0.25.
Assuming the effects of epistasis are of negligible importance, the additive genetic variance (VA) component is calculated as four times the sire (VS), the non-additive genetic variance (VN) component as four times the dam by sire interaction (VD\(\times\)S), and the maternal variance component (VM) as the dam (VD) – sire (VS) (Lynch and Walsh 1998, p. 603). When there is epistasis, those variance components will be overestimated and this may explain why the percentage of phenotypic variance explained by the components can add up to more than 100% in certain cases.
fam_link
is the family and link in family(link) format.
Supported options are binomial(link=“logit”), binomial(link=“probit”),
poisson(link=“log”), and poisson(link=“sqrt”). Binary or proportion data
are typically analyzed with binomial. Count data are typically analyzed
with Poisson.
Default in quasi = F
. Option for overdispersion or
quasi-error structure is quasi = T
, such that an
observation-level random effect is added to the model (Atkins et
al. 2013).
Significance values for the random effects are determined using likelihood ratio tests (Bolker et al. 2009).
Atkins DC, Baldwin SA, Zheng C, Gallop RJ, Neighbors C. 2013. A tutorial on count regression and zero-altered count models for longitudinal substance use data. Psychology of Addictive Behaviors 27(1): 166-177. DOI: 10.1037/a0029508
Nakagawa S, Schielzeth H. 2010. Repeatability for Gaussian and non-Gaussian data: a practical guide for biologists. Biological Reviews 85(4): 935-956. DOI: 10.1111/j.1469-185X.2010.00141.x
Nakagawa S, Schielzeth H. 2013. A general and simple method for obtaining R2 from generalized linear mixed-effects models. Methods in Ecology and Evolution 4(2): 133-142. DOI: 10.1111/j.2041-210x.2012.00261.x
Lynch M, Walsh B. 1998. Genetics and Analysis of Quantitative Traits. Sinauer Associates, Massachusetts.
Bolker BM, Brooks ME, Clark CJ, Geange SW, Poulsen JR, Stevens MHH, White J-SS. 2009. Generalized linear mixed models: a practical guide for ecology and evolution. Trends in Ecology and Evolution 24(3): 127-135. DOI: 10.1016/j.tree.2008.10.008
survival_mod1<- observGlmer(observ=chinook_survival2,dam="dam",sire="sire",response="status",
fam_link=binomial(link="logit"))
#> [1] "2024-01-27 12:52:59 PST"
#> Time difference of 30.96896 secs
survival_mod1
#> $random
#> effect variance percent d.AIC d.BIC Chi.sq p.value
#> 1 dam:sire 0.1672992 3.788017 636.18699 627.68742 638.18699 8.284084e-141
#> 2 sire 0.1663689 3.766952 44.34824 35.84867 46.34824 9.899641e-12
#> 3 dam 0.7930022 17.955288 145.47110 136.97153 147.47110 6.190795e-34
#>
#> $other
#> component variance percent
#> 1 Residual 3.289868 74.48974
#> 2 Total 4.416538 100.00000
#>
#> $calculation
#> component variance percent
#> 1 additive 0.6654755 15.06781
#> 2 nonadd 0.6691968 15.15207
#> 3 maternal 0.6266333 14.18834
Produces a list object containing three data frames. Each data frame contains the raw variance components and the variance components as a percentage of the total variance component. The first data frame also contains the difference in AIC and BIC, and likelihood ratio test Chi-square and p-value for all random effects.
Note
The Laplace approximation is used because there were fewer disadvantages relative to penalized quasi-likelihood and Gauss-Hermite quadrature parameter estimation (Bolker et al. 2009). That is, penalized quasi-likelihood is not recommended for count responses with means less than 5 and binary responses with less than 5 successes per group. Gauss-Hermite quadrature is not recommended for more than two or three random effects because of the rapidly declining analytical speed with the increasing number of random effects.
Power values are calculated by stochastically simulating data for a number of iterations and then calculating the proportion of P-values less than \(\alpha\) (e.g. 0.05) for each component (Bolker 2008). Simulated data are specified by inputs for variance component values and the sample sizes.
Bolker BM. 2008. Ecological Models and Data in R. Princeton University Press, Princeton.
Defaults are alpha = 0.05
for 5% and
nsim = 100
for 100 simulations.
varcomp
is a vector of dam, sire, and dam by sire
variance components, i.e. c(dam,sire,dam \(\times\) sire).
nval
is a vector of dam, sire, and offspring per family
sample sizes, i.e. c(dam,sire,offspring).
poisLog
is the residual variance component value if
using fam_link = poisson(link="log")
.
For this example, the variance components of observGlmer
above are used (i.e. dam= 0.7930, sire= 0.1664, dam \(\times\) sire= 0.1673) and the sample size
of the Chinook salmon data set (i.e. dam= 11, sire= 11, offspring=
300).
Full analysis is 100 simulations. Example has 2 simulations.
#full
#>powerGmer(varcomp=c(0.7930,0.1664,0.1673),nval=c(11,11,300),fam_link=binomial(link="logit"))
#2 simulations
powerGlmer(varcomp=c(0.7930,0.1664,0.1673),nval=c(11,11,300),fam_link=binomial(link="logit"),
nsim=2)
#> [1] "2024-01-27 12:53:30 PST"
#> [1] "Starting simulation: 1"
#> [1] "Starting simulation: 2"
#> Time difference of 1.242354 mins
#> term n var_in var_out power
#> 1 dam 11 0.793000 1.12463714 1
#> 2 sire 11 0.166400 0.06975906 1
#> 3 dam.sire 121 0.167300 0.17052095 1
#> 4 residual NA 3.289868 3.28986813 NA
There is sufficient power (\(\ge\) 0.8) for dam, sire, and dam by sire variance components. In the cases of insufficient power (< 0.8), the sample size of dam, sire, and/or offspring can be increased until there is sufficient power.
Taking the reverse approach (can the sample size of dam, sire, or offspring be reduced while maintaining sufficient power?) using the same variance components and offspring sample size, dam and sire sample sizes could be reduced from 11 to 7.
#full
#>powerGlmer(varcomp=c(0.7930,0.1664,0.1673),nval=c(7,7,300),fam_link=binomial(link="logit"))
#2 simulations
powerGlmer(varcomp=c(0.7930,0.1664,0.1673),nval=c(7,7,300),fam_link=binomial(link="logit"),
nsim=2)
#> [1] "2024-01-27 12:54:44 PST"
#> [1] "Starting simulation: 1"
#> [1] "Starting simulation: 2"
#> Time difference of 29.88938 secs
#> term n var_in var_out power
#> 1 dam 7 0.793000 0.7439084 1.0
#> 2 sire 7 0.166400 0.1805645 0.5
#> 3 dam.sire 49 0.167300 0.1774831 1.0
#> 4 residual NA 3.289868 3.2898681 NA
Confidence intervals for the additive genetic, non-additive genetic, and maternal variance components can be produced using the bootstrap-t resampling method described by Efron and Tibshirani (1993, p. 160‒162). Observations are resampled with replacement until the original sample size is reproduced. The resampled data are then used in the model and the additive genetic, non-additive genetic, and maternal variance components are extracted. The process is repeated for a number of iterations, typically 1,000 times, to produce a distribution for each component. The confidence interval lower and upper limits and median are extracted from the distribution.
Efron B, Tibshirani R. 1993. An Introduction to the Bootstrap. Chapman and Hall, New York.
The resampRepli
function is used to bootstrap resample
observations grouped by replicate ID within family ID for a specified
number of iterations to create the resampled data set. A similar
resampFamily
function is able to resample observations
grouped by family ID only.
copy
is a vector of column numbers (to copy the
contents). Does not need to contain the family and/or replicate
columns.
Full analysis is 1000 iterations. Example has 2 iterations.
#>resampRepli(dat=chinook_survival2,copy=c(1,4:8),family="family",replicate="repli",iter=1000) #full
#>resampFamily(dat=chinook_survival2,copy=c(1,4:8),family="family",iter=1000) #family only
resampRepli(dat=chinook_survival2,copy=c(1,4:8),family="family",replicate="repli",iter=2) #2 iterations
Because of the large file sizes that can be produced, the resampling of each replicate Y per family X is saved separately as a common separated (X_Y_resampR.csv) file in the working directory. These files are merged to create the final resampled data set (resamp_datR.csv).
If using resampFamily
, the file names are X_resampF.csv
per family and resamp_datF.csv for the final resampled data set.
The equivalent to observGlmer
is available for the final
bootstrap resampled data set, i.e. resampGlmer
.
Default is no overdispersion as quasi = F
. The starting
model number start =
and ending model number
end =
need to be specified.
Full analysis is 1000 iterations. Example has 2 iterations.
#>survival_datR<- read.csv("resamp_datR.csv") #1000 iterations
#>survival_rcomp1<- resampGlmer(resamp=survival_datR,dam="dam",sire="sire",response="status",
#>fam_link=binomial(link="logit"),start=1,end=1000) #full
data(chinook_resampS) #5 iterations
head(chinook_resampS)
#> status1 dam1 sire1 tray1 cell1 egg_size1 status2 dam2 sire2 tray2 cell2 egg_size2 status3 dam3 sire3 tray3 cell3
#> 1 1 d1 s1 t7 1A 7.27 1 d1 s1 t7 1A 7.27 1 d1 s1 t7 1A
#> 2 1 d1 s1 t7 1A 7.27 0 d1 s1 t7 1A 7.27 1 d1 s1 t7 1A
#> 3 1 d1 s1 t7 1A 7.27 0 d1 s1 t7 1A 7.27 1 d1 s1 t7 1A
#> 4 1 d1 s1 t7 1A 7.27 1 d1 s1 t7 1A 7.27 1 d1 s1 t7 1A
#> 5 1 d1 s1 t7 1A 7.27 1 d1 s1 t7 1A 7.27 1 d1 s1 t7 1A
#> 6 0 d1 s1 t7 1A 7.27 1 d1 s1 t7 1A 7.27 1 d1 s1 t7 1A
#> egg_size3 status4 dam4 sire4 tray4 cell4 egg_size4 status5 dam5 sire5 tray5 cell5 egg_size5
#> 1 7.27 1 d1 s1 t7 1A 7.27 1 d1 s1 t7 1A 7.27
#> 2 7.27 1 d1 s1 t7 1A 7.27 1 d1 s1 t7 1A 7.27
#> 3 7.27 1 d1 s1 t7 1A 7.27 1 d1 s1 t7 1A 7.27
#> 4 7.27 1 d1 s1 t7 1A 7.27 1 d1 s1 t7 1A 7.27
#> 5 7.27 1 d1 s1 t7 1A 7.27 1 d1 s1 t7 1A 7.27
#> 6 7.27 1 d1 s1 t7 1A 7.27 1 d1 s1 t7 1A 7.27
survival_rcomp1<- resampGlmer(resamp=chinook_resampS,dam="dam",sire="sire",response="status",
fam_link=binomial(link="logit"),start=1,end=2)
#> [1] "2024-01-27 12:55:14 PST"
#> [1] "Working on model: 1"
#> [1] "Working on model: 2"
#> Time difference of 28.32587 secs
survival_rcomp1[1:2,]
#> dam:sire sire dam Residual Total additive nonadd maternal
#> 1 0.1913448 0.1717893 0.7811000 3.289868 4.434102 0.6871571 0.7653792 0.6093107
#> 2 0.1781822 0.1658551 0.7894992 3.289868 4.423405 0.6634202 0.7127289 0.6236441
The function provides a data frame with columns containing the raw variance components for dam, sire, dam by sire, residual, total, additive genetic, non-additive genetic, and maternal. The number of rows in the data frame matches the number of iterations in the resampled data set and each row represents a model number.
Extract the bootstrap-t confidence intervals (CI) and median for the
additive genetic, non-additive genetic, and maternal values from the
data frame of models produced using resampGlmer
.
Default confidence interval is 95% as level = 95
.
#>ciMANA(comp=survival_rcomp1) #full
data(chinook_bootS) #same as survival_rcomp1 1000 models
ciMANA(comp=chinook_bootS)
#> $raw
#> component lower median upper
#> 1 additive 0.575 0.672 0.764
#> 2 nonadd 0.660 0.766 0.872
#> 3 maternal 0.576 0.635 0.694
#>
#> $percentage
#> component lower median upper
#> 1 additive 13.0 15.1 17.1
#> 2 nonadd 14.9 17.2 19.6
#> 3 maternal 13.1 14.3 15.4
The raw values are presented and are converted to a percentage of the
total variance for each model. Defaults are the number of decimal places
to round CI raw values as rnd_r = 3
and to round the CI
percent values as rnd_p = 1
.
The bootstrap-t method may produce medians that are largely different from the observed values. In the present example, the raw 95% CI are a good fit to the observed values. Nonetheless, options are provided below for 95% CI that are a poor fit.
The BCa method (bias and acceleration) described by Efron and Tibshirani (1993, p.184‒188) can be used for the correction of bootstrap-t confidence intervals.
bias
is a vector of additive, non-additive, and maternal
variance components, i.e. c(additive,non-additive,maternal), from the
raw observed variance components of observGlmer
.
The raw variance components from observGlmer
above were
additive= 0.6655, non-additive= 0.6692, and maternal= 0.6266.
ciMANA(comp=chinook_bootS,bias=c(0.6655,0.6692,0.6266)) #bias only
#> $raw
#> component lower median upper
#> 1 additive 0.563 0.661 0.752
#> 2 nonadd 0.616 0.619 0.686
#> 3 maternal 0.565 0.620 0.677
#>
#> $percentage
#> component lower median upper
#> 1 additive 12.8 14.8 16.8
#> 2 nonadd 14.1 14.1 15.5
#> 3 maternal 12.8 14.0 15.1
#>ciMANA(comp=survival_rcomp1,bias=c(0.6655,0.6692,0.6266)) #full
accel
for acceleration correction uses the delete-one
observation jackknife data set. In this example delete-30 observations
is used because of the large data set; see the next section.
data(chinook_jackS) #delete-30
ciMANA(comp=chinook_bootS,bias=c(0.6655,0.6692,0.6266),accel=chinook_jackS) #bias and acceleration
#> $raw
#> component lower median upper
#> 1 additive 0.563 0.661 0.752
#> 2 nonadd 0.616 0.619 0.686
#> 3 maternal 0.565 0.620 0.677
#>
#> $percentage
#> component lower median upper
#> 1 additive 12.8 14.8 16.8
#> 2 nonadd 14.1 14.1 15.5
#> 3 maternal 12.8 14.0 15.1
#>ciMANA(comp=survival_rcomp1,bias=c(0.6655,0.6692,0.6266),accel=survival_jack1) #full
Jackknife resampling is another method for producing confidence intervals.
The equivalent to observGlmer
is available for jackknife
resampling, i.e. JackGlmer
, using the observed data
frame.
Default is delete-one jackknife resampling as size = 1
and no overdispersion as quasi = F
.
Because the delete-one observation jackknife resampling may be
computationally intensive for large data sets, such as the Chinook
salmon survival data set, the JackGlmer
function has the
option of delete-d observation jackknife resampling, for which d > 1.
The rows of the observed data frame are shuffled and a block of
observations of size d is deleted sequentially. For the example,
delete-30 observation jackknife resampling is specified as
size = 30
, which deletes a block of 30 observations. Thirty
observation was selected such that M is close to 1,000 (see below).
Full analysis uses all observations. Example has the first 2 observations.
#full
#>survival_jack1<- JackGlmer(observ=chinook_survival2,dam="dam",sire="sire",response="status",
#>fam_link=binomial(link="logit"),size=30)
#first 2
survival_jack1<- JackGlmer(observ=chinook_survival2,dam="dam",sire="sire",response="status",
fam_link=binomial(link="logit"),size=30,first=2)
#> [1] "2024-01-27 12:55:43 PST"
#> [1] "Removing block: 1 of 1210"
#> [1] "Removing block: 2 of 1210"
#> Time difference of 28.7279 secs
survival_jack1[1:2,]
#> dam:sire sire dam Residual Total additive nonadd maternal
#> 1 0.1671977 0.1661277 0.794096 3.289868 4.417290 0.6645108 0.6687909 0.6279683
#> 2 0.1673927 0.1660495 0.792224 3.289868 4.415534 0.6641981 0.6695709 0.6261744
Extract the jackknife confidence intervals (CI) and median for the
additive genetic, non-additive genetic, and maternal values from the
data frame of models produced using JackGlmer
.
The mean and the standard error of pseudo-values for each variance component are calculated (Efron and Tibshirani 1993, p.184‒188). The standard error is then used with the Student’s t distribution to provide the lower and upper limits for the confidence interval. For delete-d jackknife resampling, M degrees of freedom were used for producing the confidence interval (Martin et al. 2004): M = N / d, where N is the total number of observations and d is the number of deleted observations. Large values of M, such as 1,000, can translate to the delete-d jackknife resampling method approaching bootstrap resampling expectations (Efron and Tibshirani 1993, p. 149).
Martin, H., Westad, F. & Martens, H. (2004). Improved Jackknife Variance Estimates of Bilinear Model Parameters. COMPSTAT 2004 – Proceedings in Computational Statistics 16th Symposium Held in Prague, Czech Republic, 2004 (ed J. Antoch), pp. 261-275. Physica-Verlag HD, Heidelberg.
Default confidence interval is 95% as level = 95
.
full
is a vector of additive, non-additive, maternal,
and total variance components,
i.e. c(additive,non-additive,maternal,total), from the raw observed
variance components of observGlmer
.
The raw variance components of observGlmer
were
additive= 0.6655, non-additive= 0.6692, maternal= 0.6266, and total=
4.4166.
data(chinook_jackS) #same as survival_jack1, all observations, delete-30
ciJack(comp=chinook_jackS,full=c(0.6655,0.6692,0.6266,4.4166))
#> $raw
#> component lower mean upper
#> 1 additive 0.570 0.662 0.755
#> 2 nonadd 0.554 0.657 0.761
#> 3 maternal 0.529 0.584 0.638
#>
#> $percentage
#> component lower mean upper
#> 1 additive 12.8 14.8 16.8
#> 2 nonadd 12.5 14.7 16.9
#> 3 maternal 12.0 13.1 14.1
#full, all observations
#>ciJack(comp=survival_jack1,full=c(0.6655,0.6692,0.6266,4.4166))
The raw values are presented and are converted to a percentage of the
total variance for each model. Defaults are the number of decimal places
to round CI raw values as rnd_r = 3
and to round the CI
percent values as rnd_p = 1
.
The barMANA
and boxMANA
functions are
simple plotting functions for the confidence intervals or all values,
respectively, from the bootstrap and jackknife approaches. Default is to
display the percentage values as type = perc
. Raw values
can be displayed as type = raw
.
Within the functions, there are simple plot modifications available.
For the y-axis, min and max values can be species as ymin
and ymax
, as well as the increment as yunit
.
Also, magnification of the axis unit as cex_yaxis
and label
as cex_ylab
. The position of the legend can be specified as
leg
. Default is “topright”.
The barMANA
function produces bar graphs with the
bootstrap-t median (ciMANA
) or jackknife pseudo-value mean
(ciJack
) as the top of the shaded bar and error bars
covering the range of the confidence interval for each of the additive
genetic, non-additive genetic, and maternal values of a phenotypic
trait.
The length of the error bar can be specified in inches as
bar_len
.
survival_ci<- ciJack(comp=chinook_jackS,full=c(0.6655,0.6692,0.6266,4.4166))
oldpar<- par(mfrow=c(2,1))
barMANA(ci_dat=survival_ci) #basic, top
barMANA(ci_dat=survival_ci,bar_len=0.3,yunit=4,ymax=20,cex_ylab=1.3) #modified, bottom
Different traits can also be combined on the same bar plot using
trait
specified in ciMANA
or
ciJack
. The information is combined into a list object. For
the example, the jackknife CI is duplicated to simulate ‘different
traits’.
survival_ci1<- ciJack(comp=chinook_jackS,full=c(0.6655,0.6692,0.6266,4.4166),trait="survival_1")
survival_ci2<- ciJack(comp=chinook_jackS,full=c(0.6655,0.6692,0.6266,4.4166),trait="survival_2")
comb_bar<- list(raw=rbind(survival_ci1$raw,survival_ci2$raw),
percentage=rbind(survival_ci1$percentage,survival_ci2$percentage))
barMANA(ci_dat=comb_bar,bar_len=0.3,yunit=4,ymax=20,cex_ylab=1.3)
The legend is slightly off in the presented html version but is fine with the R plotting device.
The boxMANA
function produces box plots using all values
for the bootstrap-t resampling data set (resampGlmer
) or
jackknife resampling data set (JackGlmer
).
oldpar<- par(mfrow=c(2,1))
boxMANA(comp=chinook_bootS) #from resampGlmer, basic, top
boxMANA(comp=chinook_bootS,yunit=2,ymin=10,ymax=22,cex_ylab=1.3,leg="topleft") #modified, bottom
Different traits can also be combined on the same box plot by adding a “trait” column to the resampling data set. For the example, the bootstrap-t data frame is duplicated to simulate ‘different traits’.
chinook_bootS1<- chinook_bootS; chinook_bootS2<- chinook_bootS #from resampGlmer
chinook_bootS1$trait<- "survival_1"; chinook_bootS2$trait<- "survival_2"
comb_boot<- rbind(chinook_bootS1,chinook_bootS2)
comb_boot$trait<- as.factor(comb_boot$trait)
boxMANA(comb_boot,yunit=2,ymin=10,ymax=22,cex_ylab=1.3,leg="topleft")
The recommended follow-up vignette is the Advanced Non-Normal Data Example, covering the standard model with the options of including additional random effects for one position (e.g. tank) and/or one block effect (e.g. several blocks of 2 \(\times\) 2 factorial matings).