The aim of our research is to assess which are the main drivedrs of CSR. Here we upload our dataset.

The dataset called CSR_data displays 6580 entries with N variables over a 3 year period )2004 - 2005 - 2006. For tidiness purposes we decided to focus on a single period which we call y4 - year 2004. This is the only data filtering process of our data. Hence here we will work with y4 wich displays data for 2071 companies and their relative 90 variables. In order to do so we set the dependent variable as soc_env_score.

setwd("~/Desktop/UPF - MSc Management and BuA/SECOND Term/Marketing Resaerch")
library(readxl)
#CSR_data_1_ <- read_excel("~/Desktop/UPF - MSc Management and BuA/SECOND Term/Marketing Resaerch/CSR_data (1).xlsx")
View(CSR_data_1_)  
Error in as.data.frame(x): object 'CSR_data_1_' not found
#install.packages("lavaan")
library(lavaan)
#install.packages("semPlot")
library(semPlot)
#install.packages("lavaanPlot")
library("lavaanPlot")
library(dplyr)
library(tidyverse)
library(stats)
y4 <- filter(CSR_data_1_, year ==  "2004")
Error in filter(CSR_data_1_, year == "2004"): object 'CSR_data_1_' not found
#this are commeted out to make the mark down more clean
#head(y4)
attach(y4)
Error in attach(y4): object 'y4' not found
#tail(y4)        
#glimpse(y4)

After having filterd the data we renamed our dependent variable, CSRlevel. This variable, called in the data set soc_env_score stands for the evaluation of companies CSR.

In order to make ur project meaningful we decided to divide the most relevant variable (out of the 90 we could chose) in 3 macrogroups so that we could asses which were the most influenmtial also from a logicl point of view. This was possible to achieve thanks to a deeper understanding of the topic of Corporate Social Responsibility.

The three macrogroups are: Governance, Financial and Culture. Here we disentangle singularly heach of them.

The first one, called Governance, is a macrovariable that explains at a governance level what are the main drivers of CSR level, this is related to: Invetmentscoheld namely the return on investment capital, ceoduality namely the presence of the CEO in both board and ceo postion, femaleparticipation namely level of females in the Board, board_indipendence namely a score that indicates the indipendece of the board of directors of and healthexpenditure which indicates the country level of expenditure for Health related topics.

##Goverance
CSRlevel <- y4$soc_env_score
Error in eval(expr, envir, enclos): object 'y4' not found
IC <- y4$investmntcoheld
Error in eval(expr, envir, enclos): object 'y4' not found
CD <- y4$ceoduality
Error in eval(expr, envir, enclos): object 'y4' not found
FM <- y4$femaleparticipationl
Error in eval(expr, envir, enclos): object 'y4' not found
BoardInd <- y4$board_independence
Error in eval(expr, envir, enclos): object 'y4' not found
HEALTHexp <- y4$healthexpenditurel
Error in eval(expr, envir, enclos): object 'y4' not found

We begin by running cor function and linear regressions between the dependent variable and each of the indipendent variables singulalry.

reg1 <- lm(CSRlevel ~ IC)
Error in eval(predvars, data, env): object 'CSRlevel' not found
cor(CSRlevel,IC)
Error in is.data.frame(y): object 'IC' not found
summary(reg1)
Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'summary': object 'reg1' not found

low pvalue means correlation is significants. IC shows low negative correlation on CSR level

reg2 <- lm(CSRlevel~ CD)
Error in eval(predvars, data, env): object 'CSRlevel' not found
cor(CSRlevel,CD)
Error in is.data.frame(y): object 'CD' not found
summary(reg2)
Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'summary': object 'reg2' not found

Low p-value means coorelation is significant. CEO duality shows to be low negatively correlated to CSR.

reg3 <- lm(CSRlevel ~ FM)
Error in eval(predvars, data, env): object 'CSRlevel' not found
cor(CSRlevel,FM)
Error in is.data.frame(y): object 'FM' not found
summary(reg3)
Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'summary': object 'reg3' not found

