Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Construct a table of counts and a table of proportions ( with appropriate comparison proportions to answer the question of interest ) . Use R

Construct a table of counts and a table of proportions (with appropriate comparison
proportions to answer the question of interest). Use R to obtain these tables, but do NOT copy
and paste those tables into your assignment. Instead, use the tables from R to construct your
own table where you include both the counts and proportions (or percentages) in the same
table.
R code for table of counts
tbl - table(zzz$yyy, zzz$xx)
rownames(tbl)- c("","")
colnames(tbl)- c("","")
tbl
Replace zzz with the name of the data set
Replace yyy with the name of the response variable
2
Replace xxx with the name of the explanatory variable
o Give the categories of the rows appropriate names in the rownames(tbl) line
of code.
Remember, the rows are the categories of the RESPONSE variable. When
a variable is coded numerically, whatever is coded 0 will be in the
first row. Therefore, type an appropriate label for the category
coded 0 between the first set of double quotes and an appropriate
label for the category coded 1 between the second set of double
quotes.
o Give the categories of the columns appropriate names in the colnames(tbl)
line of code.
Remember, the categories are the categories of the EXPLANATORY
variable. When a variable is coded with text, whatever is comes
first alphabetically will be in the first column. Therefore, type an
appropriate label for the category that comes first alphabetically
between the first set of double quotes and an appropriate label for
the category that comes second alphabetically between the second set
of double quotes.
R code for table of proportions
prop_tbl - prop.table(tbl,2)
prop_tbl
Note: the last argument tells which total to use in calculation of
proportions. "2" uses column totals ("1" would use the row totals))
Dataset included as the picture. Thank you!
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part I Lnai 8724

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448475, 978-3662448472

More Books

Students also viewed these Databases questions

Question

What is NAFTA? How does it work?

Answered: 1 week ago