View source: R/predict.moult.R
predict.moult | R Documentation |
Predict either the proportion of birds in a certain moult stage (as defined in intervals) on a specified day, the average moult score on a specified day, or start and/or duration of moult for given covariate patterns
## S3 method for class 'moult' predict(object, newdata, predict.type = "prob", intervals = 0.1, ...)
object |
moult model objects |
newdata |
optional dataframe with explanatory variables for which to make predictions. The first column must contain the days (as used when fitting) for which to make predictions. |
predict.type |
specifies form of predictions, see details. |
intervals |
length of moult categories for which probabilities/proportions should be calculated. The default (= 0.1) will calculate the probability that a bird will fall in this moult category on the specified day for each of the following categories: 0, (0, 0.1), [0.1, 0.2), [0.2, 0.3), ..., [0.9, 1.0), 1. |
... |
other arguments passed to the predict method |
predict.type
has the following options:
the average moult index (proportion of feather mass grown) for each of the days specified.
default, the proportion of birds in each of the moult categories as defined by intervals is predicted.
predicts the duration of moult
for the covariate combinations defined in newdata
,
with standard errors. If newdata
is not supplied, returns duration of baseline covariate set.
predicts the mean start date of moult
for the covariate combinations defined in newdata
,
with standard errors. If newdata
is not supplied, returns mean start date of baseline covariate set.
predicts both mean start date of moult and
duration of moult for the covariate combinations defined in
newdata
, with standard errors. Also, covariance of duration and start date estimates is given.
If newdata
is missing, the expected moult scores at the observed days are returned.
If predict.type = "response"
, the expected moult scores at the specified days are returned.
If predict.type = "prob"
a matrix of predicted probabilities for being in each of the moult categories defined by intervals.
If predict.type
equals "start" or "duration" or "both", the corresponding estimates (with standard errors) for each of the covariate patterns are returned.
Erni, B., Bonnevie, B. T., Oschadleus, H.-D., Altwegg, R. and Underhill, L. G. (2013) moult: An R package to analyze moult in birds. Journal of Statistical Software, 52(8), 1–23. https://www.jstatsoft.org/v52/i08/
Underhill, L. G. and Zucchini, W. (1988) A model for avian primary moult. Ibis 130, 358–372.
Underhill, L. G. and Zucchini, W. and Summers, R. W. (1990) A model for avian primary moult-data types based on migration strategies and an example using the Redshank Tringa totanus. Ibis 132, 118–123.
moult
data(weavers) ## convert moult scores to PFMG (proportion feather mass grown) mscores <- substr(weavers$Moult, 1, 9) feather.mass <- c(10.4, 10.8, 11.5, 12.8, 14.4, 15.6, 16.3, 15.7, 15.7) weavers$pfmg <- ms2pfmg(mscores, feather.mass) ## day of year starting 1 August weavers$day <- date2days(weavers$RDate, dateformat = "yyyy-mm-dd", startmonth = 8) weavers$ssex <- ifelse(weavers$Sex == 1 | weavers$Sex == 3, "male", ifelse(weavers$Sex == 2 | weavers$Sex == 4, "female", NA)) mmf <- moult(pfmg ~ day | ssex | ssex, data = weavers, type = 3) summary(mmf) ## predict duration and start of moult (then both) for males and females ssex <- c("male", "female") day <- 150 (p1 <- predict.moult(mmf, newdata = data.frame(day, ssex), predict.type = "duration")) (p2 <- predict.moult(mmf, newdata = data.frame(day, ssex), predict.type = "start")) (p3 <- predict.moult(mmf, newdata = data.frame(day, ssex), predict.type = "both"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.