I have a dataset with social science data and I am trying to put OLS using linear as well as multiple regression loop in order to get a better picture of the dataset.
Here's how the data looks like:
Country code | Attribute 1 | Attribute 2 | .......
I want to check which attributes are best linked(wrt R square value).
For linear regression I think two loops within each other should work, but not able to figure out a way for multiple regression.
I'm not sure I 100% follow - are you just looking to see how the numeric data in your dataset correlates? To do so you could just use the
cor(dplyr::select(iris, where(is.numeric))) #> Sepal.Length Sepal.Width Petal.Length Petal.Width #> Sepal.Length 1.0000000 -0.1175698 0.8717538 0.8179411 #> Sepal.Width -0.1175698 1.0000000 -0.4284401 -0.3661259 #> Petal.Length 0.8717538 -0.4284401 1.0000000 0.9628654 #> Petal.Width 0.8179411 -0.3661259 0.9628654 1.0000000
Created on 2022-03-20 by the reprex package (v2.0.1)
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.