Displaying 20 results from an estimated 10000 matches similar to: "creating a contingency table from a data.frame automatically (NOT BY HAND)"
2012 Aug 04
3
Questionnaire Analysis virtually without continuous Variables
Hello!
I am doing an analysis on a questionnaire of hunters taken in 4
different districts of some mysterious foreign country. The aim of the
study was to gather info on the factors that determine the hunting
success of a peculiarly beautiful bird in that area. All variables are
factors, i.e. they are variables such as "Use of Guns - yes / no", "Use
of Dogs - yes / no" and
2006 Mar 06
4
Contingency table and zeros
Hello,
Let's assume I have a vector of integers :
> myvector <- c(1, 2, 3, 2, 1, 3, 5)
My purpose is to obtain the cumulative distribution of these numerical
data, i.e. something like :
value nb_occur.
<=1 2
<=2 4
<=3 6
<=4 6
<=5 7
For this, I create a table with ;
> mytable <- table(myvector)
1 2 3 5
2 2 2 1
However, table() returns an array
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
2013 Dec 17
1
What is the formula of Pseudo-F statistic in capscale in vegan?
Dear R-help,
We are conducting a distance-based redundancy analysis using capscale and
then testing for statistical significance for six terms in the model for the
constrained ordination using anova.cca in the vegan package. The
significance test is sequential, i.e., testing for significance of a term
only after accounting for all preceding terms. Could someone please provide
us with either the
2008 Jan 10
1
question regarding hypothesis testing in contingency tables
Hi R-users!
I have the following example:
a<-data.frame(cat=c(5,10,15), dog=c(5,10, 15), mouse=c(10,10,20))
b<-data.frame(cat=c(15,10,5), dog=c(15, 10, 5), mouse=c(20,10,10))
rownames(b)<-c("scared", "happy", "sad")
rownames(a)<-c("scared", "happy", "sad")
Let's say that a and b are 2 contingency tables and 5,10, 15, 20
2012 Mar 16
2
contingency tables
Ok, before I definetly give up, and throw the laptop out of the window, or
fill my data.frame manually, I'll ask for some help.
I have a data.frame named MyTable with 3 columns, that looks like this:
V1 V2 V3
red-j appearanceblood-n 105.032
red-j appearanceground-n 93.749
red-j appearancesea-n 102.167
red-j appearancesky-n 10.898
2013 May 07
2
recode categorial vars into binary data
Dear R-List,
I would like to recode categorial variables into binary data, so that all values above median are coded 1 and all values below 0, separating each var into two equally large groups (e.g. good performers = 0 vs. bad performers =1).
I have not succeeded so far in finding a nice solution to do that in R. I thought there might be a better way than ordering each column and recoding the
2013 May 07
2
recode categorial vars into binary data
Dear R-List,
I would like to recode categorial variables into binary data, so that all values above median are coded 1 and all values below 0, separating each var into two equally large groups (e.g. good performers = 0 vs. bad performers =1).
I have not succeeded so far in finding a nice solution to do that in R. I thought there might be a better way than ordering each column and recoding the
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:
2007 Sep 25
1
Spacing between x axis and labels
Hi,
my x-axis contains labels that consist of two lines (the actual label
and below information about groupsize). Unfortunately, there is too
little spacing between labels and tickmarks in this situation. Is there
a parameter to tune spacing between axis and labels?
Thanks,
Chris
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
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
2000 Aug 23
1
3D perspective of a contingency table
How can I draw a 3D perspective of a contingency table, that is
showing 3D bars whose height is in proportion of the table cells?
---------------
Charles RAUX,
Laboratoire d'Economie des Transports
CNRS-Universit? Lumi?re Lyon 2-ENTPE
email : charles.raux at let.ish-lyon.cnrs.fr
http://www.ish-lyon.cnrs.fr/let
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
2003 Apr 24
3
Detailed contingency tables
Is there any existing function for creating contingency tables that will
display counts, row, column, and cell percentages in the same
tables....anything similar to crosstabs in S?
Marc W. Zodet, MS
Health Statistician
Center for Cost and Financing Studies
Division of Statistical Research and Methods
2101 East Jefferson Street, Suite 500
Rockville, Maryland 20852
Phone: 301-594-7072
Fax:
2008 Mar 18
1
ask for help how to get accumulate contingency table?
Hi, I post the question again.
x<-rep(c(2,3,4),20)
y<-sample(rep(c(0,1),30))
tr<-rep(c(1:5),6)
data1<-data.frame(x,y,tr)
data1<-data1[order(data1$tr),]
> data1
x y tr
2 1 1
4 0 1
3 1 1
2 1 1
4 1 1
3 1 1
2 0 1
4 0 1
3 0 1
2 0 1
4 0 1
3 1 1
3 0 2
2 0 2
>table(data1)
tr = 1
y
x 0 1
2 2 2
3 1 3
4 3 1
tr = 2
y
x 0 1
2 2 2
3 2 2
4 1 3
2012 Dec 01
4
Getting all possible contingency tables
Hello all,
Let say I have 2-way contingency table:
Tab <- matrix(c(8, 10, 12, 6), nr = 2)
and the Chi-squared test could not reject the independence:
> chisq.test(Tab)
Pearson's Chi-squared test with Yates' continuity correction
data: Tab
X-squared = 1.0125, df = 1, p-value = 0.3143
However I want to get all possible contingency tables under this
independence
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,
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]
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