nll_recovery_II {anovir} | R Documentation |

Function returning negative log-likelihood (nll) for patterns of survival in infected and uninfected treatments, when infected hosts can recover from infection and there is no background mortality.

```
nll_recovery_II(
a2 = a2,
b2 = b2,
a3 = a3,
b3 = b3,
data = data,
d2 = "",
d3 = ""
)
```

`a2` , `b2` |
location & scale parameters for mortality due to infection |

`a3` , `b3` |
location & scale parameters for how long infection 'survives' |

`data` |
a data.frame with the data |

`d2` , `d3` |
probability distributions for background mortality, mortality due to infection & how long infection 'survives' ("Weibull", "Gumbel", "Frechet") |

This model assumes all the hosts in an infected treatment are all initially infected, and they can all potentially recover from infection. Uninfected, infected and recovered hosts are assumed to not experience any background mortality during the period of the experiment. No assumptions are made as to whether recovered hosts are still infected or infectious. It is also assumed that the timing of recovery from infection is not directly observed, but and individual's infected/recovery status can be determined after they have died or been censored.

The probability that an infection 'survives' over time, i.e., the host does not recover from infection, is assumed to follow a probability distribution which acts independently of the probability distributions determining background mortality or mortality due to infection.

This function only estimates location and scale parameters as constants, it is not designed to estimate them as functions.

The nll function also requires the data to be specified in a specific format and requires columns detailing when and how many control individuals were right-censored, even though these individuals do not contribute to the nll estimated; see vignettes for details.

numeric

requires the data to be specified in a specific format; see vignette 'data format' for details

```
# NB the data to analyse needs to be in a data frame of a specific form
head(recovery_data_II)
# step #1: prepare nll function for analysis
m01_prep_function <- function(a2, b2, a3, b3){
nll_recovery_II(a2, b2, a3, b3,
data = recovery_data_II, # data_recovery_II,
d2 = "Weibull", d3 = "Weibull"
)}
# step #2: send 'prep_function' to mle2 for maximum likelihood estimation,
# specifying starting values
m01 <- mle2(m01_prep_function,
start = list(a2 = 2, b2 = 0.5, a3 = 2, b3 = 0.5)
)
summary(m01)
# values used to simulate data were for the Weibull distribution;
# a2 = 2.2, b2 = 0.35, a3 = 2.35, b3 = 0.35
```

[Package *anovir* version 0.1.0 Index]