RRglm: Fitting Generalized Linear Models with binary Randomized...

Description Usage Arguments Value See Also Examples

View source: R/RRglm.R

Description

Fit a generalized linear model (GLM) with binary Randomized Response data. Implemented as a wrapper for glm. Reference: Fox, J-P, Klotzke, K. and Veen, D. (2016). Generalized Linear Mixed Models for Randomized Responses. Manuscript submitted for publication.

Usage

1
RRglm(formula, link, item, RRmodel, p1, p2, data, na.action = "na.omit", ...)

Arguments

formula

a two-sided linear formula object describing the model to be fitted, with the response on the left of a ~ operator and the terms, separated by + operators, on the right.

link

a glm link function for binary outcomes. Must be a function name. Available options: "RRlink.logit", "RRlink.probit", "RRlink.cloglog" and "RRlink.cauchit"

item

optional item identifier for long-format data.

RRmodel

the Randomized Response model, defined per case. Available options: "DQ", "Warner", "Forced", "UQM", "Crosswise", "Triangular" and "Kuk"

p1

the Randomized Response parameter p1, defined per case. Must be 0 <= p1 <= 1.

p2

the Randomized Response parameter p2, defined per case. Must be 0 <= p2 <= 1.

data

a data frame containing the variables named in formula as well as the Randomized Response model and parameters. If the required information cannot be found in the data frame, or if no data frame is given, then the variables are taken from the environment from which RRglm is called.

na.action

a function that indicates what should happen when the data contain NAs. The default action (na.omit, as given by getOption("na.action"))) strips any observations with any missing values in any variables.

...

other potential arguments to be passed to glm.

Value

An object of class RRglm. Extends the class glm with Randomize Response data.

See Also

glm

Examples

1
2
3
4
5
6
# Fit the model with fixed effects for gender, RR, pp and age using the logit link function.
# The Randomized Response parameters p1, p2 and model
# are specified for each observation in the dataset.
out <- RRglm(response ~ Gender + RR + pp + age, link="RRlink.logit", RRmodel=RRmodel,
         p1=RRp1, p2=RRp2, data=Plagiarism, etastart=rep(0.01, nrow(Plagiarism)))
summary(out)

GLMMRR documentation built on May 30, 2017, 3:31 a.m.