Last data update: 2014.03.03
R: hiv
hiv
Description
A study of 47 patients with similar profiles. Measurements on cd4 and cd8 levels
are displayed for each panel of patients having identical predictor profiles. Both
cd4 and cd8 have three levels. The data should be modeled as a grouped logistic model,
but may also be modeled as a count model depending on what a research wishes to
determine from the data.
Usage
data(hiv)
Format
A data frame with 11 observations of grouped data with 4 variables.
infec
1=Patient diagnosed with HIV; 0=not diagnosed with HIV
cases
number of patients for each patient profile
cd4
3 levels: 0, 1, and 2
cd8
3 levels: 0, 1, and 2
Details
hiv is saved as a data frame.
Source
Hilbe, Practical Guide to Logistic Regression, Chapman & Hall/CRC.
References
Hilbe, Joseph M (2015), Practical Guide to Logistic Regression, Chapman & Hall/CRC.
Examples
# Not run
#data(hiv)
#table(hiv); hiv
#noinfec <- hiv$cases - hiv$infec
#myhiv<- glm(cbind(infec, noinfec) ~ factor(cd4) + factor#(cd8), family=binomial, data=hiv)
#summary(myhiv)
#mymodq <- glm( cbind(infec, noinfec) ~ factor(cd4) + factor(cd8), family=quasibinomial, data=hiv)
#summary(mymodq)
#toOR(myhiv)
#End(Not run)
library(LOGIT)
data(hiv)
table(hiv); hiv
noinfec <- hiv$cases - hiv$infec
response <- cbind(hiv$infec, noinfec)
myhiv<- glm(response ~ factor(cd4) + factor(cd8), family=binomial, data=hiv)
summary(myhiv)
mymodq <- glm(response ~ factor(cd4) + factor(cd8), family=quasibinomial, data=hiv)
summary(mymodq)
#library(sandwich)
#sqrt(diag(vcovHC(myhiv, type="HC0")))
toOR(myhiv)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(LOGIT)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/LOGIT/hiv.rd_%03d_medium.png", width=480, height=480)
> ### Name: hiv
> ### Title: hiv
> ### Aliases: hiv
> ### Keywords: datasets
>
> ### ** Examples
>
> # Not run
> #data(hiv)
> #table(hiv); hiv
> #noinfec <- hiv$cases - hiv$infec
> #myhiv<- glm(cbind(infec, noinfec) ~ factor(cd4) + factor#(cd8), family=binomial, data=hiv)
> #summary(myhiv)
> #mymodq <- glm( cbind(infec, noinfec) ~ factor(cd4) + factor(cd8), family=quasibinomial, data=hiv)
> #summary(mymodq)
> #toOR(myhiv)
> #End(Not run)
>
> library(LOGIT)
> data(hiv)
> table(hiv); hiv
, , cd4 = 0, cd8 = 0
cases
infec 1 2 3 4 5 8 13
0 0 0 1 0 0 0 0
1 0 0 0 1 0 0 0
, , cd4 = 1, cd8 = 0
cases
infec 1 2 3 4 5 8 13
0 0 0 0 0 1 0 0
1 0 1 0 0 0 0 0
, , cd4 = 2, cd8 = 0
cases
infec 1 2 3 4 5 8 13
0 0 1 0 0 0 0 0
1 0 0 0 0 0 0 0
, , cd4 = 0, cd8 = 1
cases
infec 1 2 3 4 5 8 13
0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0
, , cd4 = 1, cd8 = 1
cases
infec 1 2 3 4 5 8 13
0 0 0 0 0 0 1 0
1 0 0 0 1 0 0 0
, , cd4 = 2, cd8 = 1
cases
infec 1 2 3 4 5 8 13
0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0
, , cd4 = 0, cd8 = 2
cases
infec 1 2 3 4 5 8 13
0 0 0 0 0 0 0 0
1 1 0 0 0 0 0 0
, , cd4 = 1, cd8 = 2
cases
infec 1 2 3 4 5 8 13
0 0 0 0 0 0 0 0
1 0 1 0 0 0 0 0
, , cd4 = 2, cd8 = 2
cases
infec 1 2 3 4 5 8 13
0 0 1 0 0 0 0 0
1 1 0 0 0 0 0 0
infec cases cd4 cd8
1 0 3 0 0
2 0 8 1 1
3 0 2 2 2
4 0 5 1 0
5 0 2 2 0
6 0 13 2 1
7 1 1 0 2
8 1 2 1 2
9 1 4 0 0
10 1 4 1 1
11 1 1 2 2
12 1 2 1 0
> noinfec <- hiv$cases - hiv$infec
> response <- cbind(hiv$infec, noinfec)
> myhiv<- glm(response ~ factor(cd4) + factor(cd8), family=binomial, data=hiv)
> summary(myhiv)
Call:
glm(formula = response ~ factor(cd4) + factor(cd8), family = binomial,
data = hiv)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.1195 -1.0655 -0.4178 0.7837 1.6206
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.5730 0.9518 -1.653 0.0984 .
factor(cd4)1 -0.5334 1.3709 -0.389 0.6972
factor(cd4)2 -2.3701 1.8201 -1.302 0.1929
factor(cd8)1 -0.4740 1.5044 -0.315 0.7527
factor(cd8)2 2.9433 1.4680 2.005 0.0450 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 21.357 on 11 degrees of freedom
Residual deviance: 11.810 on 7 degrees of freedom
AIC: 28.034
Number of Fisher Scoring iterations: 5
>
> mymodq <- glm(response ~ factor(cd4) + factor(cd8), family=quasibinomial, data=hiv)
> summary(mymodq)
Call:
glm(formula = response ~ factor(cd4) + factor(cd8), family = quasibinomial,
data = hiv)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.1195 -1.0655 -0.4178 0.7837 1.6206
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -1.5730 1.2159 -1.294 0.237
factor(cd4)1 -0.5334 1.7513 -0.305 0.770
factor(cd4)2 -2.3701 2.3252 -1.019 0.342
factor(cd8)1 -0.4740 1.9219 -0.247 0.812
factor(cd8)2 2.9433 1.8754 1.569 0.161
(Dispersion parameter for quasibinomial family taken to be 1.631979)
Null deviance: 21.357 on 11 degrees of freedom
Residual deviance: 11.810 on 7 degrees of freedom
AIC: NA
Number of Fisher Scoring iterations: 5
>
> #library(sandwich)
> #sqrt(diag(vcovHC(myhiv, type="HC0")))
> toOR(myhiv)
or delta zscore pvalue exp.loci. exp.upci.
(Intercept) 0.2074 0.1974 -1.6526 0.0984 0.0321 1.3398
factor(cd4)1 0.5866 0.8042 -0.3891 0.6972 0.0399 8.6146
factor(cd4)2 0.0935 0.1701 -1.3022 0.1929 0.0026 3.3110
factor(cd8)1 0.6225 0.9365 -0.3151 0.7527 0.0326 11.8770
factor(cd8)2 18.9775 27.8595 2.0049 0.0450 1.0682 337.1512
>
>
>
>
>
> dev.off()
null device
1
>