library(ggplot2)

> library(gridExtra)

> set.seed(42)

> y <- runif(100, min = 0, max = 50)

> z <- runif(100, min = 1, max = 12)

> x <- 2 * y + z

> model <- lm(y ~ x)

> df1 <- data.frame(x, z)

> df <- data.frame(x, y) >

df2 <- rbind(df, c(75, 0.5))

> df3 <- rbind(df1, c(75, 0.5))

> plot1 <- ggplot(df1, aes(z, y)) + + geom_point() + + theme_bw() + + labs(x = ‘Independent variables’, y = ‘Yearly number of citations’) + + ggtitle(“Panel A”)

> plot2 <- ggplot(df, aes(x, y)) + + geom_point() + + theme_bw() + + labs(x = ‘Independent variables’, y = ‘Yearly number of citations’) + + ggtitle(“Panel B”)

> plot1a <- ggplot(df1, aes(z, y)) + + geom_point() + + geom_smooth(method = lm) + + theme_bw() + + labs(x = ‘Independent variables’, y = ‘Yearly number of citations’) + + ggtitle(“Panel C”)

> plot2a <- ggplot(df, aes(x, y)) + + geom_point() + + geom_smooth(method = lm) + + theme_bw() + + labs(x = ‘Independent variables’, y = ‘Yearly number of citations’) + + ggtitle(“Panel D”)

> coeff <- coefficients(model)

> intercept <- coeff[1]

> slope <- coeff[2]

> plot3 <- ggplot(df3, aes(x, z)) + + geom_point() + + geom_smooth(method = lm) + + theme_bw() + + labs(x = ‘Independent variables’, y = ‘Yearly number of citations’) + + annotate(“point”, x = 10, y = 0.5, colour = “red”) + + geom_abline(intercept = intercept, slope = slope, color = “red”, linetype = “solid”, size = 1.5) + + ggtitle(“Panel E”)

plot4 <- ggplot(df2, aes(x, y)) + + geom_point() + + geom_smooth(method = lm) + + geom_smooth() + + theme_bw() + + labs(x = ‘Independent variables’, y = ‘Yearly number of citations’) + + annotate(“point”, x = 75, y = 0.5, colour = “red”) + + geom_abline(intercept = intercept, slope = 0.2, color = “red”, linetype = “solid”, size = 1.5) + + ggtitle(“Panel F”)

> ggsave(“plot1.png”, plot1, dpi = 300) Saving 7 x 7 in image > Saving 7 x 5 in image ggsave(“plot2.png”, plot2, dpi = 300) Saving 7 x 7 in image

> ggsave(“plot1a.png”, plot1a, dpi = 300)

Saving 7 x 7 in image geom_smooth() using formula = ‘y ~ x’

> ggsave(“plot2a.png”, plot2a, dpi = 300)

Saving 7 x 7 in image geom_smooth() using formula = ‘y ~ x’

> ggsave(“plot3.png”, plot3, dpi = 300)

Saving 7 x 7 in image geom_smooth() using formula = ‘y ~ x’

> ggsave(“plot4.png”, plot4, dpi = 300)

Saving 7 x 7 in image geom_smooth() using formula = ‘y ~ x’ geom_smooth() using method = ‘loess’ and formula = ‘y ~ x’ install.packages(“knitr”) library(knitr)

> knitr::include_graphics(“plot1.png”) [1] “plot1.png” attr(,“class”) [1] “knit_image_paths” “knit_asis”
> knitr::include_graphics(“plot2.png”) [1] “plot2.png” attr(,“class”) [1] “knit_image_paths” “knit_asis”
> knitr::include_graphics(“plot1a.png”) [1] “plot1a.png” attr(,“class”) [1] “knit_image_paths” “knit_asis”
> knitr::include_graphics(“plot2a.png”) [1] “plot2a.png” attr(,“class”) [1] “knit_image_paths” “knit_asis”
> knitr::include_graphics(“plot3.png”) [1] “plot3.png” attr(,“class”) [1] “knit_image_paths” “knit_asis”
> knitr::include_graphics(“plot4.png”) [1] “plot4.png” attr(,“class”) [1] “knit_image_paths” “knit_asis”
> install.packages(“readr”) readxl install.packages(“psych”) install.packages(c(“readr”, “readxl”, “psych”)) > library(readxl) > library(psych) library(readxl) scopus <- read_excel(“scopus.xlsx”) > View(scopus)
> head(scopus) # A tibble: 6 × 13 PublicationYears BigSample Method AngloSaxon USA TimeSpan Sample 1 35 0 0 1 1 0 243 2 33 0 0 1 1 0 410 3 22 0 1 1 1 1 98 4 22 0 1 1 1 3 860 5 20 0 0 0 0 0 287 6 16 0 0 0 0 0 2428 # ℹ 6 more variables: BusinessSupport , TC , TCYear , # EXCLUDED , PY , Nr_Papieru > colnames(scopus) [1] “PublicationYears” “BigSample” “Method”
[4] “AngloSaxon” “USA” “TimeSpan”
[7] “Sample” “BusinessSupport” “TC”
[10] “TCYear” “EXCLUDED” “PY”
[13] “Nr_Papieru”
> library(knitr)

> kable(scopus) install.packages(“psych”) library(psych)

> describe(DF) TCY<- lm(TCYear ~ PublicationYears +BigSample+ Method+AngloSaxon+TimeSpan +Sample+BusinessSupport,DF) > summary(TCY) >plot(TCY) hats <- hatvalues(TCY) > plot(hats, type = ‘h’) > hats

<- as.data.frame(hatvalues(TCY)) > hats plot(hats, type = ‘h’) >

> cutoff <- 2 * (length(coef(TCY)) - 1) / length(hats)

> z <- hats

> cutoff > sum(z, na.rm = FALSE) [1] 8 > cutoff <- 2*(6-1)/20 > > z <- hats > cutoff > > sum(z, na.rm = FALSE) [1] 1