Description Usage Arguments Details Author(s) References Examples
View source: R/binomial.twostage.R
The pairwise pairwise odds ratio model provides an alternative to the alternating logistic regression (ALR).
1 2 3 4 5 6 | binomial.twostage(margbin, data = sys.parent(), score.method = "nlminb",
Nit = 60, detail = 0, clusters = NULL, silent = 1, weights = NULL,
control = list(), theta = NULL, theta.des = NULL, var.link = 1,
iid = 1, step = 0.5, notaylor = 1, model = "plackett",
marginal.p = NULL, strata = NULL, max.clust = NULL,
se.clusters = NULL, numDeriv = 0)
|
margbin |
Marginal binomial model |
data |
data frame |
score.method |
Scoring method |
Nit |
Number of iterations |
detail |
Detail |
clusters |
Cluster variable |
silent |
Debug information |
weights |
Weights for log-likelihood, can be used for each type of outcome in 2x2 tables. |
control |
Optimization arguments |
theta |
Starting values for variance components |
theta.des |
Variance component design |
var.link |
Link function for variance |
iid |
Calculate i.i.d. decomposition |
step |
Step size |
notaylor |
Taylor expansion |
model |
model |
marginal.p |
vector of marginal probabilities |
strata |
strata for fitting: considers only pairs where both are from same strata |
max.clust |
max clusters |
se.clusters |
clusters for iid decomposition for roubst standard errors |
numDeriv |
uses Fisher scoring aprox of second derivative if 0, otherwise numerical derivatives |
The reported standard errors are based on a cluster corrected score equations from the pairwise likelihoods assuming that the marginals are known. This gives correct standard errors in the case of the Plackett distribution (OR model for dependence), but incorrect standard errors for the Clayton-Oakes types model.
Thomas Scheike
Two-stage binomial modelling
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | data(twinstut)
twinstut0 <- subset(twinstut, tvparnr<2300000)
twinstut <- twinstut0
theta.des <- model.matrix( ~-1+factor(zyg),data=twinstut)
margbin <- glm(stutter~factor(sex)+age,data=twinstut,family=binomial())
bin <- binomial.twostage(margbin,data=twinstut,
clusters=twinstut$tvparnr,theta.des=theta.des,detail=0,
score.method="fisher.scoring")
summary(bin)
twinstut$cage <- scale(twinstut$age)
theta.des <- model.matrix( ~-1+factor(zyg)+cage,data=twinstut)
bina <- binomial.twostage(margbin,data=twinstut,
clusters=twinstut$tvparnr,theta.des=theta.des,detail=0,
score.method="fisher.scoring")
summary(bina)
theta.des <- model.matrix( ~-1+factor(zyg)+factor(zyg)*cage,data=twinstut)
bina <- binomial.twostage(margbin,data=twinstut,
clusters=twinstut$tvparnr,theta.des=theta.des,detail=0,
score.method="fisher.scoring")
summary(bina)
twinstut$binstut <- (twinstut$stutter=="yes")*1
## refers to zygosity of first subject in eash pair : zyg1
## could also use zyg2 (since zyg2=zyg1 within twinpair's))
out <- easy.binomial.twostage(stutter~factor(sex)+age,data=twinstut,
response="binstut",id="tvparnr",
theta.formula=~-1+factor(zyg1),
score.method="fisher.scoring")
summary(out)
## refers to zygosity of first subject in eash pair : zyg1
## could also use zyg2 (since zyg2=zyg1 within twinpair's))
desfs<-function(x,num1="zyg1",num2="zyg2")
c(x[num1]=="dz",x[num1]=="mz",x[num1]=="os")*1
out3 <- easy.binomial.twostage(binstut~factor(sex)+age,
data=twinstut,response="binstut",id="tvparnr",
score.method="fisher.scoring",theta.formula=desfs,desnames=c("mz","dz","os"))
summary(out3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.