grouped
is used to fit regression models for grouped or coarse data under the assumption
that the data are Coarsened At Random.grouped(formula, link = c("identity", "log", "logit"),
distribution = c("normal", "t", "logistic"), data,
subset, na.action, str.values, df = NULL, iter = 3, ...)
distribution
argument. Available choices are "identity"
, "log"
and "logit"
.
"normal"
, "t"
and "logistic"
. See Details for more info.data.frame
containing the variables in the model. If not found in data, the variables
are taken from environment(formula)
, typically the environment from which grouped
is
NA
s.optim
in case the first optimization has not
converged.grouped
is a list with the following components:optim
.X
the design matrix, (ii) y
the response data matrix,
(iii) convergence
the convergence identifier returned by optim
, (iv) logLik
the
value of the log-likelihood at convergence, (v) k
the number of outer iterations used, (vi)
n
the sample size, (vii) df
the degrees of freedom; NULL
except for the t
distribution, (viii) link
the link function used, (ix) distribution
the distribution
assumed for the true latent response variable and (x) max.sc
the maximum absolute value of the
score vector at convergence.grouped
and this package are devoted in the analysis of such data in the
case the data are Coarsened At Random (Heitjan and Rubin, 1991).
The framework we use assumes a latent variable $Z_i$ which is coarsely measured and for which we only know
$Y_{li}$ and $Y_{ui}$, i.e., the interval in which $Z_i$ lies. Given some covariates $X_i$,
$Z_i|X_i$ may assume either a Normal, a Logistic or (generalized) Student's-t distribution. In addition three
link functions are available for greater flexibility. In particular, the likelihood is of the following form
distribution
and
$y_{li}^* = \phi(y_{li})$, where $\phi(\cdot)$ denotes the link function,
and $y_{ui}^*$ is defined analogously.
An interesting example of coarse data is the various quality of life indexes. The observed value of such indexes can
be thought of as a rounded version of the true latent quality of life that the index attempts to capture.
Applications of this approach can be found in Lesaffre et al. (2005) and Tsonaka et al. (2005). Various other
examples of grouped and coarse data can be found in Heitjan (1989; 1993).anova.grouped
,
plot.grouped
,
residuals.grouped
,
summary.grouped
,
power.grouped
grouped(cbind(lo, up) ~ treat * x, link = "logit", data = Sdata)
grouped(equispaced(r, n) ~ x1 * x2, link = "logit", data = Seeds)
# See Figure 1 and Table 1 in Heitjan (1989)
y <- iris[iris$Species == "setosa", "Petal.Width"]
index <- cbind(seq(0.05, 0.55, 0.1), seq(0.15, 0.65, 0.1))
n <- length(y)
a <- b <- numeric(n)
for(i in 1:n){
ind <- which(index[, 2] - y[i] > 0)[1]
a[i] <- index[ind, 1]
b[i] <- index[ind, 2]
}
summary(grouped(cbind(a, b) ~ 1))
# See Figure 1 and Table 1 in Heitjan (1989)
y <- iris[iris$Species == "setosa", "Petal.Length"]
index <- cbind(seq(0.95, 1.75, 0.2), seq(1.15, 1.95, 0.2))
n <- length(y)
a <- b <- numeric(n)
for(i in 1:n){
ind <- which(index[, 2] - y[i] > 0)[1]
a[i] <- index[ind, 1]
b[i] <- index[ind, 2]
}
summary(grouped(cbind(a, b) ~ 1))
Run the code above in your browser using DataLab