library(MASS)
liver <- liver
liver$ndose <- as.numeric(liver$dose)
d <- data.frame(alt = resid(rlm(log(ALT.M) ~ log(ALT.B) + ndose, data=liver)),
ast = resid(rlm(log(AST.M) ~ log(AST.B) + ndose, data=liver)),
alp = resid(rlm(log(ALP.M) ~ log(ALP.B) + ndose, data=liver)),
tbl = resid(rlm(log(TBL.M) ~ log(TBL.B) + ndose, data=liver)))
Dgpds <- migpd(d[liver$dose == "D", 1:4], mqu=.7)
d$ndose <- liver$ndose
galt <- gpd(alt, data=d, qu=.7, xi = ~ ndose)
gast <- gpd(ast, data=d, qu=.7, xi = ~ ndose)
galp <- gpd(alp, data=d, qu=.7, xi = ~ ndose)
altco <- c(coef(galt), coef(galt)[2] + 4 * coef(galt)[3])
astco <- c(coef(gast), coef(gast)[2] + 4 * coef(gast)[3])
alpco <- c(coef(galp), coef(galp)[2] + 4 * coef(galp)[3])
Dgpd <- migpdCoefs(Dgpds, which=c("alt", "ast", "alp"),
coefs=list(altco, astco, alpco))
Run the code above in your browser using DataLab