Low p-value means coorelation between femaleparticipation and CSR is significant and it has a high level of confidence, values show low negative correlation

reg4 <- lm(CSRlevel ~ BoardInd)
Error in eval(predvars, data, env): object 'CSRlevel' not found
cor(CSRlevel,BoardInd)
Error in is.data.frame(y): object 'BoardInd' not found
summary(reg4)
Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'summary': object 'reg4' not found

The p-value is high so the correlation between Board indipendence and CSR level is not significant.

reg5 <- lm(CSRlevel ~ HEALTHexp)
Error in eval(predvars, data, env): object 'CSRlevel' not found
cor(CSRlevel,HEALTHexp)
Error in is.data.frame(y): object 'HEALTHexp' not found
summary(reg5)
Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'summary': object 'reg5' not found

On the same line we see that Helath expenditure is not stastically siginificant correlated to csr level.

dd<- cbind(CSRlevel,healthexpenditurel,FM,IC)
Error in cbind(CSRlevel, healthexpenditurel, FM, IC): object 'CSRlevel' not found
pairs(dd)
Error in pairs(dd): object 'dd' not found

By looking at the graph above we can see that CSR is very connected to the amount of invests held by a third party and the health expenditure. CSR is also partly corralated to female participation but not very higly. The other sector CEO duality is not very corralated.

#Multiple Reggression
MULTreg <- lm (CSRlevel~ FM + HEALTHexp + IC )
Error in eval(predvars, data, env): object 'CSRlevel' not found
plot(MULTreg)
Error in plot(MULTreg): object 'MULTreg' not found
summary (MULTreg)
Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'summary': object 'MULTreg' not found

The low p-value of FM and BoardInd means correlation is significant and by checking stars we see a high level of confidence, although Healthexp still is not significant. The multiple regression agrees with our work above hence we deduce that the most relevant variables infuencing CSR level in this group are: Female Participation and board indipendence.

library(car)
avPlots(MULTreg)   
Error in avPlots(MULTreg): object 'MULTreg' not found

The plots above shows that CSR is negetively related to female participation while it is slightly negitively related to the investments held by third parties and there is not so much linear corralation with Health Expenditure.

#Factor Model
attach(data)
Error in attach(data): 'attach' only works for lists, data frames and environments
ind<- !(ceoduality==0)
Error in eval(expr, envir, enclos): object 'ceoduality' not found
model <- "
soc_env_score ~ femaleparticipationl+healthexpenditurel+investmntcoheld
"
 model <- "

## measurement
   F1 =~    1*femaleparticipationl + 1*investmntcoheld

## regression 
   soc_env_score ~ F1 +  healthexpenditurel
     
"
 fit <- sem(model, data= y4[ind,])
