similar to: pooling categories in a contingency table

Displaying 20 results from an estimated 10000 matches similar to: "pooling categories in a contingency table"

2010 Mar 01
0
MASS::loglm - exploring a collection of models with add1, drop1
I'd like to fit and explore a collection of hierarchical loglinear models that might range from the independence model, ~ 1 + 2 + 3 + 4 to the saturated model, ~ 1 * 2 * 3 * 4 I can use add1 starting with a baseline model or drop1 starting with the saturated model, but I can't see how to get the model formulas or terms in each model as a *list* that I can work with further. Consider
2002 Apr 08
4
pooling categories in a table
I have a large n-way contingency table, constructed as a table object, and want to pool (collapse) some categories, summing the frequencies in all collapsed cells. How can I do this? thx, -Michael -- Michael Friendly friendly at yorku.ca York University http://www.math.yorku.ca/SCS/friendly.html Psychology Department 4700 Keele Street Tel: (416) 736-5115
2002 Dec 11
3
Excluding levels in table and xtabs
I'm trying to form contingincy tables among a set of character variables which were read from a .csv file and have missing represented as "". I want to exclude the missing levels from the table. > levels(CPIC) [1] "" "N" "Y" > levels(Manix) [1] "" "N" "Y" > xtabs(~CPIC + Manix, exclude=c("",NA))
2007 Jan 09
1
contingency table analysis; generalized linear model
Dear List, I would appreciate help on the following matter: I am aware that higher dimensional contingency tables can be analysed using either log-linear models or as a poisson regression using a generalized linear model: log-linear: loglm(~Age+Site, data=xtabs(~Age+Site, data=SSites.Rev, drop.unused.levels=T)) GLM: glm.table <- as.data.frame(xtabs(~Age+Site, data=SSites.Rev,
2007 Dec 16
1
format numbers in a contingency table
Hi, I am constructing a contingency table using xtabs. The function works great: mo yr Sep Oct Nov Dec 1950 -7.164486e-02 3.152674e-02 -1.283389e-02 1.570382e-01 1951 3.054293e-02 4.665234e-02 -2.445499e-04 8.720204e-02 1952 3.937034e-02 -4.790636e-02 5.022616e-02 1.180279e-01 but I wonder if there is an argument I can pass to xtabs
2008 Mar 29
1
Tabulating Sparse Contingency Table
I have a sparse contingency table (most cells are 0): > xtabs(~.,data[,idx:(idx+4)]) , , x3 = 1, x4 = 1, x5 = 1 x2 x1 1 2 3 1 0 0 31 2 0 0 112 3 0 0 94 , , x3 = 2, x4 = 1, x5 = 1 x2 x1 1 2 3 1 0 0 0 2 0 0 0 3 0 0 0 , , x3 = 3, x4 = 1, x5 = 1 x2 x1 1 2 3 1 0 0 0 2 0 0 0 3 0 0 0 , , x3 = 1, x4
2009 Feb 20
2
why doesn't table() have a data=argument?
In an Rweave tutorial written for possibly naive R users, I felt it necessary to explain why table() had to be used inside with(), whereas other tools like xtabs() had a data= argument. with() is quite nice for such cases, but it seems an unnecessary thing to learn right off. Before I turn this question into a request for R-devel, is there any inherent reason why it might be hard to add a
2008 Apr 22
2
Multidimensional contingency tables
How does one ideally handle and display multidimenstional contingency tables in R v. 2.6.2? E.g.: > prob1<- data.frame(victim=c(rep('white',4),rep('black',4)), + perp=c(rep('white',2),rep('black',2),rep('white',2),rep('black',2)), + death=rep(c('yes','no'),4), count=c(19,132,11,52,0,9,6,97)) > prob1 victim perp
2011 Jun 24
1
Converting an ftable (contingency table) to a dataframe in R
I am generating an ftable (by running ftable on the results of a xtabs command) and I am getting the following. ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Var1? Var2 date ? ? ? ? ? ? ? ? group? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 2007-01-01? ? ? ? ? q1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?1? ? 9 ? ? ? ? ? ? ? ? ? ? ?q2 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
2011 Apr 29
1
3-way contingency table
Hi, I have large data frame with many columns. A short example is given below: > dataH host ms01 ms31 ms33 ms34 1 cattle 4 20 9 6 2 sheep 4 3 4 5 3 cattle 4 3 4 5 4 cattle 4 3 4 5 5 sheep 4 3 5 5 6 goat 4 3 4 5 7 sheep 4 3 5 5 8 goat 4 3 4 5 9 goat 4 3 4 5 10 cattle
2012 Dec 27
0
Suggestion: 'method' slot for expand.grid() (incl. diffs)
Dear expeRts, The order in which the variables vary in expand.grid() is often unintuitive. I would like to suggest a 'method' slot for expand.grid() which requires only very little changes (100% backward compatible) and which allows one to control this order. Please find attached diffs against R-devel. Cheers, Marius ### ./src/library/base/R/expand.grid.R
2009 Jun 10
1
Analisys in Multidimensional contingency tables
Dear R-list, Hi everyone, Im trying to make an analysis of multidimensional contingency tables using R. I' working with the Agresti example where you have the data from 3 categories. The thing is how can I do the analisys using the G2 statistics. Somebody can send me an Idea? I attach the program where you can find the data. Best Regards, > prob1<-
2011 Jun 14
0
Analyzing three-way contingency tables with many zero cells
Hi all, I am trying to analyze the following data. The first three columns are categorical variables (colors of three traits for a peripatus species) and the last column the count of individuals in each three-way classification. I wish to test if the three traits vary independently or if they are correlated across individuals, i.e. - this is a basic three way contingency table question.
2005 Apr 15
2
abbreviate or wrap dimname labels
For a variety of displays (mosaicplots, barplots, ...) one often wants to either abbreviate or wrap long labels, particularly when these are made up of several words. In general, it would be nice to have a function, abbreviate.or.wrap <- function(x, maxlength=10, maxlines=2, split=" ") { } that would take a character vector or a list of vectors, x, and try to abbreviate or wrap
2002 Jan 30
1
mosaicplot(formula, data)--- bugged?
I have been tinkering with mosaicplot() and friends as a way of learning R. As part of this, I've written a pair.table() method for mosaic matrices, and would like to extend mosaicplot to work with loglin and logln (MASS) objects. I'm using R 1.4.0 on Win 98. I've been trying to figure out the formula interface, and think there's a bug, but not sure how to find it, yet alone fix
2006 Nov 26
2
Fixed zeros in tables
Hello All R Users, Function loglm() in library MASS can be cajoled to accomodate structural zeros in a cross-classification table. An example from Fienberg demonstrates how this can be done. My question is: Can the function glm() perform the same task? Can glm() estimate a log-linear model with fixed zeros like loglm()? Thanks for your help, Andrew ## Fienberg, The Analysis of Cross-Classified
2010 May 24
1
high-dimensional contingency table
Dear Friends. I am just starting to use R. And in this occasion I want to construct a high-dimensional contingency table, because I want to crate a mosaic plot with the vcd package. My table is in this format: año ac.rep cat.gru conteos 1 2005 R parejas 253 2 2005 N parejas 23 3 2006 R parejas 347 4 2006 N parejas 39 5 2007 R
2017 May 16
3
stopifnot() does not stop at first non-TRUE argument
switch(i, ...) extracts 'i'-th argument in '...'. It is like eval(as.name(paste0("..", i))) . Just mentioning other things: - For 'n', n <- nargs() can be used. - sys.call() can be used in place of match.call() . --------------------------- >>>>> peter dalgaard <pdalgd at gmail.com> >>>>> on Mon, 15 May 2017 16:28:42
2009 Jan 20
1
generalizing expand.table: table -> data.frame
In http://tolstoy.newcastle.edu.au/R/e2/help/06/10/3064.html a method was given for converting a frequency table to an expanded data frame representing each observation as a set of factors. A slightly modified version was later included in the NCStats package, only on http://rforge.net/ (and it has too many dependencies to be useful). I've tried to make it more general, allowing an input
2011 May 07
1
generate multiple mvrnorm samples using apply-like
I want to generate multiple multivariate normal samples with different mean vectors and common covariance matrix. I can do this with a loop, but can't quite figure out how to do it with apply and friends. In the example below, I want values to have 3 columns: group, x, y # number of groups, and group means x <- jitter(seq(2,10,by=2)) y <- x + rnorm(length(x), 0, .5) means <-