Table 6.18 shows results from the 2000 General Social Survey relating happiness and religious attendance (1 = at most several times a year, 2 = once a month to several times a year, 3 = every week to several times a week). a. Fit a multinomial model. Conduct descriptive and inferential analyses about the association. b. Analyze the model goodness of fit. Solution summary(gsSurvey$happy) table(gsSurvey$happy) help(table) table(gsSurvey$happy, useNA=\"ifany\") table(gsSurvey$religion, useNA=\"ifany\") table(gsSurvey$religion, useNA=\"always\") table(gsSurvey$happy, gsSurvey$religion, useNA=\"ifany\") ggfluctuation(table(gsSurvey$happy, gsSurvey$religion, useNA=\"ifany\")) table(gsSurvey$happy, gsSurvey$health, useNA=\"ifany\") ggfluctuation(table(gsSurvey$happy, gsSurvey$health, useNA=\"ifany\")) library(productplots) prodplot(data=gsSurvey, ~happy+health, c(\"vspine\", \"hspine\")) ## depends very much on ordering of levels gsSurvey$health <- factor(gsSurvey$health, levels=c(\"1\", \"2\", \"3\")) gsSurvey$happy <- factor(gsSurvey$happy, levels=c(\"VERY HAPPY\",\"PRETTY HAPPY\",\"NOT TOO HAPPY\")) prodplot(data=gsSurvey, ~happy+health, c(\"vspine\", \"hspine\")) + aes(fill=happy) levels(gsSurvey$happy) <- c(\"VERY HAPPY\",\"PRETTY HAPPY\",\"NOT TOO HAPPY\") levels(gsSurvey$health) <- c(\"1\", \"2\", \"3\") prodplot(data=gsSurvey, ~happy+health, c(\"vspine\", \"hspine\")) + aes(fill=happy) prodplot(data=gsSurvey, ~happy+health, c(\"vspine\", \"hspine\"), na.rm=T) + aes(fill=happy) .