Fill This Form To Receive Instant Help

Help in Homework
Facebook Reviews
Quora Reviews
Google UK Reviews


Homework answers / question archive / Needs to be complete in R Studio showing all R code

Needs to be complete in R Studio showing all R code

Computer Science

Needs to be complete in R Studio showing all R code. 

Data

Use dataset Affairs in the AER R package. 

Fair's Extramarital Affairs Data

Description

Infidelity data, known as Fair's Affairs. Cross-section data from a survey conducted by Psychology Today in 1969.

Usage

data("Affairs")

Format

A data frame containing 601 observations on 9 variables.

affairs

numeric. How often engaged in extramarital sexual intercourse during the past year? 0 = none, 1 = once, 2 = twice, 3 = 3 times, 7 = 4-10 times, 12 = monthly, 12 = weekly, 12 = daily.

gender

factor indicating gender.

age

numeric variable coding age in years: 17.5 = under 20, 22 = 20-24, 27 = 25-29, 32 = 30-34, 37 = 35-39, 42 = 40-44, 47 = 45-49, 52 = 50-54, 57 = 55 or over.

yearsmarried

numeric variable coding number of years married: 0.125 = 3 months or less, 0.417 = 4-6 months, 0.75 = 6 months-1 year, 1.5 = 1-2 years, 4 = 3-5 years, 7 = 6-8 years, 10 = 9-11 years, 15 = 12 or more years.

children

factor. Are there children in the marriage?

religiousness

numeric variable coding religiousness: 1 = anti, 2 = not at all, 3 = slightly, 4 = somewhat, 5 = very.

education

numeric variable coding level of education: 9 = grade school, 12 = high school graduate, 14 = some college, 16 = college graduate, 17 = some graduate work, 18 = master's degree, 20 = Ph.D., M.D., or other advanced degree.

occupation

numeric variable coding occupation according to Hollingshead classification (reverse numbering).

rating

numeric variable coding self rating of marriage: 1 = very unhappy, 2 = somewhat unhappy, 3 = average, 4 = happier than average, 5 = very happy.

Source

Online complements to Greene (2003). Table F22.2.

http://pages.stern.nyu.edu/~wgreene/Text/tables/tablelist5.htm

References

Greene, W.H. (2003). Econometric Analysis, 5th edition. Upper Saddle River, NJ: Prentice Hall.

Fair, R.C. (1978). A Theory of Extramarital Affairs. Journal of Political Economy86, 45-61.

 

3. Model Fitting and Residual plots 

a. Fit a linear model for affairs using all predictors. Call this model g. Show the coefficients and interpret the coefficient for childrenyes.

b. Obtain and show plots of the g-residuals against the fitted values. Does this plot reveal any abnormal patterns, if so why?

c. Obtain and show the boxplots of the g-residuals versus gender and children. Does the plot reveal any patterns?

d. Using the g-residuals, obtain and show the Normal QQ-Plot. Does the plot indicate the residuals are normal or not normal? Explain your answer.

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE