Question

In: Statistics and Probability

The data can find in potuse (faraway package). The national Youth Survey collected a sample of...

The data can find in potuse (faraway package).

The national Youth Survey collected a sample of 11-17 year-olds with 117 boys and 120 girls, asking questions about marijuana usage. This data is actually longitudinal – the same boys and girls are followed for five years. However, for the purposes of this question, imagine that the data is cross-sectional, that is, a different sample of boys and girls are sampled each year. Build a model for the different levels of marijuana usage, describing the trend over time and the difference between the sexes.

USE R CODE and interpret

Solutions

Expert Solution

library(faraway)
library(tidyverse)
data1 = potuse
gg_interaction_plot <- function(data, formula) {
  
formula <- as.formula(formula)
  
y_var <- as.character(formula[2])
  
x_vars <- as.character(formula[3]) %>%
str_split(" \\+ ") %>% unlist()
  
data <- mutate_at(data, x_vars, as.factor)
  
shp_vars <- rev(x_vars)
  
map2(x_vars, shp_vars,
~ ggplot(data, aes_(y = as.name(y_var), x = as.name(..1), shape = as.name(..2))) +
geom_point(position = position_jitter(width = .1)) +
stat_summary(fun.y = "mean", geom = "line",
aes_(group = as.name(..2), linetype = as.name(..2))) +
scale_shape_manual(values = 15:25) +
theme(legend.position = "top", legend.direction = "horizontal")) %>%
cowplot::plot_grid(plotlist = ., ncol = 2)
  
}
glm(count~., data = data1)

Coefficients:
(Intercept) sex year.76 year.77 year.78 year.79 year.80
4.99794 0.01646 -0.66049 -0.55247 -0.42284 -0.35494 -0.27778

Degrees of Freedom: 485 Total (i.e. Null); 479 Residual
Null Deviance:   6591
Residual Deviance: 6227    AIC: 2635


Related Solutions

I am using the phbirths data in the faraway package in R. I want to: 1)...
I am using the phbirths data in the faraway package in R. I want to: 1) create a plot of the birth weight vs the gestational age and I want to colour code the points based on the mothers smoking status to determine whether or not smoking affects the babies. 2) fit a simple model (one regression line) along with both the main effects (parallel lines) and interaction (non parallel lines) ANCOVA model to the data and find out which...
A survey on men and women’s shopping behavior collected data from a sample of 50 men...
A survey on men and women’s shopping behavior collected data from a sample of 50 men and 50 women. The following data on online shopping spending every month. Men Women 148 272 211 176 256 251 309 235 190 145 205 179 203 30 208 135 231 200 125 270 149 174 205 123 195 199 178 195 196 192 198 102 110 110 199 184 181 228 168 316 218 170 222 234 206 163 168 245 239 174...
The following data were collected from a survey of 10 randomly selected college students: Find the...
The following data were collected from a survey of 10 randomly selected college students: Find the mean, median, mode, variance, standard deviation, the five number summary report of the hours per week of the sample of students’ studied. Show your work. Student ID Facebook # hours of study per week 244701130 Yes 8 302896051 no 5 734077249 yes 11 891072704 yes 5 730265917 yes 9 894866913 no 6 644678646 no 1 369417477 yes 1 388511718 yes 2 554470987 no 1
Teen obesity: The 2013 National Youth Risk Behavior Survey (YRBS) reported that 13.7% of U.S. students...
Teen obesity: The 2013 National Youth Risk Behavior Survey (YRBS) reported that 13.7% of U.S. students in grades 9 through 12 who attend public and private school were obese. Suppose that 15% of a random sample of 300 U.S. public high school students wereobese. Source: Kann, L., Kinchen, S., Shanklin, S.L., Flint, K.H., Hawkins, J., Harris, W.A., et. al.(2013) YRBS 2013 Using the estimate from the 2013 YRBS, we calculate a standard error of 0.020. Since the data allows the...
A recent survey on the usage of cosmetics among youth provided the following data: Year: 2004;...
A recent survey on the usage of cosmetics among youth provided the following data: Year: 2004; Sample size: 5000; Youth who use cosmetics: 36% Year: 2014; Sample size: 4250; Youth who use cosmetics: 47% Construct a 99% confidence interval for the difference in population proportions of youth who were using cosmetics in 2004 and youth who were using cosmetics in 2014. Assume that random samples are obtained and the samples are independent. (Round your answers to three decimal places.) z0.10...
The data in the table below are the result of a random survey of 39 national...
The data in the table below are the result of a random survey of 39 national flags (with replacement between picks) from various countries. We are interested in finding a confidence interval for the true mean number of colors on a national flag. Let X = the number of colors on a national flag. X Freq. 1 1 2 7 3 18 4 7 5 6 Construct a 95% confidence interval for the true mean number of colors on national...
The data in the table below are the result of a random survey of 39 national...
The data in the table below are the result of a random survey of 39 national flags (with replacement between picks) from various countries. We are interested in finding a confidence interval for the true mean number of colors on a national flag. Let X = the number of colors on a national flag. X Freq. 1 1 2 7 3 18 4 7 5 6 Construct a 95% confidence interval for the true mean number of colors on national...
Data can be collected and organized as an ordered pair (x, y). The data can be...
Data can be collected and organized as an ordered pair (x, y). The data can be analyzed to determine the type and strength of a correlation and to calculate a regression line in order to make a prediction. Use the internet to find a data set of ordered pairs. Key terms to search: Free Public Data Sets and Medical Data Sets. Create a Post: Introduce your Data Set. Which would be the independent variable, and which would be the dependent...
A business consultant for the National Transportation Safety Board (NTSB), collected data on the safety of...
A business consultant for the National Transportation Safety Board (NTSB), collected data on the safety of hybrid automobiles traveling at 30, 40 and 50 miles per hour.  She randomly assigned the same hybrid model to each condition and collected data on the pressure applied to the driver’s head during a crash into a wall at each speed. What is the independent variable? Dependent variable? Is she able to make cause and effect statements about the cars the head pressure? Explain. ...
A national survey of insurance offices was taken, resulting in a random sample of 253 companies....
A national survey of insurance offices was taken, resulting in a random sample of 253 companies. Of these 253 companies, 181 responded that they were going to purchase new software for their offices in the next year. Construct a 90% confidence interval to estimate the population proportion of insurance offices that intend to purchase new software during the next year.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT