Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ch10 Ex7 #105

Open
actuarialcat opened this issue Apr 26, 2020 · 0 comments
Open

Ch10 Ex7 #105

actuarialcat opened this issue Apr 26, 2020 · 0 comments

Comments

@actuarialcat
Copy link

actuarialcat commented Apr 26, 2020

The question require us to scale each observation to have mean 0 and SD 1, not each predictor, in order to produce the desire proportionality.

Suggested answer:

data(USArrests)

scale_data = scale(t(USArrests))

correalation = cor(scale_data)
corr.1.minus.r = 1 - as.dist(correalation)

distance.squared = dist(t(scale_data), method = "euclidean") ^ 2

summary(corr.1.minus.r/distance.squared)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant