User Tools

Site Tools


c:ma:2019:multiple_regression_exercise

Class Activities

Ex. 1

  • Install packages ISLR
  • use a dataset, Carseats
  • Build regression models with a DV, sales and IVs, your choices
  • Use ?Carseats command for the explanation of the dataset
  • Use str function to see the characteristic of each variable. Make it sure that SelvesLoc variable should be factor, not int or anything.
  • 변인설명을 토대로 가설만들기
    • 종속변인 = Sales
    • 독립변인 = 숫자변인 1 + 종류변인 1 (조별 선택)
    • Multiple regression without interactin
    • Multiple regression with interaction
  • 가설 만들기
    • 종속변인 Sales
    • 독립변인 여러개 (interaction 없이)
    • Modeling 해 볼 것

see hierarchical regression
see also statistical regression methods ← 많이 쓰이지 않음

  • Make a full model (with all variables) then reduce down the model until you find it fitted.
  • Make a null model (with no variables) then, build up the model with additional IVs until you find a fitted model.
  • Can we use step or stepAIC (MASS package needed) function?
  • Interpret the result

> step(lm.full, direction=“back”)

eg_script

Ex. 2

  • Install packages tidyverse
  • load the tidyverse
  • install.packages("car")
  • install.packages("carData")
  • load the car and the carData
  • data("Salaries", package = "carData")
  • ?Salaries
    • explain what it is
    • describe the data set

—-

  • Regress sex variable on salary variable
  • Write the regression model
  • Discuss the difference male and female (sex)
  • Use rank variable for the same purpose
  • Write the regression model
  • Regress rank + sex on salary
  • How do you interpret the result?
  • And regress rank + sex + rank:sex on salary
  • How do you interpret this result?
  • Do factorial ANOVA test with rank and sex on salary
  • How do you interpret the result?
  • Test regression model of your own choice
  • Interpret the result

위의 Salaries 데이터사용이 안 될 때

  • download to R from here salaries.csv
    • use to import the data set. Salaries <- read.csv("http://commres.net/wiki/_media/salaries.csv")
  • for information about Salaries (it may not be loaded),
    • use ??Salaries to describe the data set.

—–
Please copy and paste the proper r command and output to a txt file (use notepad or some other text editing program). You could use MS Word, but, please make it sure that you use type-setting fonts such as “Courier New.” The below output, as an example, includes the r command head(Salaries) and the output.
<code>

Discussion

Common topics

  • What affects students GPA? Or what determines students' GPA?

Group topics

Making Questionnaire

Questions you submit at the ajoubb.
Then we will list questions in Google docs Google survey

c/ma/2019/multiple_regression_exercise.txt · Last modified: 2021/11/11 10:14 by hkimscil