Question

In: Statistics and Probability

"Accident" in R package vcdExtra gives a 4-way table of frequencies of traffic accident victims in...

"Accident" in R package vcdExtra gives a 4-way table of frequencies of traffic accident victims in France in 1958. See: help(Accident, package="vcdExtra")

I want to create a binomial distribution with the response variable "result" (died or injured). In particular, I want to create a one-way frequency table with:

-age and frequency of injured

-mode and frequency of injured

-age and frequency of died

-mode and frequency of died

What is the code for making a one-way frequency table?

Solutions

Expert Solution

R code

------

install.packages('vcdExtra')
library(vcdExtra)

head(Accident)

#-age and frequency of injured
aggregate(Freq ~ age, subset(Accident,result=="Injured"), sum)

#-mode and frequency of injured
aggregate(Freq ~ mode, subset(Accident,result=="Injured"), sum)

#-age and frequency of died
aggregate(Freq ~ age, subset(Accident,result=="Died"), sum)

#-mode and frequency of died
aggregate(Freq ~ mode, subset(Accident,result=="Died"), sum)
---------

#get these


Related Solutions

Expalin with every steaps and explanations The accompanying contingency table gives frequencies for a classification of...
Expalin with every steaps and explanations The accompanying contingency table gives frequencies for a classification of the equipment used in a manufacturing plant. Equipment use Low Moderate High In working Order 10 18 12 Under repair 2 6 8 a. Find the probability that a randomly selected piece of equipment is a Moderate item or that it is in working order. b. Find the probability that a randomly selected piece of equipment is a high-use item given that it is...
The following two-way contingency table gives the breakdown of the population of adults in a particular...
The following two-way contingency table gives the breakdown of the population of adults in a particular locale according to employment type and level of life insurance: Level of Insurance Employment Type Low Medium High Unskilled 0.07 0.19 0.00 Semi-skilled 0.04 0.28 0.08 Skilled 0.03 0.18 0.05 Professional 0.01 0.05 0.02 An adult is selected at random. Find each of the following probabilities. a. The person has a high level of life insurance. b. The person has a high level of...
A contingency table, also called a two-way table, is made up of r rows and c...
A contingency table, also called a two-way table, is made up of r rows and c columns. In general, how many cells are in a contingency table with r rows and c columns? 1) r x c (r times c) 2) (r-1)(c-1) 3) r + c In general, how many degrees of freedom are associated with a contingency table with r rows and c columns? 1) r + c 2) r times c 3) (r-1)(c-1) When should Fishers Exact Test...
The `R` package \texttt{moments} gives us two very useful functions; \texttt{skewness} and \texttt{kurtosis}. If data is...
The `R` package \texttt{moments} gives us two very useful functions; \texttt{skewness} and \texttt{kurtosis}. If data is truly normal, it should have a skewness value of 0 and a kurtosis value of 3. Write an R function that conducts a normality test as follows: it takes as input a data set, calculates a bootstrap confidence interval for the skewness, calculates a bootstrap confidence interval for the kurtosis, then sees if 0 is in the skewness interval and 3 is in the...
The following table shows the rate R of vehicular involvement in traffic accidents (per 100,000,000 vehicle-miles)...
The following table shows the rate R of vehicular involvement in traffic accidents (per 100,000,000 vehicle-miles) as a function of vehicular speed s, in miles per hour, for commercial vehicles driving at night on urban streets. Speed s Accident rate R 20 1500 25 650 30 200 35 400 40 650 45 1300 (a) Use regression to find a quadratic model for the data. (Round the regression parameters to two decimal places.) R = (b) Calculate R(65). (Round your answer...
design a four way traffic light system. with state diagram, truth table, jk flip flop, kmap...
design a four way traffic light system. with state diagram, truth table, jk flip flop, kmap and final circuit
An ANOVA table for a one-way experiment gives the following: Source df SS Between factors 2...
An ANOVA table for a one-way experiment gives the following: Source df SS Between factors 2 810 Within (error) 8 720 Answer true or false and explain for the following six statements: The null hypothesis is that all four means are equal. The calculated value of F is 4.500. The critical value for F for 5% significance is 6.06. The null hypothesis cannot be rejected at 5% significance. The null hypothesis cannot be rejected at 1% significance. There are 10...
design 4 bit four way traffic light signal by using j k flip flop and 555...
design 4 bit four way traffic light signal by using j k flip flop and 555 timer ic state equation and k map and also schematic diagram.
How to do financial statement analysis? 4-table chart. Easy way to remember?
How to do financial statement analysis? 4-table chart. Easy way to remember?
OH Rate: $4.7 per DLH Table 4 gives you the information for the last two months...
OH Rate: $4.7 per DLH Table 4 gives you the information for the last two months on the overhead cost. Use this information to determine the fixed and variable portions of the cost. (You will need this information to complete Table 5). Machine hours have been determined as the best cost driver for separating mixed cost into their fixed and variable portions. It takes approximately 10 minutes of total machine time for each cereal box (or 1/6 a machine hour...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT