• Keine Ergebnisse gefunden

Component + Residual Plots

N/A
N/A
Protected

Academic year: 2022

Aktie "Component + Residual Plots"

Copied!
19
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Solution to Series 7

1. a) We begin the analysis by plotting histograms and barplots for all variables.

> ## load data

> load("CustomerWinBack.rda")

> ## create factor variable for gender

> cwb$gender <- factor(cwb$gender, levels=c(0,1), labels=c("Female", "Male"))

> ## histograms und barplots

> par(mfrow=c(2,3))

> hist(cwb$duration, col="limegreen", main="Duration") ## log ?

> plot(table(cwb$offer), main="Offer") ## change to factor variable ?

> hist(cwb$lapse, col="limegreen", main="Lapse") ## log ?

> hist(cwb$price, col="limegreen", main="Price")

> plot(table(cwb$gender), main="Gender")

> hist(cwb$age, col="limegreen", main="Age") Duration

cwb$duration

Frequency

0 500 1000

02060 04080120

Offer

table(cwb$offer)

20 25 30

Lapse

cwb$lapse

Frequency

0 50 100 200

02050

Price

cwb$price

Frequency

−40 0 20

050100 050150

Gender

table(cwb$gender)

Female Male

Age

cwb$age

Frequency

30 50 70

02040

First, we need to create a factor variable forgender. The variablesdurationandlapseare candi- dates for a log-transformation. We shall not do these transformations for now. Instead, we fit a first model with all untrasformed variables as predictors and assess the fit.

OLS with all variables

> ## fit OLS

> fit.ols <- lm(duration ~ offer + lapse + price + gender + age, data=cwb)

> par(mfrow=c(2,2))

> source("../../series6/ex1/resplot.R")

> resplot(fit.ols)

Referenzen

ÄHNLICHE DOKUMENTE

‘fake’ to an exact copy of an already existing work, which is then passed off as the original, and ‘forgery’ to a work that is not an exact copy, but rather done ‘in the

Selectively center-labeled network chains allow the microscopic strain to be probed locally and the transition of affine strain with tube confinement to under-affine in a

The significance of achieving undetectable MRD earlier versus later in disease course (i.e. For patients eligible to transplant, MRD testing should be done at two 98. timepoints:

In Japan, company data in their primary form are mainly available in four types: uncon- solidated annual accounts according to the Commercial Code, reports according to the

We will leave the variable pat unmodified because it is definitely a key factor to take into account when length is the response variable and change the others to solve

id randomly assigned ID of the hospital length average duration of hospital stay (in days) age average age of patients (in years).. inf averaged infection risk

Noting that various commentators have questioned both premises, Gillman tests this by examining seven different measures of the general rate of profit (total

Klemm on his sixtieth birthday The phenomenon of electrotransport in a binary liquid alloy with perfectly miscible components is representable in terms of