4545# ' @param subset optional updated subset argument.
4646# ' @param contrasts optional updated contrasts argument.
4747# ' @param \dots arguments to be passed down.
48- # '
48+ # '
4949# ' @return \itemize{
5050# ' \item The \code{coef} and \code{vcov} methods return either matrices or lists of regression
5151# ' coefficients and their covariances, respectively.
5454# ' \item The \code{predict} and \code{fitted} methods return either a matrix of predicted probabilities or an
5555# ' object of class \code{"predictDichotomies"}, which is a named list with predicted logits for
5656# ' each nested-dichotomy model.
57- # ' \item The \code{glance} and \code{tidy} methods return 'tibbles' containing model summaries.
5857# ' \item The \code{summary} method returns an object of class \code{"summary.nestedLogit"}, which is
5958# ' a list of summaries of the \code{\link{glm}} objects that comprise the nested-dichotomies model; the
6059# ' object is normally printed.
9291# ' broom::tidy(m)
9392# '
9493# ' # predicted probabilities and ploting
95- # ' head(predict(m)) # fitted probabilities for first few cases;
94+ # ' head(predict(m)) # fitted probabilities for first few cases;
9695# ' # equivalent to head(fitted(m))
9796# ' new <- expand.grid(parentdeg=c("l.t.highschool", "highschool",
9897# ' "college", "graduate"),
@@ -121,7 +120,7 @@ print.nestedLogit <- function(x, ...) {
121120summary.nestedLogit <- function (object , ... ) {
122121 result <- lapply(models(object ), summary , ... )
123122 for (i in seq_along(result )) {
124- result [[i ]]$ dichotomy <- models(object , i )$ dichotomy
123+ result [[i ]]$ dichotomy <- models(object , i )$ dichotomy
125124 }
126125 class(result ) <- " summary.nestedLogit"
127126 attr(result , " formula" ) <- object $ formula
@@ -187,7 +186,7 @@ predict.nestedLogit <- function(object, newdata, model=c("nested", "dichotomies"
187186 for (i in seq_along(models(object ))) {
188187 p <- predict(models(object , i ), newdata = newdata , type = " response" )
189188 p <- cbind(1 - p , p )
190- attr(p , " columns" ) <- models(object , i )$ dichotomy
189+ attr(p , " columns" ) <- models(object , i )$ dichotomy
191190 fitted [[i ]] <- p
192191 }
193192 response.levels <-
@@ -197,7 +196,7 @@ predict.nestedLogit <- function(object, newdata, model=c("nested", "dichotomies"
197196 colnames(p ) <- response.levels
198197 for (level in response.levels ) {
199198 for (i in seq_along(models(object ))) {
200- which <- sapply(models(object , i )$ dichotomy , function (x )
199+ which <- sapply(models(object , i )$ dichotomy , function (x )
201200 level %in% x )
202201 if (! any(which ))
203202 next
@@ -319,7 +318,7 @@ as.character.dichotomies <- function(x, ...) {
319318 for (i in seq_along(x )) {
320319 result <- paste0(result ,
321320 names(x [i ]), " = " ,
322- " {" ,
321+ " {" ,
323322 names(x [[i ]][1L ]),
324323 " {" ,
325324 paste(x [[i ]][[1L ]], collapse = " " ),
0 commit comments