Error in lavaan::lavaan(model = model, data = y4[ind, ], model.type = "sem", : object 'y4' not found
 parameterestimates(fit)
Error in parameterestimates(fit): object 'fit' not found
summary(fit)
Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'summary': object 'fit' not found
lavInspect(fit,"rsquare")
Error in lavInspect(fit, "rsquare"): object 'fit' not found
lavaanPlot(name = "dMod", model = fit,   coefs=TRUE, labels=NULL,   stand = FALSE ,    covs=TRUE, stars = TRUE, edge_options = list(color = "grey"), node_options = list(shape = "box", fontname = "Helvetica") )
Error in getNodes(model): object 'fit' not found
semPaths(fit , "std", sizeInt = 2, sizeMan = 5, edge.label.cex = .8, asize = 2,
         weighted=FALSE,
         exoCov = TRUE)
Error in "semPlotModel" %in% class(object): object 'fit' not found

Here we have a factor model were you can see that when looking at the factor of female participatiion and investments by a third party they are related to CSR by 117% and 36% respectivly showing that female participation is influencal but investments are not so related. Also looking directly at Health expenditure it is not very related when compared to the factor model.

parameterestimates(fit,standardized = TRUE, ci=FALSE, rsquare = TRUE)
Error in parameterestimates(fit, standardized = TRUE, ci = FALSE, rsquare = TRUE): object 'fit' not found
summary(fit)
Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'summary': object 'fit' not found
lavInspect(fit,"rsquare")
Error in lavInspect(fit, "rsquare"): object 'fit' not found
lavaanPlot(name = "dMod", model = fit,   coefs=TRUE, labels=NULL,   stand = FALSE ,    covs=TRUE, stars = TRUE, edge_options = list(color = "grey"), node_options = list(shape = "box", fontname = "Helvetica") )
Error in getNodes(model): object 'fit' not found

This figure shows that the factor model is negitively related showing that it is not a very good midel.

##Financial
CSRlevel <- y4$soc_env_score
Error in eval(expr, envir, enclos): object 'y4' not found
TA <- y4$totalassets
Error in eval(expr, envir, enclos): object 'y4' not found
LEV <- y4$Leverage_liabassets
Error in eval(expr, envir, enclos): object 'y4' not found
Net <- y4$netsalesorrevenues
Error in eval(expr, envir, enclos): object 'y4' not found
TOTLAB <- y4$totalliabilities
Error in eval(expr, envir, enclos): object 'y4' not found
LD <- y4$longtermdebt
Error in eval(expr, envir, enclos): object 'y4' not found

We renamed the variables for tidiness purposes. Here we have total assets of the company, leverage, net sales in the current period, total liabilities and long term debt of the company.

reg2 <- lm(CSRlevel~ TA)
Error in eval(predvars, data, env): object 'CSRlevel' not found
cor(CSRlevel,TA)
Error in is.data.frame(y): object 'TA' not found
summary(reg2)
Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'summary': object 'reg2' not found

The p-value is too high meaning that the number of Total assets does not influence the CSR level.

reg3 <- lm(CSRlevel ~ LEV)
Error in eval(predvars, data, env): object 'CSRlevel' not found
cor(CSRlevel,LEV)
Error in is.data.frame(y): object 'LEV' not found
summary(reg3)
Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'summary': object 'reg3' not found

The low p-value indicates that the correlation is significant and by checking the the level of confidence it is at 99%. Hence we can say that Leverage has high positive correlation on the CSRlevel

reg4 <- lm(CSRlevel ~ Net)
Error in eval(predvars, data, env): object 'CSRlevel' not found
cor(CSRlevel,Net)
Error in is.data.frame(y): object 'Net' not found
summary(reg4)
Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'summary': object 'reg4' not found

The p-value means the correlation is significant, hence we can state that there is a low posotive correlation between sales and CSR level.

reg5 <-lm(CSRlevel ~ TOTLAB)      #no statistically sig corr
Error in eval(predvars, data, env): object 'CSRlevel' not found
cor(CSRlevel,TOTLAB)
Error in is.data.frame(y): object 'TOTLAB' not found
summary(reg5)
Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'summary': object 'reg5' not found

There is a high p-value so the correlation is not statistically significant.

reg6 <- lm(CSRlevel ~ LD)
Error in eval(predvars, data, env): object 'CSRlevel' not found
cor (CSRlevel, LD)
Error in is.data.frame(y): object 'LD' not found
summary (reg6)
Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'summary': object 'reg6' not found

The low p-value means correlation is significant at 99% level, hence there is a low positive correlation between CSR level and long term debt.

dd<- cbind(CSRlevel,TA,LEV,TOTLAB)
Error in cbind(CSRlevel, TA, LEV, TOTLAB): object 'CSRlevel' not found
pairs(dd)
Error in pairs(dd): object 'dd' not found

By lookiong at the pairs fuction we can see that at the current moment only leverage has a good correlation with CSR. This shows that finance is not a good indicator of CSR correlation.

#Multiple Reggression
MULTreg <- lm (CSRlevel~ TA + TOTLAB + LEV + LD )
Error in eval(predvars, data, env): object 'CSRlevel' not found
plot(MULTreg)
Error in plot(MULTreg): object 'MULTreg' not found
avPlots(MULTreg)
Error in avPlots(MULTreg): object 'MULTreg' not found

Here we can see again that leverage is the only indicator that shows a positive correlation with CSR the other graphs do not have a very good indicator of the CSR relation.

summary (MULTreg)
Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'summary': object 'MULTreg' not found

The multiple regression shows significant results in correlation for total assets, total liabilities, leverage but not for long term debt. Some futhter interpetation is needed.

#Factor Model
attach(data)
Error in attach(data): 'attach' only works for lists, data frames and environments
ind<- !(netsalesorrevenues==0)
Error in eval(expr, envir, enclos): object 'netsalesorrevenues' not found
 model <- "

## measurement
   F1 =~    1*Leverage_liabassets + 1*totalassets 

## regression 
   soc_env_score ~ F1 +  netsalesorrevenues
     
"
 fit <- sem(model, data= y4[ind,])
Error in lavaan::lavaan(model = model, data = y4[ind, ], model.type = "sem", : object 'y4' not found
 parameterestimates(fit)
Error in parameterestimates(fit): object 'fit' not found
summary(fit)
Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'summary': object 'fit' not found
lavInspect(fit,"rsquare")
Error in lavInspect(fit, "rsquare"): object 'fit' not found
lavaanPlot(name = "dMod", model = fit,   coefs=TRUE, labels=NULL,   stand = FALSE ,    covs=TRUE, stars = TRUE, edge_options = list(color = "grey"), node_options = list(shape = "box", fontname = "Helvetica") )
Error in getNodes(model): object 'fit' not found
semPaths(fit , "std", sizeInt = 2, sizeMan = 5, edge.label.cex = .8, asize = 2,
         weighted=FALSE,
         exoCov = TRUE)
Error in "semPlotModel" %in% class(object): object 'fit' not found

Here we have a factor model were you can see that when looking at the factor of leverage and and total assets are not so good when compared to CSR score meaning they are not good indicators. Although Net sales also is not a good indicator it is better than the others in the model with 88% correlation.

##Culture
CSRlevel <- y4$soc_env_score
Error in eval(expr, envir, enclos): object 'y4' not found
pdi <- y4$pdi
Error in eval(expr, envir, enclos): object 'y4' not found
idv <- y4$idv
Error in eval(expr, envir, enclos): object 'y4' not found
mas <- y4$mas
Error in eval(expr, envir, enclos): object 'y4' not found
uai <- y4$uai
Error in eval(expr, envir, enclos): object 'y4' not found
ega <- y4$egalitarianism
Error in eval(expr, envir, enclos): object 'y4' not found
har <- y4$harmony
Error in eval(expr, envir, enclos): object 'y4' not found
emb <- y4$embeddedness
Error in eval(expr, envir, enclos): object 'y4' not found

Here again we rename the variables for tidiness purposes. In this last macrogroup we introduced pdi, hence value index of power distance, individuality, masculinity, uncertainity avoidance, egalitarianism index, harmony and level of embedness.

reg1 <- lm(CSRlevel ~ pdi)
Error in eval(predvars, data, env): object 'CSRlevel' not found
cor(CSRlevel,pdi)
Error in is.data.frame(y): object 'pdi' not found
summary(reg1)
Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'summary': object 'reg1' not found

The p-value means correlation between pdi and CSR level is not signicant.

reg2 <- lm(CSRlevel~ idv)
Error in eval(predvars, data, env): object 'CSRlevel' not found
cor(CSRlevel,idv)
Error in is.data.frame(y): object 'idv' not found
summary(reg2)
Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'summary': object 'reg2' not found

The high p-value means correlation between Individuality and CSRlevel is not significant.

reg3 <- lm(CSRlevel ~ mas)
Error in eval(predvars, data, env): object 'CSRlevel' not found
cor(CSRlevel,mas)
Error in is.data.frame(y): object 'mas' not found
summary(reg3)
Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'summary': object 'reg3' not found

The p-value is low meaning correlation is significant, at a 95% level. Hence we can state that masculinity has low negative correlation with CSR level.

reg4 <- lm(CSRlevel ~ uai)
Error in eval(predvars, data, env): object 'CSRlevel' not found
cor(CSRlevel,uai)
Error in is.data.frame(y): object 'uai' not found
summary(reg4)
Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'summary': object 'reg4' not found

The low p-value means correlation is significant.country index of uncertainity avoidance have a low positive influence on CSR level.

reg2 <- lm(CSRlevel~ ega)
Error in eval(predvars, data, env): object 'CSRlevel' not found
cor(CSRlevel,ega)
Error in is.data.frame(y): object 'ega' not found
summary(reg2)
Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'summary': object 'reg2' not found

These results show that CSR level has positive statstically significant correlation with egalitariansm.

reg3 <- lm(CSRlevel ~ har)
Error in eval(predvars, data, env): object 'CSRlevel' not found
cor(CSRlevel,har)
Error in is.data.frame(y): object 'har' not found
summary(reg3)
Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'summary': object 'reg3' not found

The low p-value means corrwlation is significant. Hence we can say that Harmony level have positive correlation with CSR level.

reg4 <- lm(CSRlevel ~ emb)
Error in eval(predvars, data, env): object 'CSRlevel' not found
cor(CSRlevel,emb)
Error in is.data.frame(y): object 'emb' not found
summary(reg4)
Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'summary': object 'reg4' not found

The low p-value means correlation is significant. Hence we can state that level of embedness have a high negative corraltion with CSR level.

dd<- cbind(CSRlevel,idv,mas,uai,pdi)
Error in cbind(CSRlevel, idv, mas, uai, pdi): object 'CSRlevel' not found
pairs(dd)
Error in pairs(dd): object 'dd' not found

We can see from the pairs model that CSR scores are related to all four varibles showing that this is a good indicator that culture shows the relationship with CSR score.

#Multiple Reggression
MULTreg <- lm (CSRlevel~ pdi+idv+mas+uai)
Error in eval(predvars, data, env): object 'CSRlevel' not found
plot(MULTreg)
Error in plot(MULTreg): object 'MULTreg' not found
summary (MULTreg)
Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'summary': object 'MULTreg' not found

The p-value for varibles EGA and EMB are low meaning they are significant at the 99% cofidence interval. The other varibles are not significant. Therefore we can go with further analysis.

library(car)
avPlots(MULTreg)
Error in avPlots(MULTreg): object 'MULTreg' not found

The results of the graphs show that CSR is negitivily corralated to pdi and mas but is positivily related to uai showing that these indicatos will help us understand the CSR score best.

 model <- "

## measurement
   F1 =~    1*mas + 1*uai 

## regression 
   soc_env_score ~ F1 +  pdi + idv
     
"
 fit <- sem(model, data= y4[ind,])
Error in lavaan::lavaan(model = model, data = y4[ind, ], model.type = "sem", : object 'y4' not found
 parameterestimates(fit)
Error in parameterestimates(fit): object 'fit' not found
summary(fit)
Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'summary': object 'fit' not found
lavInspect(fit,"rsquare")
Error in lavInspect(fit, "rsquare"): object 'fit' not found
lavaanPlot(name = "dMod", model = fit,   coefs=TRUE, labels=NULL,   stand = FALSE ,    covs=TRUE, stars = TRUE, edge_options = list(color = "grey"), node_options = list(shape = "box", fontname = "Helvetica") )
Error in getNodes(model): object 'fit' not found
semPaths(fit , "std", sizeInt = 2, sizeMan = 5, edge.label.cex = .8, asize = 2,
         weighted=FALSE,
         exoCov = TRUE)
Error in "semPlotModel" %in% class(object): object 'fit' not found

The factor model shows that when looking at the culture factors through the adjusted factor of mas and idv they are corralated with CSR at a higher percentage than CSR is related to pdi and idv on their own.