similar to: apply: return list of matrices

Displaying 20 results from an estimated 4000 matches similar to: "apply: return list of matrices"

2012 Jul 02
5
ggplot: dodge positions
Dear all, I want to get a series of boxplots (grouped by two factors) and I want to overlay the original observations and the following code does almost what I want: library(ggplot) ddf <- data.frame(x=factor(rep(LETTERS[1:4], each=30)), y = runif(120,0,10), grp = factor(rep(rep(1:3, 10), 4))) ggplot(ddf, aes(x, y, colour=grp)) + geom_boxplot() + geom_point() Yet the position of the points
2012 Jul 03
2
ggplot2: legend
Dear all, I produced the following graph with ggplot which is almost fine, yet I don't like that the legend for "Means" and "Observations" includes a line, though no line is used in the plot for those two (the line for "Overall Mean" on the other hand is wanted): library(ggplot2) ddf <- data.frame(x = factor(rep(LETTERS[1:2], 5)), y = rnorm(10)) p <-
2009 Feb 24
2
Simulating contingency table (Basic question, help please)
I'd like to carry out a Monte Carlo simulation test where given data is a contingency table. I think this is something to do with using rmultinonom(), but I'm not sure how to code this, to simulate contingency tables. Could anyone please help with how to use R to simulate contingency tables like this? -- View this message in context:
2012 Apr 10
1
compare two matrices
Dear Members, I have two estimated transition matrices and I want to compare them. In fact I want to check the hypothesis if they come from the same process. I tried to look for some test but all I found was independence test of contingency tables. The following code shows that the usual chi-squared test statistic does not follow chisq distribution. MCRepl <- 5000 khi12 <- rep(0,MCRepl)
2001 Sep 11
1
[Q] Sparse Matrices in R?
Does anyone knows if there is a way to handle sparse matrices in R? More precisely I am looking for a way to do correspondance analysis on a contingency table which is quite huge (1,000 x 10,000) but sparse (i.e. full of zero). Creating it directly in R (eg as x <- array(0,c(1000,10000) then filling the non zero cells) seems definitely not the good solution as R is then unable to process it
2003 Nov 06
1
Question about computing offsets automatically
Hi, I'm using R version 1.8.0 on Windows NT. When fitting a glm with Poisson random component and a log link, I frequently need to include an offset. Typically I use xtabs or table to get the counts for the contingency table, and then I use as.data.frame.table to create a data frame that I can use in the glm function. I have not found an option that allows me to total the offset variable to
2005 Feb 15
1
Tests on contingency tables
Dear all, I have a dataset with qualitative variables (factors) and I want to test the null hypothesis of independance between two variables for each pair by using appropriate tests on contingency tables. I first applied chisq.test and obtained dependance in almost all cases with extremely small p-values and warning messages. > chisq.test(table(data$ins.f, data$ins.st))$p.val [1]
2012 May 19
1
Contingency table and mean(sd)
Hi All, I have a question regarding contingency tables. I would like to calculate the mean and standard deviation of a continuous variable from my own dataset based on the percentages of a contingency table I obtained from a scientific article. dataset<- data.frame(cbind(case=rep(0:1,5), x1=c(1:10), x2=c(0:9))) contingency_table<- matrix(c(100, 75, 65, 85, 90, 87), nrow=3, ncol=3) In
2009 Dec 09
1
Exporting Contingency Tables with xtable
Dear R-philes: I am having an issue with exporting contingency tables with xtable(). I set up a contingency and convert it to a matrix for passing to xtable() as shown below. v.cont.table <- table(v_lda$class, grps, dnn=c("predicted", "observed")) v.cont.mat <- as.matrix(v.cont.table) Both produce output as follows: observed predicted uh uh~ uh 201
2013 Mar 04
1
package ‘contingency.tables’ is not available (for R version 2.15.2)
I am trying to create contingency tables (to evaluate prior to performing Pearson's Chi-Squared test for independence). I would like to see column and row totals as well as expected and observed values and cell counts. I tried to use the package "contingency. tables" but get the following warning: package ‘contingency.tables’ is not available (for R versions 2.15.2) Is there
2008 Feb 14
3
contingency table
Hello! May you help me? I'm trying to do a contingency table using this > data(iris) > library(rpart) > modelo <- rpart(Species ~., iris) > prev <- predict(modelo, iris) Finally the contingency table > table(iris$Species, prev) But an error occurs: Error in table(iris$Species, prev) : all arguments must have the same length And I do not understand why, may you
2000 Sep 20
1
SV: sample from contingency table
I have had the same problem and I wrote this function rmulti <- function(n, size, p) { NrDim <- length(p) if(NrDim<2) stop("The simulated variabel has to be at least 2-dimensional") res <- matrix(data=NA, nrow=n, ncol=NrDim) p <- p/sum(p) TempSize <- size for(i in 1:NrDim) { TempP <- p[i]/sum(p[i:NrDim]) TempBin <- rbinom(n=n, size=TempSize,
2011 Feb 24
1
reshaping list into a contingency table
Hi all, I have been struggling with this problem for a few days. I have a data table like this: gene rpkm1 diff1 rpkm2 diff2 gene1 23 50 13 120 gene2 111 220 827 1200 gene3 75 998 71 910 And I want to re-format it so that, for each gene, I have a 2x2 contingency table, such as: gene rpkm diff gene1 23 50 gene1 13 120 gene2 111 220 gene2 827
2012 May 28
2
import contingency table
hello everyone, i often work on contingency table that I create from data.frame (with table() function) but a friend sent me an excel sheet wich *already is* a contingency table (just a simple 2 way table !...) any clue on how to import it in R (keeping row names and col names) ? any tuto I come accross only mention the table transformation, but never the import of such data I only found
2011 Mar 02
4
Contingency table in R
Hi, I have a table in R with data I needed and need to create a contingency table out of it. The table I have so far looks like this: Binger r DietType No Yes Dangerous 15 12 Healthy 52 9 None 134 24 Unhealthy 72 23 These are the error messages that I keep getting whenever I try to get a contingency table. I'm not sure why it won't work
2004 Apr 14
1
Aggregate drops empty subsets
Greetings, R community. I am trying to create a multi-dimensional contingency table suitable for analysis by glm() using the poisson family. I have three factors, each with four levels, with some observed zeros. I'm trying to use aggregate to construct my contingency table, but it drops empty subsets, so the zeros get lost. I also tried tapply() but it doesn't carry over the main
2009 Dec 22
4
Problem with expand.grid
Hi All, This example code ---------------- dDF <- structure(list(y = c(4.75587, 4.8451, 5.04139, 4.85733, 5.20412, 5.92428, 5.69897, 4.78958, 4, 4), t = c(0, 48, 144, 192, 240, 312, 360, 0, 48, 144), Batch = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ), T = c(2, 2, 2, 2, 2, 2, 2, 2, 2, 2), pH = c(4.6, 4.6, 4.6, 4.6, 4.6, 4.6, 4.6, 4.6, 4.6, 4.6), S = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), N = c(0, 0, 0, 0,
2010 Mar 13
2
Two questions, first about contingency tables, and second about table () and data.frame (), from a visually impaired user.
Hi all, I want to make a contingency table in R. I want to tabulate two variables, one as the independent and second as the dependent variable. The IV has two categories, namely, birth complications, and no birth complications. The frequency of birth complication category is fifty, and the frequency of no birth complication category is 34. The categories and frequencies of DV follows.
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
2001 Apr 15
1
contingency tables in R
Dear List: Most of the analysis I do involves contingency tables. I am migrating to R from Stata and I have a number of questions about using contingency tables in R. I suspect that most of the things I want to do are very short R scripts that people on this list probably have. I wonder if you would be willing to share them. First, the presentation of tables by table() is not