Import Debian changes 2.0.9-1
effects (2.0.9-1) unstable; urgency=low
* New upstream release
* debian/control: Set (Build-)Depends: to current R version
Dirk Eddelbuettel
5 years ago
0 | 0 | Package: effects |
1 | Version: 2.0-8 | |
2 | Date: 2009/10/07 | |
1 | Version: 2.0-9 | |
2 | Date: 2009/10/11 | |
3 | 3 | Title: Effect Displays for Linear, Generalized Linear, |
4 | 4 | Multinomial-Logit, and Proportional-Odds Logit Models |
5 | 5 | Author: John Fox <jfox@mcmaster.ca> and Jangman Hong. We are grateful |
6 | 6 | to Robert Andersen, David Firth, and Michael Friendly, for |
7 | various suggestions. | |
7 | various suggestions, and to Ian Fellows for contributing | |
8 | patches. | |
8 | 9 | Maintainer: John Fox <jfox@mcmaster.ca> |
9 | 10 | Depends: R (>= 2.4.0), lattice, grid, MASS, nnet, colorspace |
10 | 11 | LazyLoad: yes |
16 | 17 | URL: http://www.r-project.org, http://socserv.socsci.mcmaster.ca/jfox/ |
17 | 18 | Repository: CRAN |
18 | 19 | Repository/R-Forge/Project: effects |
19 | Repository/R-Forge/Revision: 37 | |
20 | Date/Publication: 2009-10-09 06:55:21 | |
21 | Packaged: 2009-10-08 20:11:02 UTC; rforge | |
20 | Repository/R-Forge/Revision: 39 | |
21 | Date/Publication: 2009-10-14 09:45:52 | |
22 | Packaged: 2009-10-13 20:14:17 UTC; rforge |
0 | 0 | # effect generic and methods; allEffects |
1 | 1 | # John Fox and Jangman Hong |
2 | # last modified 21 April 2009 by J. Fox | |
2 | # patches contributed by Ian Fellows 28 August 2009 (marked I-* in the sources) | |
3 | # last modified 11 October 2009 by J. Fox | |
3 | 4 | |
4 | 5 | effect <- function(term, mod, ...){ |
5 | 6 | UseMethod("effect", mod) |
6 | 7 | } |
7 | 8 | |
8 | 9 | effect.lm <- function (term, mod, xlevels=list(), default.levels=10, given.values, |
9 | se=TRUE, confidence.level=.95, | |
10 | transformation=list(link=family(mod)$linkfun, inverse=family(mod)$linkinv), | |
10 | se=TRUE, confidence.level=.95, | |
11 | transformation=list(link=family(mod)$linkfun, inverse=family(mod)$linkinv), | |
11 | 12 | typical=mean, ...){ |
12 | 13 | if (missing(given.values)) given.values <- NULL |
13 | else if (!all(which <- names(given.values) %in% names(coef(mod)))) | |
14 | else if (!all(which <- names(given.values) %in% names(coef(mod)))) | |
14 | 15 | stop("given.values (", names(given.values[!which]),") not in the model") |
15 | 16 | model.components <- analyze.model(term, mod, xlevels, default.levels) |
16 | 17 | predict.data <- model.components$predict.data |
23 | 24 | X.mod <- model.components$X.mod |
24 | 25 | cnames <- model.components$cnames |
25 | 26 | X <- model.components$X |
26 | formula.rhs <- formula(mod)[c(1,3)] | |
27 | formula.rhs <- formula(mod)[c(1,3)] | |
27 | 28 | nrow.X <- nrow(X) |
28 | mf <- model.frame(formula.rhs, data=rbind(X[,names(predict.data),drop=FALSE], predict.data), | |
29 | for(i in names(predict.data)) #I-add | |
30 | if(is.numeric(predict.data[[i]])) X[,i] <- as.numeric(X[,i]) #I-add | |
31 | warn <- options(warn=-1) # calls to model.frame() and model.matrix() can generate spurious warnings | |
32 | mf <- model.frame(formula.rhs, data=rbind(X[,names(predict.data), drop=FALSE], predict.data), | |
29 | 33 | xlev=factor.levels) |
30 | mod.matrix.all <- model.matrix(formula.rhs, data=mf, contrasts.arg=mod$contrasts) | |
34 | mod.matrix.all <- model.matrix(formula.rhs, data=mf, #I-add | |
35 | contrasts.arg=mod$contrasts[names(factor.levels)]) #I-add | |
36 | options(warn) | |
37 | #I-rem mod.matrix.all <- model.matrix(formula.rhs, data=mf, contrasts.arg=mod$contrasts) | |
31 | 38 | mod.matrix <- mod.matrix.all[-(1:nrow.X),] |
32 | 39 | fit.1 <- na.omit(predict(mod)) |
33 | 40 | wts <- mod$weights |
36 | 43 | discrepancy <- 100*sqrt(mean(mod.2$residuals^2)/mean(mod$residuals^2)) |
37 | 44 | if (discrepancy > 1e-3) warning(paste("There is a discrepancy of", round(discrepancy, 3), |
38 | 45 | "percent \n in the 'safe' predictions used to generate effect", term)) |
39 | mod.matrix <- fixup.model.matrix(mod, mod.matrix, mod.matrix.all, X.mod, mod.aug, | |
46 | mod.matrix <- fixup.model.matrix(mod, mod.matrix, mod.matrix.all, X.mod, mod.aug, | |
40 | 47 | factor.cols, cnames, term, typical, given.values) |
41 | 48 | effect <- mod.matrix %*% mod.2$coefficients |
42 | 49 | result <- list(term=term, formula=formula(mod), response=response.name(mod), |
43 | variables=x, fit=effect, | |
44 | x=predict.data[,1:n.basic, drop=FALSE], model.matrix=mod.matrix, | |
50 | variables=x, fit=effect, | |
51 | x=predict.data[,1:n.basic, drop=FALSE], model.matrix=mod.matrix, | |
45 | 52 | data=X, discrepancy=discrepancy) |
46 | 53 | if (se){ |
47 | 54 | if (any(family(mod)$family == c('binomial', 'poisson'))){ |
55 | 62 | mod.2$terms <- mod$terms |
56 | 63 | V <- dispersion * summary.lm(mod.2)$cov |
57 | 64 | var <- diag(mod.matrix %*% V %*% t(mod.matrix)) |
58 | result$se <- sqrt(var) | |
65 | result$se <- sqrt(var) | |
59 | 66 | result$lower <- effect - z*result$se |
60 | 67 | result$upper <- effect + z*result$se |
61 | 68 | result$confidence.level <- confidence.level |
69 | 76 | result |
70 | 77 | } |
71 | 78 | |
72 | effect.multinom <- function(term, mod, | |
73 | confidence.level=.95, xlevels=list(), default.levels=10, | |
79 | effect.multinom <- function(term, mod, | |
80 | confidence.level=.95, xlevels=list(), default.levels=10, | |
74 | 81 | given.values, se=TRUE, typical=mean, ...){ |
75 | 82 | eff.mul <- function(x0){ |
76 | 83 | mu <- exp(x0 %*% B) |
106 | 113 | } |
107 | 114 | if (length(mod$lev) < 3) stop("effects for multinomial logit model only available for response levels > 2") |
108 | 115 | if (missing(given.values)) given.values <- NULL |
109 | else if (!all(which <- colnames(given.values) %in% names(coef(mod)))) | |
116 | else if (!all(which <- colnames(given.values) %in% names(coef(mod)))) | |
110 | 117 | stop("given.values (", colnames(given.values[!which]),") not in the model") |
111 | 118 | # refit model to produce 'safe' predictions when the model matrix includes |
112 | 119 | # terms -- e.g., poly(), bs() -- whose basis depends upon the data |
134 | 141 | } |
135 | 142 | X <- na.omit(X) |
136 | 143 | nrow.X <- nrow(X) |
144 | for(i in names(predict.data)) | |
145 | if(is.numeric(predict.data[[i]])) X[,i] <- as.numeric(X[,i]) | |
137 | 146 | data <- rbind(X[,names(newdata),drop=FALSE], newdata) |
138 | 147 | data$wt <- rep(0, nrow(data)) |
139 | 148 | data$wt[1:nrow.X] <- weights(mod) |
140 | mod.matrix.all <- model.matrix(formula.rhs, data=data, contrasts.arg=mod$contrasts) | |
149 | # mod.matrix.all <- model.matrix(formula.rhs, data=data, contrasts.arg=mod$contrasts) | |
150 | warn <- options(warn=-1) # call to model.matrix() can generate spurious warnings | |
151 | mod.matrix.all <- model.matrix(formula.rhs, data=data, | |
152 | contrasts.arg=mod$contrasts[names(factor.levels)]) | |
153 | options(warn) | |
141 | 154 | X0 <- mod.matrix.all[-(1:nrow.X),] |
142 | X0 <- fixup.model.matrix(mod, X0, mod.matrix.all, X.mod, mod.aug, factor.cols, | |
155 | X0 <- fixup.model.matrix(mod, X0, mod.matrix.all, X.mod, mod.aug, factor.cols, | |
143 | 156 | cnames, term, typical, given.values) |
144 | 157 | resp.names <- make.names(mod$lev, unique=TRUE) |
145 | 158 | resp.names <- c(resp.names[-1], resp.names[1]) # make the last level the reference level |
198 | 211 | model.matrix=X0, data=X, discrepancy=discrepancy, model="multinom", |
199 | 212 | prob=P, logit=Logit) |
200 | 213 | if (se) result <- c(result, list(se.prob=SE.P, se.logit=SE.logit, |
201 | lower.logit=Lower.logit, upper.logit=Upper.logit, | |
214 | lower.logit=Lower.logit, upper.logit=Upper.logit, | |
202 | 215 | lower.prob=Lower.P, upper.prob=Upper.P, |
203 | 216 | confidence.level=confidence.level)) |
204 | 217 | class(result) <-'effpoly' |
205 | 218 | result |
206 | 219 | } |
207 | 220 | |
208 | effect.polr <- function(term, mod, | |
209 | confidence.level=.95, xlevels=list(), default.levels=10, | |
221 | effect.polr <- function(term, mod, | |
222 | confidence.level=.95, xlevels=list(), default.levels=10, | |
210 | 223 | given.values, se=TRUE, typical=mean, latent=FALSE, ...){ |
211 | 224 | if (mod$method != "logistic") stop('method argument to polr must be "logistic"') |
212 | 225 | if (missing(given.values)) given.values <- NULL |
213 | else if (!all(which <- names(given.values) %in% names(coef(mod)))) | |
226 | else if (!all(which <- names(given.values) %in% names(coef(mod)))) | |
214 | 227 | stop("given.values (", names(given.values[!which]),") not in the model") |
215 | 228 | eff.polr <- function(x0){ |
216 | 229 | eta0 <- x0 %*% b |
281 | 294 | } |
282 | 295 | X <- na.omit(X) |
283 | 296 | nrow.X <- nrow(X) |
297 | for(i in names(predict.data)) | |
298 | if(is.numeric(predict.data[[i]])) X[,i] <- as.numeric(X[,i]) | |
284 | 299 | data <- rbind(X[,names(newdata),drop=FALSE], newdata) |
285 | 300 | wts <- mod$model[["(weights)"]] |
286 | 301 | if (is.null(wts)) wts <- 1 |
287 | 302 | data$wt <- rep(0, nrow(data)) |
288 | 303 | data$wt[1:nrow.X] <- wts |
289 | mod.matrix.all <- model.matrix(formula.rhs, data=data, contrasts.arg=mod$contrasts) | |
304 | # mod.matrix.all <- model.matrix(formula.rhs, data=data, contrasts.arg=mod$contrasts) | |
305 | warn <- options(warn=-1) # call to model.matrix() can generate spurious warnings | |
306 | mod.matrix.all <- model.matrix(formula.rhs, data=data, | |
307 | contrasts.arg=mod$contrasts[names(factor.levels)]) | |
308 | options(warn) | |
290 | 309 | X0 <- mod.matrix.all[-(1:nrow.X),] |
291 | X0 <- fixup.model.matrix(mod, X0, mod.matrix.all, X.mod, mod.aug, factor.cols, | |
310 | X0 <- fixup.model.matrix(mod, X0, mod.matrix.all, X.mod, mod.aug, factor.cols, | |
292 | 311 | cnames, term, typical, given.values) |
293 | 312 | resp.names <- make.names(mod$lev, unique=TRUE) |
294 | 313 | mod <- polr(formula(mod), data=data, Hess=TRUE, weights=wt) |
304 | 323 | alpha <- - mod$zeta # intercepts are negatives of thresholds |
305 | 324 | z <- qnorm(1 - (1 - confidence.level)/2) |
306 | 325 | result <- list(term=term, formula=formula(mod), response=response.name(mod), |
307 | y.levels=mod$lev, variables=x, | |
326 | y.levels=mod$lev, variables=x, | |
308 | 327 | x=predict.data[,1:n.basic, drop=FALSE], |
309 | 328 | model.matrix=X0, data=X, discrepancy=discrepancy, model="polr") |
310 | 329 | if (latent){ |
361 | 380 | result$logit <- Logit |
362 | 381 | if (se) result <- c(result, |
363 | 382 | list(se.prob=SE.P, se.logit=SE.Logit, |
364 | lower.logit=Lower.logit, upper.logit=Upper.logit, | |
383 | lower.logit=Lower.logit, upper.logit=Upper.logit, | |
365 | 384 | lower.prob=Lower.P, upper.prob=Upper.P, |
366 | 385 | confidence.level=confidence.level)) |
367 | 386 | class(result) <-'effpoly' |
388 | 407 | all.effects <- function(...){ |
389 | 408 | .Deprecated("allEffects") |
390 | 409 | allEffects(...) |
391 | }⏎ | |
410 | } |
0 | 0 | # utilities and common functions for effects package |
1 | 1 | # John Fox and Jangman Hong |
2 | # last modified 06 May 2009 by J. Fox | |
3 | ||
2 | # patches contributed by Ian Fellows 28 August 2009 (marked I-* in the sources) | |
3 | # last modified 11 October 2009 by J. Fox | |
4 | 4 | |
5 | 5 | has.intercept <- function(model, ...) any(names(coefficients(model))=="(Intercept)") |
6 | 6 | |
26 | 26 | f <- formula(model) |
27 | 27 | data <- eval(model$call$data, envir) |
28 | 28 | ff <- foo ~ bar + baz |
29 | if (is.call(extras)) | |
29 | if (is.call(extras)) | |
30 | 30 | gg <- extras |
31 | 31 | else gg <- parse(text = paste("~", paste(extras, collapse = "+")))[[1]] |
32 | 32 | ff[[2]] <- f[[2]] |
42 | 42 | } |
43 | 43 | else { |
44 | 44 | subset <- model$call$subset |
45 | rval <- eval(call("model.frame", ff, data = data, subset = subset, | |
45 | rval <- eval(call("model.frame", ff, data = data, subset = subset, | |
46 | 46 | na.action = I), envir) |
47 | 47 | oldmf <- model.frame(model) |
48 | 48 | keep <- match(rownames(oldmf), rownames(rval)) |
70 | 70 | if (0 == length(result)) which.term else result |
71 | 71 | } |
72 | 72 | else { |
73 | factors <- attr(mod$terms, "factors") | |
73 | factors <- attr(mod$terms, "factors") | |
74 | 74 | rownames(factors) <- gsub(" ", "", rownames(factors)) |
75 | colnames(factors) <- gsub(" ", "", colnames(factors)) | |
75 | colnames(factors) <- gsub(" ", "", colnames(factors)) | |
76 | 76 | result<-(1:length(names))[-which.term][sapply(names[-which.term], |
77 | 77 | function(term2) is.relative(term2, term, factors))] |
78 | 78 | if (0 == length(result)) which.term else result |
146 | 146 | } |
147 | 147 | |
148 | 148 | analyze.model <- function(term, mod, xlevels, default.levels){ |
149 | if ((!is.null(mod$na.action)) && class(mod$na.action) == "exclude") | |
149 | if ((!is.null(mod$na.action)) && class(mod$na.action) == "exclude") | |
150 | 150 | class(mod$na.action) <- "omit" |
151 | 151 | term <- gsub(" ", "", gsub("\\*", ":", term)) |
152 | 152 | intercept <- has.intercept(mod) |
153 | 153 | terms <- term.names(mod) |
154 | 154 | if (intercept) terms <- terms[-1] |
155 | 155 | which.term <- which(term==terms) |
156 | mod.aug<- list() | |
156 | mod.aug <- list() | |
157 | 157 | if (length(which.term) == 0){ |
158 | 158 | warning(paste(term,"does not appear in the model")) |
159 | 159 | mod.aug <- update(formula(mod), eval(parse(text=paste(". ~ . +", term)))) |
176 | 176 | all.vars <- all.vars(as.formula(paste ("~", paste(terms[all.vars], collapse="+")))) |
177 | 177 | basic.vars <- all.vars(as.formula(paste ("~", paste(terms[basic.vars], collapse="+")))) |
178 | 178 | } |
179 | excluded.vars <- if (length(excluded.vars) > 0) | |
179 | excluded.vars <- if (length(excluded.vars) > 0) | |
180 | 180 | all.vars(as.formula(paste ("~", paste(terms[excluded.vars], collapse="+")))) |
181 | 181 | else NULL |
182 | 182 | X.mod <- model.matrix(mod) |
184 | 184 | factor.cols <- rep(FALSE, length(cnames)) |
185 | 185 | names(factor.cols) <- cnames |
186 | 186 | X <- model.frame(mod) |
187 | for (name in all.vars){ | |
188 | if (is.factor(X[[name]])) factor.cols[grep(paste("^", name, sep=""), cnames)] <- TRUE | |
189 | } | |
190 | factor.cols[grep(":", cnames)] <- FALSE | |
187 | ##begin I-add## | |
188 | storType <- attr(terms(mod), "dataClasses") | |
189 | for (name in names(storType[storType=="factor" | storType=="logical"])){ | |
190 | name <- gsub("[()]", ".", gsub("\\.", "\\\\.", name)) | |
191 | factor.cols[grep(paste("^", name, sep=""), cnames)] <- TRUE | |
192 | } | |
193 | factor.cols[grep(":", cnames,extended=FALSE)] <- FALSE | |
191 | 194 | X <- na.omit(expand.model.frame(mod, all.vars)) |
192 | x<-list() | |
195 | factor.levels <- list() | |
196 | basicType<-rep(NA,length(basic.vars)) | |
197 | factor.vars<-c() | |
198 | for(factor.term in names(storType)[storType=="factor"| storType=="logical"]){ | |
199 | factor.vars<-unique(c(factor.vars,all.vars(as.formula(paste("~",factor.term))))) | |
200 | } | |
201 | ##end I-add## | |
202 | #I-rem factor.cols[grep(":", cnames)] <- FALSE | |
203 | #I-rem X <- na.omit(expand.model.frame(mod, all.vars)) | |
204 | x <- list() | |
193 | 205 | factor.levels <- list() |
194 | 206 | for (name in basic.vars){ |
195 | 207 | levels <- mod$xlevels[[name]] |
196 | fac <- !is.null(levels) | |
208 | if(is.null(levels)) levels<-levels(factor(X[,name])) #I-add | |
209 | fac <- name %in%factor.vars #I-add | |
210 | #I-rem fac <- !is.null(levels) | |
197 | 211 | if (!fac) { |
198 | 212 | levels <- if (is.null(xlevels[[name]])) |
199 | seq(min(X[, name]), max(X[,name]), length=default.levels) | |
213 | seq(min(as.numeric(X[, name])), max(as.numeric(X[,name])), length=default.levels) | |
214 | #I-chg seq(min(X[, name]), max(X[,name]), length=default.levels) | |
200 | 215 | else xlevels[[name]] |
201 | 216 | } |
202 | else factor.levels[[name]] <- levels | |
217 | else if(!is.null(levels)){ #I-add | |
218 | factor.levels[[name]] <- levels#I-add | |
219 | }else{#I-add | |
220 | factor.levels[[name]] <-levels(factor(X[,name]))#I-add | |
221 | }#I-add | |
222 | #I-rem else factor.levels[[name]] <- levels | |
203 | 223 | x[[name]] <- list(name=name, is.factor=fac, levels=levels) |
204 | 224 | } |
205 | 225 | x.excluded <- list() |
226 | ##begin I-add# | |
206 | 227 | for (name in excluded.vars){ |
207 | 228 | levels <- mod$xlevels[[name]] |
208 | fac <- !is.null(levels) | |
209 | level <- if (fac) levels[1] else mean(X[, name]) | |
229 | fac <- name %in%factor.vars | |
230 | if(is.null(levels)) levels <- levels(factor(X[,name])) | |
231 | level <- if (fac) levels[1] else mean(as.numeric(X[, name])) | |
210 | 232 | if (fac) factor.levels[[name]] <- levels |
211 | 233 | x.excluded[[name]] <- list(name=name, is.factor=fac, |
212 | 234 | level=level) |
213 | 235 | } |
236 | #end I-add# | |
237 | ||
238 | #I-rem# | |
239 | # for (name in excluded.vars){ | |
240 | # levels <- mod$xlevels[[name]] | |
241 | # fac <- !is.null(levels) | |
242 | # if (fac) factor.levels[[name]] <- levels | |
243 | # x.excluded[[name]] <- list(name=name, is.factor=fac, | |
244 | # level=level) | |
245 | # } | |
214 | 246 | dims <- sapply(x, function(x) length(x$levels)) |
215 | 247 | len <- prod(dims) |
216 | 248 | n.basic <- length(basic.vars) |
229 | 261 | colnames(predict.data) <- c(sapply(x, function(x) x$name), |
230 | 262 | sapply(x.excluded, function(x) x$name)) |
231 | 263 | predict.data <- matrix.to.df(predict.data) |
232 | list(predict.data=predict.data, factor.levels=factor.levels, | |
264 | list(predict.data=predict.data, factor.levels=factor.levels, | |
233 | 265 | factor.cols=factor.cols, mod.aug=mod.aug, term=term, n.basic=n.basic, |
234 | x=x, X.mod=X.mod, cnames=cnames, X=X) | |
235 | } | |
236 | ||
237 | #fixup.model.matrix <- function(mod, mod.matrix, mod.matrix.all, X.mod, mod.aug, | |
238 | # factor.cols, cnames, term, typical, given.values){ | |
239 | # attr(mod.matrix, "assign") <- attr(mod.matrix.all, "assign") | |
240 | # stranger.cols <- factor.cols & | |
241 | # apply(outer(strangers(term, mod, mod.aug), attr(mod.matrix,'assign'), '=='), 2, any) | |
242 | # if (has.intercept(mod)) stranger.cols[1] <- TRUE | |
243 | # if (any(stranger.cols)) { | |
244 | # mod.matrix[,stranger.cols] <- | |
245 | # matrix(apply(as.matrix(X.mod[,stranger.cols]), 2, typical), | |
246 | # nrow=nrow(mod.matrix), ncol=sum(stranger.cols), byrow=TRUE) | |
247 | # if (!is.null(given.values)){ | |
248 | # stranger.names <- names(stranger.cols[stranger.cols]) | |
249 | # given <- stranger.names %in% names(given.values) | |
250 | # if (any(given)) mod.matrix[,stranger.names[given]] <- given.values[stranger.names[given]] | |
251 | # } | |
252 | # } | |
253 | # for (name in cnames){ | |
254 | # components <- unlist(strsplit(name, ':')) | |
255 | # if (length(components) > 1) | |
256 | # mod.matrix[,name] <- apply(mod.matrix[,components], 1, prod) | |
257 | # } | |
258 | # mod.matrix | |
259 | #} | |
260 | ||
261 | fixup.model.matrix <- function(mod, mod.matrix, mod.matrix.all, X.mod, mod.aug, | |
266 | x=x, X.mod=X.mod, cnames=cnames, X=X) | |
267 | } | |
268 | ||
269 | fixup.model.matrix <- function(mod, mod.matrix, mod.matrix.all, X.mod, mod.aug, | |
262 | 270 | factor.cols, cnames, term, typical, given.values){ |
263 | 271 | attr(mod.matrix, "assign") <- attr(mod.matrix.all, "assign") |
264 | stranger.cols <- | |
272 | stranger.cols <- | |
265 | 273 | apply(outer(strangers(term, mod, mod.aug), attr(mod.matrix,'assign'), '=='), 2, any) |
266 | 274 | if (has.intercept(mod)) stranger.cols[1] <- TRUE |
267 | 275 | if (any(stranger.cols)) { |
268 | 276 | facs <- factor.cols & stranger.cols |
269 | 277 | covs <- (!factor.cols) & stranger.cols |
270 | if (any(facs)) mod.matrix[,facs] <- | |
271 | matrix(apply(as.matrix(X.mod[,facs]), 2, mean), | |
278 | if (any(facs)) mod.matrix[,facs] <- | |
279 | matrix(apply(as.matrix(X.mod[,facs]), 2, mean), | |
272 | 280 | nrow=nrow(mod.matrix), ncol=sum(facs), byrow=TRUE) |
273 | if (any(covs)) mod.matrix[,covs] <- | |
274 | matrix(apply(as.matrix(X.mod[,covs]), 2, typical), | |
281 | if (any(covs)) mod.matrix[,covs] <- | |
282 | matrix(apply(as.matrix(X.mod[,covs]), 2, typical), | |
275 | 283 | nrow=nrow(mod.matrix), ncol=sum(covs), byrow=TRUE) |
276 | 284 | if (!is.null(given.values)){ |
277 | 285 | stranger.names <- cnames[stranger.cols] |
278 | 286 | given <- stranger.names %in% names(given.values) |
279 | if (any(given)) mod.matrix[,stranger.names[given]] <- | |
280 | matrix(given.values[stranger.names[given]], nrow=nrow(mod.matrix), | |
281 | ncol=length(stranger.names[given]), byrow=TRUE) | |
282 | } | |
287 | if (any(given)) mod.matrix[,stranger.names[given]] <- | |
288 | matrix(given.values[stranger.names[given]], nrow=nrow(mod.matrix), | |
289 | ncol=length(stranger.names[given]), byrow=TRUE) | |
290 | } | |
283 | 291 | } |
284 | 292 | for (name in cnames){ |
285 | 293 | components <- unlist(strsplit(name, ':')) |
286 | if (length(components) > 1) | |
294 | if (length(components) > 1) | |
287 | 295 | mod.matrix[,name] <- apply(mod.matrix[,components], 1, prod) |
288 | 296 | } |
289 | 297 | mod.matrix |
324 | 332 | grid.segments(x, unit(0, "npc"), x, unit(0.5, "lines"), |
325 | 333 | default.units="native") |
326 | 334 | } |
327 | ||
328 |
0 | effects (2.0.9-1) unstable; urgency=low | |
1 | ||
2 | * New upstream release | |
3 | ||
4 | * debian/control: Set (Build-)Depends: to current R version | |
5 | ||
6 | -- Dirk Eddelbuettel <edd@debian.org> Wed, 14 Oct 2009 17:28:53 -0500 | |
7 | ||
0 | 8 | effects (2.0.8-1) unstable; urgency=low |
1 | 9 | |
2 | 10 | * New upstream release |
1 | 1 | Section: gnu-r |
2 | 2 | Priority: optional |
3 | 3 | Maintainer: Dirk Eddelbuettel <edd@debian.org> |
4 | Build-Depends: debhelper (>> 4.1.0), r-base-dev (>= 2.9.2), cdbs, r-cran-lattice (>= 0.10.11), r-cran-vr, r-cran-colorspace | |
4 | Build-Depends: debhelper (>> 4.1.0), r-base-dev (>= 2.10.0~20091013), cdbs, r-cran-lattice (>= 0.10.11), r-cran-vr (> 7.2.29), r-cran-colorspace | |
5 | 5 | Standards-Version: 3.8.3 |
6 | 6 | |
7 | 7 | Package: r-cran-effects |
8 | 8 | Architecture: all |
9 | Depends: r-base-core (>= 2.9.2), r-cran-lattice (>= 0.10.11), r-cran-vr, r-cran-colorspace | |
9 | Depends: r-base-core (>= 2.10.0~20091013), r-cran-lattice (>= 0.10.11), r-cran-vr, r-cran-colorspace | |
10 | 10 | Description: GNU R graphical and tabular effects display for glm models |
11 | 11 | This package provides functions for 'effect' displays: Graphical and |
12 | 12 | tabular effect displays, e.g., of interactions, for linear generalized |
117 | 117 | |
118 | 118 | o Version corresponding to John Fox, Jangman Hong (2009), Effect Displays in R for Multinomial and Proportional-Odds Logit Models: Extensions to the effects Package. Journal of Statistical Software, 32(1), 1-24 <http://www.jstatsoft.org/v32/i01/>. |
119 | 119 | |
120 | O Fixed [pgk] markup in .Rd file cross-references. | |
120 | o Fixed [pgk] markup in .Rd file cross-references. | |
121 | ||
122 | Version 2.0-9 | |
123 | ||
124 | o Applied patches contributed by Ian Fellows to allow logical predictors and various coercions in model formulas to work properly. | |
125 | ||
126 | o Fixed name of CITATION file (was CITATION.txt). | |
127 | ||
128 | o Small changes to docs. |
0 | citHeader("To cite effects in publications use:") | |
1 | ||
2 | citEntry(entry = "Article", | |
3 | title = "Effect Displays in {R} for Generalised Linear Models", | |
4 | author = as.person("John Fox"), | |
5 | journal = "Journal of Statistical Software", | |
6 | year = "2003", | |
7 | volume = "8", | |
8 | number = "15", | |
9 | pages = "1--27", | |
10 | url = "http://www.jstatsoft.org/v08/i15/", | |
11 | ||
12 | textVersion = | |
13 | paste("John Fox (2003).", | |
14 | "Effect Displays in R for Generalised Linear Models.", | |
15 | "Journal of Statistical Software, 8(15), 1-27.", | |
16 | "URL http://www.jstatsoft.org/v08/i15/.") | |
17 | ) | |
18 | ||
19 | citEntry(entry = "Article", | |
20 | title = "Effect Displays in {R} for Multinomial and Proportional-Odds Logit Models: Extensions to the {effects} Package", | |
21 | author = personList(as.person("John Fox"), | |
22 | as.person("Jangman Hong")), | |
23 | journal = "Journal of Statistical Software", | |
24 | year = "2009", | |
25 | volume = "32", | |
26 | number = "1", | |
27 | pages = "1--24", | |
28 | url = "http://www.jstatsoft.org/v32/i01/", | |
29 | ||
30 | textVersion = | |
31 | paste("John Fox, Jangman Hong (2009).", | |
32 | "Effect Displays in R for Multinomial and Proportional-Odds Logit Models: Extensions to the effects Package.", | |
33 | "Journal of Statistical Software, 32(1), 1-24.", | |
34 | "URL http://www.jstatsoft.org/v32/i01/."), | |
35 | ||
36 | header = "For usage in multinomial and proportional-odds logit models also cite:" | |
37 | ) |
0 | citHeader("To cite effects in publications use:") | |
1 | ||
2 | citEntry(entry = "Article", | |
3 | title = "Effect Displays in {R} for Generalised Linear Models", | |
4 | author = as.person("John Fox"), | |
5 | journal = "Journal of Statistical Software", | |
6 | year = "2003", | |
7 | volume = "8", | |
8 | number = "15", | |
9 | pages = "1--27", | |
10 | url = "http://www.jstatsoft.org/v08/i15/", | |
11 | ||
12 | textVersion = | |
13 | paste("John Fox (2003).", | |
14 | "Effect Displays in R for Generalised Linear Models.", | |
15 | "Journal of Statistical Software, 8(15), 1-27.", | |
16 | "URL http://www.jstatsoft.org/v08/i15/.") | |
17 | ) | |
18 | ||
19 | citEntry(entry = "Article", | |
20 | title = "Effect Displays in {R} for Multinomial and Proportional-Odds Logit Models: Extensions to the {effects} Package", | |
21 | author = personList(as.person("John Fox"), | |
22 | as.person("Jangman Hong")), | |
23 | journal = "Journal of Statistical Software", | |
24 | year = "2009", | |
25 | volume = "32", | |
26 | number = "1", | |
27 | pages = "1--24", | |
28 | url = "http://www.jstatsoft.org/v32/i01/", | |
29 | ||
30 | textVersion = | |
31 | paste("John Fox, Jangman Hong (2009).", | |
32 | "Effect Displays in R for Multinomial and Proportional-Odds Logit Models: Extensions to the effects Package.", | |
33 | "Journal of Statistical Software, 32(1), 1-24.", | |
34 | "URL http://www.jstatsoft.org/v32/i01/."), | |
35 | ||
36 | header = "For usage in multinomial and proportional-odds logit models also cite:" | |
37 | ) |
169 | 169 | \bold{36}, 225--255. |
170 | 170 | |
171 | 171 | Fox, J. and J. Hong (2009). |
172 | Effect displays in R for multinomial and proportional-ddds logit models: | |
172 | Effect displays in R for multinomial and proportional-odds logit models: | |
173 | 173 | Extensions to the effects package. |
174 | 174 | \emph{Journal of Statistical Software} |
175 | 175 | \bold{32:1}, 1--24.", <\url{http://www.jstatsoft.org/v32/i01/}>. |
14 | 14 | \details{ |
15 | 15 | \tabular{ll}{ |
16 | 16 | Package: \tab effects\cr |
17 | Version: \tab 2.0-8\cr | |
18 | Date: \tab 2009/10/07\cr | |
17 | Version: \tab 2.0-9\cr | |
18 | Date: \tab 2009/10/11\cr | |
19 | 19 | Depends: \tab R (>= 2.4.0), lattice, grid, MASS, nnet, colorspace\cr |
20 | 20 | LazyLoad: \tab yes\cr |
21 | 21 | LazyData: \tab yes\cr |
48 | 48 | |
49 | 49 | \author{ |
50 | 50 | John Fox <jfox@mcmaster.ca> and Jangman Hong. We are grateful to Robert Andersen, David Firth, and |
51 | Michael Friendly, for various suggestions. | |
51 | Michael Friendly, for various suggestions, and to Ian Fellows for contributing patches.. | |
52 | 52 | |
53 | 53 | Maintainer: John Fox <jfox@mcmaster.ca> |
54 | 54 | } |
68 | 68 | Effect displays for multinomial and proportional-odds logit models. |
69 | 69 | \emph{Sociological Methodology} |
70 | 70 | \bold{36}, 225--255. |
71 | ||
72 | Fox, J. and J. Hong (2009). | |
73 | Effect displays in R for multinomial and proportional-odds logit models: | |
74 | Extensions to the effects package. | |
75 | \emph{Journal of Statistical Software} | |
76 | \bold{32:1}, 1--24.", <\url{http://www.jstatsoft.org/v32/i01/}>. | |
71 | 77 | } |
72 | 78 | |
73 | 79 |