Generate Plots

#output:
#  rmdformats::readthedown:
#    code_folding: hide
#output:
#  rmdformats::readthedown:
#    css: "/standard/nsdpi_storage/people/czj9zj/assets/readthedown_blue_orange.css"

Note: The written content shown here is taken directly from Maura’s work. You can view the original file here: https://rpubs.com/mauraaustin/iranScratch


Introduction

Background

For (a while), Israel and the US have been increasingly concerned with Iran’s growing nuclear capabilities. Israel’s Mossad has been carrying out campaigns to cripple their nuclear developments, which has involved cyber attacks on critical nuclear infrastructure – such as Stuxnet (circa 2005) and “Operation Olympic Games” (2021) – and airstrikes or explosions at nuclear facilities. Sometimes, their campaigns have involved targeting and assassinating academic nuclear physicists. This approach is more controversial, as scientists are typically considered civilians, and Iran has regularly claimed that their assassinated scientists were not involved in weapons development. Still, Israel continues to target what they consider high-profile nuclear scientists, most recently carrying out targeted airstrikes that killed 14 nuclear scientists and set off the Twelve-day War in the Summer of 2025.

In the aftermath of the Twelve-day War, Israel’s ambassador to France asserted that the assassinations would set Iran’s nuclear program back “by quite a number of years.” 1. In this project, we empirically evaluate the plausibility of this claim. We use publication data across time to operationalize nuclear program development in terms of academic output in relevant fields. In study 1, we observe effects on academic output in the aftermath of a pair of attempted assassinations of two high-profile nuclear physicists: one successful and one failed.

*It is worth noting that the US – also concerned about Iran’s nuclear capabilities – have taken a different and less morbid approach in a bid to cripple Iran’s growing field of nuclear physics. Since around 2005, the US has been carrying out a campaign to draw emerging Iranian nuclear physicists to work in the US before they become prominent scientists. In future iterations of this work, we can attempt to empirically compare the effectiveness of these two approaches.

**It is also worth noting here that the US has largely not explicitly claimed responsibility in these campaigns (until the Twelve-Day War when the US carried out airstrikes on nuclear facilities on the 9th day) but has regularly been implicated as a facilitator of Israel’s operations.

Study 1

In the early morning of November 29 2010, Israel’s Mossad attempted to assassinate two nuclear physicists: Majid Shahriari and Freyedoon Abbasi Davani. Both scientists worked at Shahid Beheshti, and both were deemed by Israel to be prominent enough to pose a threat.

Only one of the attempted assassinations succeeded. We leverage this morbid coincidence as a natural experiment to estimate the effect of assassination on nuclear capabilities development. The “random assignment” that played out in this case serves to isolate the effects of removing knowledge from a field (i.e. assassinating M. Shahriari) vs terrorizing a field (i.e. attempting to assassinate F. Abbasi Davani) on scientific output in the relevant fields.

To do so, we observe the scientific output in each scientist’s respective fields at Shahid Beheshti in the X \[5?\] years before and after the attempted assassination on 29 Nov 2010. We then compare those trends to the trends of all other fields at Shahid Beheshti. Note that the two scientists will have several overlapping fields, so we will observe the following trends:

  1. M. Shahriari exclusive fields
  2. F. Abbasi Davani exclusive fields
  3. Shared fields
  4. All other fields at Shahid Beheshti that neither Shahriari nor Abbasi Davani were involved in

Method

We use the OpenAlex database of published works to identify all works published at Shahid Beheshti University.

We opted to use paper “topics” to identify the scientists’ fields that they were active in. Paper “topics” are assigned by OpenAlex’s algorithm, which takes into account the content of the paper’s abstract and the citation and author network (I think - need to verify). We decided that the ‘topic’ level provided an optimal balance of precision and breadth — we considered “subfields” and above as too general to provide an accurate categorization tool for analysis. That is, we expected that papers categorized under the same subfields as Shahriari’s or Abbasi Davani’s work would include too many specializations would not be realistically affected by our scientist of interest, while the ‘topics’ classifier allows us to more precisely zero in on specializations that are actually related to our scientists’ work.

## Warning in geom_rect(aes(xmin = xmin, xmax = xmax, ymin = y - 0.35, ymax = y +
## : Ignoring unknown parameters: `radius`

Topics relevant to assassinated nuclear physicists

library(dplyr)
library(tibble)
library(knitr)
library(kableExtra)

# Unique topics per author
majid_topics        <- unique(majid_works_long$topic)
abbasi_topics       <- unique(abbasi_works_long$topic)
masoud_topics       <- unique(masoud_works_long$topic)
hosseinpour_topics  <- unique(hosseinpour_works_long$topic)

# Helper to pad columns with '---'
pad_column <- function(x, n) { length(x) <- n; x[is.na(x)] <- "---"; x }

# Height of the table (max col length)
n <- max(length(majid_topics), length(abbasi_topics), length(masoud_topics), length(hosseinpour_topics))

topics_4col_all <- tibble(
  `M. Shahriari`      = pad_column(majid_topics,       n),
  `F. Abbasi Davani`  = pad_column(abbasi_topics,      n),
  `M. Alimohammadi`   = pad_column(masoud_topics,      n),
  `A. Hosseinpour`    = pad_column(hosseinpour_topics, n)
)

# Append counts row at the bottom
topics_4col_all <- bind_rows(
  topics_4col_all,
  tibble(
    `M. Shahriari`      = paste0("n = ", length(majid_topics)),
    `F. Abbasi Davani`  = paste0("n = ", length(abbasi_topics)),
    `M. Alimohammadi`   = paste0("n = ", length(masoud_topics)),
    `A. Hosseinpour`    = paste0("n = ", length(hosseinpour_topics))
  )
)

# Render (HTML)
kable(
  topics_4col_all,
  caption = "Unique Topics per Author"
) %>%
  kable_styling(full_width = FALSE, bootstrap_options = c("striped","hover"))
Unique Topics per Author
M. Shahriari F. Abbasi Davani M. Alimohammadi A. Hosseinpour
Radiation Effects and Dosimetry Particle accelerators and beam dynamics Algebraic structures and combinatorial models Magnetic Properties and Synthesis of Ferrites
Advanced Radiotherapy Techniques Particle Accelerators and Free-Electron Lasers Advanced Algebra and Geometry Electromagnetic wave absorption materials
Radiation Therapy and Dosimetry Gyrotron and Vacuum Electronics Research Nonlinear Waves and Solitons Multiferroics and related materials
Nuclear Physics and Applications Neuroendocrine Tumor Research Advances Homotopy and Cohomology in Algebraic Topology Magneto-Optical Properties and Applications
Graphite, nuclear technology, radiation studies Radiopharmaceutical Chemistry and Applications Algebraic Geometry and Number Theory Magnetic Properties and Applications
Medical Imaging Techniques and Applications Lung Cancer Research Studies Black Holes and Theoretical Physics Power Line Inspection Robots
Advanced X-ray and CT Imaging Atomic and Subatomic Physics Research Nonlinear Photonic Systems Microwave Dielectric Ceramics Synthesis
Ion-surface interactions and analysis Nuclear Physics and Applications Particle physics theoretical and experimental studies Geomagnetism and Paleomagnetism Studies
Radiation Dose and Imaging Laser-Plasma Interactions and Diagnostics Algebraic and Geometric Analysis Magnetic Properties of Alloys
Vibration and Dynamic Analysis Plasma Diagnostics and Applications Relativity and Gravitational Theory
Fluid Dynamics and Vibration Analysis Magnetic Field Sensors Techniques Quantum and electron transport phenomena
Water Systems and Optimization Radioactivity and Radon Measurements Graphene research and applications
Diamond and Carbon-based Materials Research Radioactive contamination and transfer Topological Materials and Phenomena
Metal and Thin Film Mechanics Radiation Detection and Scintillator Technologies Quantum Information and Cryptography
Boron Compounds in Chemistry Particle Detector Development and Performance Quantum Mechanics and Non-Hermitian Physics
Radiation Detection and Scintillator Technologies Engineering Applied Research Quantum Chromodynamics and Particle Interactions
Nuclear reactor physics and engineering Radiation Effects and Dosimetry Physics of Superconductivity and Magnetism
Nuclear Materials and Properties Graphite, nuclear technology, radiation studies Advanced Topics in Algebra
Advancements in PLL and VCO Technologies Industrial Automation and Control Systems Cosmology and Gravitation Theories
Advanced Electrical Measurement Techniques Advanced Control Systems Design Quantum Electrodynamics and Casimir Effect
Atomic and Subatomic Physics Research Pulsed Power Technology Applications Quantum Mechanics and Applications
Advanced MRI Techniques and Applications Experimental Learning in Engineering Theoretical and Computational Physics
Ocular Oncology and Treatments Nuclear reactor physics and engineering Quantum many-body systems
Ocular and Laser Science Research Superconducting Materials and Applications Stochastic processes and statistical mechanics
Glaucoma and retinal disorders X-ray Spectroscopy and Fluorescence Analysis Random Matrices and Applications
Structural Health Monitoring Techniques Laser-induced spectroscopy and plasma Neutrino Physics Research
Digital Radiography and Breast Imaging Cutaneous lymphoproliferative disorders research Astrophysics and Cosmic Phenomena
MRI in cancer diagnosis Nonmelanoma Skin Cancer Studies Advanced NMR Techniques and Applications
Cerebrovascular and Carotid Artery Diseases Nail Diseases and Treatments Opinion Dynamics and Social Influence
Lanthanide and Transition Metal Complexes Archaeology and ancient environmental studies Diffusion and Search Dynamics
Air Quality and Health Impacts Pacific and Southeast Asian Studies Markov Chains and Monte Carlo Methods
Atmospheric chemistry and aerosols Astro and Planetary Science Nonlinear Dynamics and Pattern Formation
Vehicle emissions and performance Hydrogen Storage and Materials Quantum chaos and dynamical systems
Radiation Shielding Materials Analysis Advanced NMR Techniques and Applications Advanced Mathematical Modeling in Engineering
Thermal and Kinetic Analysis Magnetic confinement fusion research Complex Network Analysis Techniques
Geophysical Methods and Applications Fusion materials and technologies Spectroscopy and Quantum Chemical Studies
Advanced Optical Sensing Technologies Nuclear Materials and Properties Thermodynamic properties of mixtures
Radiopharmaceutical Chemistry and Applications Advanced Materials Characterization Techniques Protein Structure and Dynamics
Gyrotron and Vacuum Electronics Research Plasma Applications and Diagnostics High-Energy Particle Collisions Research
Pulsed Power Technology Applications Surface Modification and Superhydrophobicity Advanced Differential Geometry Research
Particle Accelerators and Free-Electron Lasers Radiation Therapy and Dosimetry Advanced Thermodynamics and Statistical Mechanics
AI in cancer detection Electrohydrodynamics and Fluid Dynamics Dark Matter and Cosmic Phenomena
Nuclear and radioactivity studies Graphene research and applications Cold Atom Physics and Bose-Einstein Condensates
Quantum optics and atomic interactions Catalysis and Oxidation Reactions
Quantum and electron transport phenomena Advanced Control Systems Optimization
Control Systems and Identification advanced mathematical theories
Plasma and Flow Control in Aerodynamics
Nuclear and radioactivity studies
Hemostasis and retained surgical items
Medical Imaging Techniques and Applications
Prostate Cancer Treatment and Research
Advanced Radiotherapy Techniques
Cutaneous Melanoma Detection and Management
Thermal and Kinetic Analysis
Fault Detection and Control Systems
Radio Frequency Integrated Circuit Design
Estrogen and related hormone effects
Electrostatic Discharge in Electronics
Fire Detection and Safety Systems
Neutrino Physics Research
Chemical Thermodynamics and Molecular Structure
Lanthanide and Transition Metal Complexes
Photonic and Optical Devices
Laser Design and Applications
Nanoparticle-Based Drug Delivery
Characterization and Applications of Magnetic Nanoparticles
Radioactive element chemistry and processing
Radiation Dose and Imaging
Advanced Adaptive Filtering Techniques
Calibration and Measurement Techniques
Power System Optimization and Stability
Acoustic Wave Resonator Technologies
Spectroscopy and Chemometric Analyses
Botanical Research and Applications
Chemical and Physical Properties of Materials
Semiconductor materials and devices
Ion-surface interactions and analysis
Electron Spin Resonance Studies
Advanced X-ray and CT Imaging
Welding Techniques and Residual Stresses
Rocket and propulsion systems research
Mechanical Engineering and Vibrations Research
Aerospace Engineering and Control Systems
Advancements in Photolithography Techniques
Electron and X-Ray Spectroscopy Techniques
Monoclonal and Polyclonal Antibodies Research
Advanced biosensing and bioanalysis techniques
Synthesis and Biological Evaluation
Peptidase Inhibition and Analysis
Radiation Effects in Electronics
Digital Radiography and Breast Imaging
Medical Imaging and Pathology Studies
Terahertz technology and applications
Microwave Engineering and Waveguides
Wireless Power Transfer Systems
Fusion and Plasma Physics Studies
Cold Fusion and Nuclear Reactions
Nuclear Issues and Defense
Advanced X-ray Imaging Techniques
Diamond and Carbon-based Materials Research
Metal and Thin Film Mechanics
Advanced Power Generation Technologies
Environmental and Industrial Safety
Industrial Engineering and Technologies
Ultrasound and Cavitation Phenomena
Nuclear Engineering Thermal-Hydraulics
Advancements in PLL and VCO Technologies
Advanced Electrical Measurement Techniques
Nuclear physics research studies
n = 43 n = 109 n = 46 n = 9
library(dplyr)
library(purrr)
library(tibble)
library(stringr)

# Your unique topic vectors
# majid_topics, abbasi_topics, masoud_topics, hosseinpour_topics

sets <- list(
  Majid       = majid_topics,
  Abbasi      = abbasi_topics,
  Masoud      = masoud_topics,
  Hosseinpour = hosseinpour_topics
)

# Helper: count intersections for all combinations of given sizes
combo_counts <- function(sets, sizes = 2:length(sets)) {
  map_dfr(sizes, function(k) {
    combn(names(sets), k, simplify = FALSE) %>%
      map_dfr(function(nms) {
        inter <- Reduce(intersect, sets[nms])
        tibble(
          Size        = k,
          Combination = paste(nms, collapse = " & "),
          n_topics    = length(inter)
          # If you also want to inspect which topics, add:
          # Topics      = list(inter)
        )
      })
  }) %>%
    arrange(Size, desc(n_topics), Combination)
}

# Build the table (pairs, triples, all four)
overlap_table <- combo_counts(sets, sizes = 2:4)

# Show the table
overlap_table
## # A tibble: 11 × 3
##     Size Combination                           n_topics
##    <int> <chr>                                    <int>
##  1     2 Majid & Abbasi                              25
##  2     2 Abbasi & Masoud                              4
##  3     2 Abbasi & Hosseinpour                         0
##  4     2 Majid & Hosseinpour                          0
##  5     2 Majid & Masoud                               0
##  6     2 Masoud & Hosseinpour                         0
##  7     3 Abbasi & Masoud & Hosseinpour                0
##  8     3 Majid & Abbasi & Hosseinpour                 0
##  9     3 Majid & Abbasi & Masoud                      0
## 10     3 Majid & Masoud & Hosseinpour                 0
## 11     4 Majid & Abbasi & Masoud & Hosseinpour        0
library(dplyr)

targets <- c(
  "Atomic and Subatomic Physics Research",
  "Nuclear Physics and Applications",
  "Pulsed Power Technology Applications"
)


# Set the full path to your file
file_path <- "/standard/nsdpi_storage/people/czj9zj/DiD_data_3topic/extra_data/shahid_beheshti_university_cleanedLONG.rds"

# Read the RDS file
shahid_beheshti_university_cleanedLONG <- readRDS(file_path)


# 1) Papers that appear at least 3 times in the LONG table
titles_3plus <- shahid_beheshti_university_cleanedLONG %>%
  group_by(title) %>% mutate(n_rows_title = n()) %>% ungroup() %>%
  filter(n_rows_title >= 3)

# 2) Among those, papers that have at least one of the target topics
candidate_titles <- titles_3plus %>%
  filter(topic %in% targets) %>%
  group_by(topic, title) %>%
  summarise(
    n_rows_title = first(n_rows_title),
    first_date   = suppressWarnings(min(publication_date, na.rm = TRUE)),
    .groups = "drop"
  ) %>%
  arrange(factor(topic, levels = targets), desc(n_rows_title), first_date)

# Choose ONE paper per target topic
chosen_titles <- candidate_titles %>%
  group_by(topic) %>% slice_head(n = 1) %>% ungroup()
# chosen_titles has the 3 titles (one per topic)

# 3) For each chosen title, keep the 3 rows for that paper (join by title ONLY)
result_9_rows <- titles_3plus %>%
  semi_join(chosen_titles, by = "title") %>%      # pull all rows for those titles
  group_by(title) %>% slice_head(n = 3) %>% ungroup() %>%
  # attach which target-topic this title was selected for (so we can order nicely)
  left_join(chosen_titles %>% select(target_topic = topic, title), by = "title") %>%
  select(target_topic, id, title, publication_date, topic, score, type, institution) %>%
  arrange(factor(target_topic, levels = targets), title, publication_date)

# Sanity checks
nrow(result_9_rows)                  # should be 9 (3 rows x 3 papers)
## [1] 9
table(result_9_rows$target_topic)    # should be 3 per target topic
## 
## Atomic and Subatomic Physics Research      Nuclear Physics and Applications 
##                                     3                                     3 
##  Pulsed Power Technology Applications 
##                                     3
library(dplyr)
library(kableExtra)

# 1) Keep only the requested columns
result_9_rows_min <- result_9_rows %>%
  select(id, title, publication_date, topic, score) %>%
  arrange(title, publication_date)

# (Optional) nice column labels + light formatting
result_9_rows_min <- result_9_rows_min %>%
  mutate(
    publication_date = as.character(publication_date),
    score = round(score, 4)
  )

# 2) Build LaTeX table
library(kableExtra)

tbl_topics <- result_9_rows_min %>%
  kbl(
    caption  = "Sample of three nuclear-related works from Shahid Beheshti University.",
    format   = "latex",
    booktabs = TRUE,
    col.names = c("ID", "Title", "Publication Date", "Topic", "Topic Score")
  ) %>%
  kable_styling(
    latex_options = c("hold_position", "scale_down"),
    font_size     = 10
  ) %>%
  kableExtra::footnote(
    general = "Note: Sample data shown in long format as used for DiD format. One row per work-topic, where the Topic Score is OpenAlex classifier confidence score.",
    footnote_as_chunk = TRUE
  )


# 3) Save table to .tex file
writeLines(tbl_topics, file.path(data_path, "sbu_example_works_topics.tex"))
library(kableExtra)

# Your palette
layer_colors <- c(
  "Majid"  = "#587CA0",  # blue-gray
  "Abbasi" = "#B3C7D6",  # light blue-gray
  "Masoud" = "#808080"   # base gray (we'll use 50% over white -> #C0C0C0)
)
masoud_50_over_white <- "#C0C0C0"  # 50% alpha of #808080 on white

tbl_topics <- result_9_rows_min %>%
  kbl(
    caption  = "Sample of three nuclear-related works from Shahid Beheshti University (OpenAlex).",
    format   = "latex",
    booktabs = TRUE,
    col.names = c("ID", "Title", "Publication Date", "Topic", "Topic Score")
  ) %>%
  kable_styling(
    latex_options = c("hold_position", "scale_down"),
    font_size     = 10
  ) %>%
  # Shade rows by blocks of 3
  row_spec(1:3, background = layer_colors["Majid"],  color = "white") %>%  # darker bg -> white text
  row_spec(4:6, background = layer_colors["Abbasi"]) %>%
  row_spec(7:9, background = masoud_50_over_white)%>%
  kableExtra::footnote(
    general = "Note: Sample data shown in long format as used for DiD format. One row per work-topic, where the Topic Score is OpenAlex classifier confidence score.",
    footnote_as_chunk = TRUE
  )

writeLines(tbl_topics, file.path(data_path, "sbu_example_works_topics.tex"))
library(dplyr)
library(tibble)
library(knitr)
library(kableExtra)

# Limit each author’s topics to the first 30
majid_topics_top30       <- head(majid_topics, 30)
abbasi_topics_top30      <- head(abbasi_topics, 30)
masoud_topics_top30      <- head(masoud_topics, 30)
hosseinpour_topics_top30 <- head(hosseinpour_topics, 30)

# Pad all columns to same length (30 rows)
n <- 30
pad_column <- function(x, n) { length(x) <- n; x[is.na(x)] <- "---"; x }

topics_top30_tbl <- tibble(
  `M. Shahriari`     = pad_column(majid_topics_top30,       n),
  `F. Abbasi Davani` = pad_column(abbasi_topics_top30,      n),
  `M. Alimohammadi`  = pad_column(masoud_topics_top30,      n),
  `A. Hosseinpour`   = pad_column(hosseinpour_topics_top30, n)
)

# Add a row of ellipses ("...")
topics_top30_tbl <- bind_rows(
  topics_top30_tbl,
  tibble(
    `M. Shahriari`     = "...",
    `F. Abbasi Davani` = "...",
    `M. Alimohammadi`  = "...",
    `A. Hosseinpour`   = "..."
  ),
  tibble(
    `M. Shahriari`     = paste0("n = ", length(majid_topics)),
    `F. Abbasi Davani` = paste0("n = ", length(abbasi_topics)),
    `M. Alimohammadi`  = paste0("n = ", length(masoud_topics)),
    `A. Hosseinpour`   = paste0("n = ", length(hosseinpour_topics))
  )
)

# Build LaTeX table
tbl_topics_top30 <- topics_top30_tbl %>%
  kbl(
    caption  = "List of Unique Topics per Author",
    format   = "latex",
    booktabs = TRUE
  ) %>%
  kable_styling(
    latex_options = c("hold_position", "scale_down"),
    font_size     = 10
  )

# Save to .tex file
writeLines(tbl_topics_top30, file.path(data_path, "30_topics_per_author.tex"))
# Build LaTeX table
tbl_topics <- topics_4col_all %>%
  kbl(
    caption  = "Unique Topics per Author",
    format   = "latex",
    booktabs = TRUE
  ) %>%
  kable_styling(
    latex_options = c("hold_position", "scale_down"),
    font_size     = 10
  )

# Save table to .tex file
writeLines(tbl_topics, file.path(data_path, "unique_topics_per_author.tex"))
topic_summary <- readRDS("/standard/nsdpi_storage/people/czj9zj/DiD_data_3topic/extra_data/topic_summary.rds")


# Filter topic_summary separately
majid_keywords  <- topic_summary[topic_summary$Topic %in% majid_topics, ]
abbasi_keywords <- topic_summary[topic_summary$Topic %in% abbasi_topics, ]

# If you prefer dplyr syntax:
library(dplyr)

majid_keywords <- topic_summary %>%
  filter(Topic %in% majid_topics)

abbasi_keywords <- topic_summary %>%
  filter(Topic %in% abbasi_topics)

Majid Plot

M. Shahriari profiles

Possible Majid Shahriari author IDs:

  • A5111646381 (43 works)
  • A5112039075 (13 works)
  • A5028976637 (2 works)
  • A5102177495 (1 work)
library(dplyr)
library(purrr)
library(tidyr)

data_path <- "/standard/nsdpi_storage/people/czj9zj/DiD_data_3topic/Iran"

files <- c("works_5028976637.rds", "works_5102177495.rds",
           "works_5111646381.rds", "works_5112039075.rds")
ids   <- c("A5028976637", "A5102177495", "A5111646381", "A5112039075")

majid_works_long <- map2_dfr(files, ids, ~
  readRDS(file.path(data_path, .x)) %>% mutate(author_id = .y)
) %>%
  select(id, title, publication_date, publication_year, topics, authorships, author_id) %>%
  # Prefix nested columns so they don't clash with outer names (e.g., topics_id)
  unnest(cols = topics, keep_empty = TRUE, names_sep = "_") %>%
  # Keep only the topic fields you care about (plus topic id if present)
  select(
    id, title, publication_date, publication_year,
    topic            = topics_display_name,
    score            = topics_score,
    subfield         = `topics_subfield.display_name`,
    field            = `topics_field.display_name`,
    domain           = `topics_domain.display_name`,
    topics_id, authorships, author_id
  ) %>%
  # Clean OpenAlex URLs from character columns (list-cols like authorships unaffected)
  mutate(across(where(is.character),
                ~ gsub("https://openalex.org/", "", .x, fixed = TRUE)))
library(dplyr)
library(knitr)
library(kableExtra)

majid_works_long %>%
  distinct(title) %>%
  mutate(ID = row_number()) %>%  # generates 1 to n automatically
  select(ID, title) %>%
  kable(
    caption = "List of Distinct Publications by Majid Shahriari"
  ) %>%
  kable_styling(full_width = FALSE, bootstrap_options = c("striped", "hover")) %>%
  scroll_box(width = "100%", height = "500px")
List of Distinct Publications by Majid Shahriari
ID title
1 Comparison of Electron-Beam Dose Distributions in a Heterogeneous Phantom Obtained Using Radiochromic Film Dosimetry and Monte Carlo Simulation
2 Assessment of different MCNP Monte Carlo codes in electron absorbed dose
3 INVESTIGATION OF CHARGED PARTICLE TRANSPORT IN MAGNETIC FIELD AND SIMULATION OF SYNCHROTRON RADIATION BY FLUKA
4 Soil Moisture Estimation Using Combined SAR and Optical Imagery: Application of Seasonal Machine Learning Algorithms
5 Surface displacement measurement and modeling of the Shah-Gheyb salt dome in southern Iran using InSAR and machine learning techniques
6 Estimation of land displacement in East Baton Rouge Parish, Louisiana, using InSAR: Comparisons with GNSS and machine learning models
7 Neural network architecture optimization using automated machine learning for borehole resistivity measurements
8 A full quantitative analysis of 18 MV photon beam from 2100 C/D-Varian clinical linear accelerator with and without flattening filter
9 INVESTIGATION OF DIFFERENT ION EFFECTS ON THE ALUMINUM SAMPLES WITH A 2.5KJ MATER TYPE PLASMA FOCUS DEVICE
10 Advantages of mesh tallying in MCNPX for 3D dose calculations in radiotherapy
11 Monte Carlo estimation of electron contamination in a 18 MV clinical photon beam
12 An advanced method for determination of loss of coolant accident in nuclear power plants
13 Investigation of Spatial Distribution of Hydrogen and Argon Ions and Effects of them on Aluminum Samples in a 2.5 kJ Mater Type Plasma Focus Device
14 Hybrid photoneutron source optimization for electron accelerator-based BNCT
15 Xenon transient simulation of the VVER-1000 nuclear reactor using adiabatic approximation
16 DESIGN AND CONSTRUCTION OF AN ACCURATE TIMING SINGLE CHANNEL ANALYZER
17 DESIGN AND CONSTRUCTION OF A HIGH PRECISION TAC
18 Unfolding the neutron spectrum of a NE213 scintillator using artificial neural networks
19 Monte Carlo estimation of photoneutrons contamination from high-energy X-ray medical accelerators in treatment room and maze: a simplified model
20 Calculation of time-dependent neutronic parameters using Monte Carlo method
21 Monte Carlo Based Suggestion of the Best Choice for Material of a Multileaf Collimator (MLC) and the Required Thickness
22 “Research Note” DESIGN AND CONSTRUCTION OF A HIGH PRECISION TAC *
23 An Investigation on the Internal Wedge Factor Estimation for an Elekta Linac using Monte Carlo Simulation
24 The Effects of Hydrogenous Medium on MRI Image of MAGICA Gel Dosimeter
25 Simulation of Human Eye for Ophthalmic Brachytherapy Dosimetry Using MCNP-4C Code
26 Determination of Loss of Coolant Accident (LOCA) in Nuclear Power Plants Using Signal Processing Method
27 Monte Carlo simulation of X-ray spectra and evaluation of filter effect using MCNP4C and FLUKA code
28 Calculation of CR-39 efficiency for fast neutrons using the MCNP and SRIM codes
29 Calculation of the importance-weighted neutron generation time using MCNIC method
30 Monte Carlo calculation of CR-39 efficiency for fast neutron detection using a combination of MCNP and SRIM codes, and comparison with experimental results
31 Comparison of measured and Monte Carlo calculated dose distributions from “circular collimators” for radiosurgical beams
32 Calculation of neutron importance function in fissionable assemblies using Monte Carlo method
33 Estimation of contrast agent concentration in intra- and extra-vascular spaces of brain tissue
34 Comparative assessment of different computational models for generation of X-ray spectra in diagnostic radiology and mammography
35 Assessment of different computational models for generation of x‐ray spectra in diagnostic radiology and mammography
36 MCNP4C-based Monte Carlo simulator for fan- and cone-beam x-ray CT: development and experimental validation
37 Slit slat collimator optimization with respect to MTF
38 Monte Carlo simulation of x-ray spectra in diagnostic radiology and mammography using MCNP4C
39 Monte Carlo source simulation technique for solution of interference reactions in INAA experiments: a preliminary report
40 Elemental characterization of TSP and two size fractions of airborne particulate matter from Tehran by INAA and AAS
41 Application of MCNP4C Monte Carlo code in radiation dosimetry in heterogeneous phantom
42 Gamma irradiator dose mapping simulation using the MCNP code and benchmarking with dosimetry
43 Dose distribution of the IR-136 irradiator using a Monte Carlo code and comparison with dosimetry
44 Borehole parametric study for neutron induced capture γ-ray spectrometry using the MCNP code
45 Borehole prompt gamma neutron activation and comparison with Monte Carlo simulation using MCNP code
46 Abstracts for November 1998 <i>Journal of Materials Research</i>
47 Analytical Modeling of Bank Cash Flow: An Uncertain System Dynamics Approach
48 The effects of variations in the density and composition of eye materials on ophthalmic brachytherapy dosimetry
49 Feasibility study on the use of uranium in photoneutron target and BSA optimization for Linac based BNCT
50 A spatial kinetic model for simulating VVER-1000 start-up transient
51 Dose calculation and in-phantom measurement in BNCT using response matrix method
52 High-frequency eigenmodes of a coaxial wave guide containing a relativistic annular electron beam with a coaxial wiggler
53 Beam shaping assembly optimization of Linac based BNCT and in-phantom depth dose distribution analysis of brain tumors for verification of a beam model
54 Suggesting a new design for multileaf collimator leaves based on Monte Carlo simulation of two commercial systems
55 Neutron Radiography System Collimator Design via Monte Carlo Calculation
56 AN INVESTIGATION OF THE EFFECT PHYTOREMEDIATION ON DISSIPATION RATE OF TOTAL PETROLEUM HYDROCARBONS IN A LIME SOIL
57 Discrete formulation for two-dimensional multigroup neutron diffusion equations
58 Direct discrete method and its application to neutron transport problems
59 Direct Discrete Method for Neutronic Calculations

Tagging Red Flags

library(stringr)

majid_works_long = majid_works_long %>% 
  mutate(red_flag = ifelse(str_detect(tolower(title), ('soil moisture|surface displacement|land displacement')), 1, #1 = RED: author is mohammad shahriari
                           ifelse(str_detect(tolower(title), ('borehole resistivity measurements')), 2, #2 = RED: author is an Mostafa shahriari
                                 ifelse(str_detect(tolower(title), ('bank cash')), 3,   #3 = RED: author is a b-school majid shahriari from Islamic Azad University
                                    ifelse(str_detect(tolower(title), ('phytoremediation')), 4,  #4 = RED: author is malak hossein shahriari
                                          ifelse(str_detect(tolower(title), ('borehole p')), 5, #5 = YELLOW FLAG: probably majid from grad school
                                                 ifelse(str_detect(tolower(title), ('airborne')), 6, 0))))))) #6 = YELLOW FLAG: weird topic but probably majid based on institution

*Notes**:

We searched OpenAlex for any names that could be Majid Shahriari, including M Shahriari, M. Shahriari, Majid Shahriari, and other ways to spell Shahriari We outlined the list of all works published under four researcher profiles on Open Alex that could reasonably be our researcher of interest. It is obvious that some of the works were misplaced on these researcher profiles, such that some of these works were not written by our Majid Shahriari of interest. We did a combination of the following to attempt to red-flag works that were not his:

  • sorted the works by year and identified works well after his death in 2010. Searched those works to track down the author’s name or institution to verify whether or not they were our Majid

  • submitted the list of titles to chatGPT to identify any works that stood out as ill fitting to the general nuclear physicist profile. chatGPT identified 5 works that were clearly a bad fit, and 4 more works that were borderline cases. We searched for those works and attempted to find any indication that they were not written by our Majid Shahriari of interest.

Accordingly, we removed the following works from our analysis:

  • Authored by Mohammed Shahriari:

    • Shahriari, M. A., Aghighi, H., Azadbakht, M., Ashourloo, D., Matkan, A. A., Brakhasi, F., & Walker, J. P. (2025). Soil moisture estimation using combined SAR and optical imagery: Application of seasonal machine learning algorithms. Advances in Space Research, 75(8), 6207-6221.

    • Shami, S., Shahriari, M. A., Nilfouroushan, F., Forghani, N., Salimi, M., & Reshadi, M. A. M. (2024). Surface displacement measurement and modeling of the Shah-Gheyb salt dome in southern Iran using InSAR and machine learning techniques. International Journal of Applied Earth Observation and Geoinformation, 132, 104016.

    • Abdalla, A., Shami, S., Shahriari, M. A., & Azar, M. K. (2024). Estimation of land displacement in East Baton Rouge Parish, Louisiana, using InSAR: comparisons with GNSS and machine learning models. The Egyptian Journal of Remote Sensing and Space Sciences, 27(2), 204-215.

  • Authored by Mostafa Shahriari:

    • Shahriari, M., Pardo, D., Kargaran, S., & Teijeiro, T. (2023). Neural network architecture optimization using automated machine learning for borehole resistivity measurements. Geophysical Journal International, 234(3), 2487-2500.
  • Authored by a Majid Shahriari from Islamic Azad University:

    • Shahriari, M. (2015). Analytical Modeling of Bank Cash Flow: An Uncertain System Dynamics Approach. Asian Journal of Research in Banking and Finance, 5(1), 134-146.
  • Authored by Malak Hossein Shahriari:

    • SHAHRIARI, M., SAVAGHEBI, F. G. R., & MINAEI, T. D. (2008). AN INVESTIGATION OF THE EFFECT PHYTOREMEDIATION ON DISSIPATION RATE OF TOTAL PETROLEUM HYDROCARBONS IN A LIME SOIL.

List of removed works and their topics:

library(dplyr)
library(knitr)
library(kableExtra)

majid_works_long %>%
  distinct(title, .keep_all = TRUE) %>%
  filter(red_flag > 0 & red_flag < 5) %>%
  kable(caption = "List of removed works and their topics") %>%
  kable_styling(full_width = FALSE, bootstrap_options = c("striped", "hover")) %>%
  scroll_box(width = "100%", height = "500px")
List of removed works and their topics
id title publication_date publication_year topic score subfield field domain topics_id authorships author_id red_flag
W4407030299 Soil Moisture Estimation Using Combined SAR and Optical Imagery: Application of Seasonal Machine Learning Algorithms 2025-01-01 2025 Soil Moisture and Remote Sensing 0.9997 Environmental Engineering Environmental Science Physical Sciences T11312 first , middle , middle , middle , middle , middle , last , FALSE , FALSE , FALSE , FALSE , FALSE , FALSE , FALSE , Mohammad Amin Shahriari , Hossein Aghighi , Mohsen Azadbakht , Davoud Ashourloo , Ali Akbar Matkan , Foad Brakhasi , Jeffrey P. Walker , https://openalex.org/A5111646381 , https://openalex.org/A5035611806 , https://openalex.org/A5061978391 , https://openalex.org/A5062913577 , https://openalex.org/A5056179445 , https://openalex.org/A5078602071 , https://openalex.org/A5020270621 , M. Shahriari , Hossein Aghighi , Mohsen Azadbakht , Davoud Ashourloo , Ali Akbar Matkan , Foad Brakhasi , Jeffrey P. Walker , NA , https://orcid.org/0000-0001-6455-3489, https://orcid.org/0000-0002-5175-9354, https://orcid.org/0000-0001-6244-2929, https://orcid.org/0000-0001-5394-4599, https://orcid.org/0000-0002-5954-389X, https://orcid.org/0000-0002-4817-2712 A5111646381 1
W4400541353 Surface displacement measurement and modeling of the Shah-Gheyb salt dome in southern Iran using InSAR and machine learning techniques 2024-07-11 2024 Synthetic Aperture Radar (SAR) Applications and Techniques 0.9986 Aerospace Engineering Engineering Physical Sciences T10801 first , middle , middle , middle , middle , last , https://openalex.org/I80543232 , K.N.Toosi University of Technology , https://ror.org/0433abe34 , IR , funder , https://openalex.org/I80543232 , https://openalex.org/I48379061 , Shahid Beheshti University , https://ror.org/0091vmj44 , IR , education , https://openalex.org/I48379061 , https://openalex.org/I4210141702 , https://openalex.org/I4210096968 , University of Gävle , Lantmäteriet , https://ror.org/043fje207 , https://ror.org/00skbbq95 , SE , SE , funder , government , https://openalex.org/I4210141702 , https://openalex.org/I4210096968 , https://openalex.org/I41832843 , University of Tabriz , https://ror.org/01papkj44 , IR , funder , https://openalex.org/I41832843 , https://openalex.org/I48379061 , Shahid Beheshti University , https://ror.org/0091vmj44 , IR , education , https://openalex.org/I48379061 , https://openalex.org/I151746483 , University of Waterloo , https://ror.org/01aff2v68 , CA , funder , https://openalex.org/I151746483 , IR , IR , SE , IR , IR , CA , FALSE , FALSE , TRUE , FALSE , FALSE , FALSE , Siavash Shami , Mohammad Amin Shahriari , Faramarz Nilfouroushan , Neda Forghani , Maryam Salimi , Mir Amir Mohammad Reshadi , Department of Geodesy, Faculty of Geodesy and Geomatics Engineering, K. N. Toosi University of Technology, Tehran, Iran , Center for Remote Sensing and Geographic Information System Research, The Faculty of Earth Sciences, Shahid Beheshti University, Tehran, Iran , Department of Computer and Geospatial Sciences, University of Gävle, Gävle, Sweden , Department of Geodetic Infrastructure, Geodata Division, Lantmäteriet, Gävle, Sweden , Earth Sciences Department, Faculty of Natural Science, University of Tabriz, Tabriz, Iran , Department of Minerals and Groundwater Resources, Faculty of Earth Sciences, Shahid Beheshti University, Tehran, Iran , Ecohydrology Research Group, Department of Earth and Environmental Sciences and Water Institute, University of Waterloo, Waterloo, Ontario, Canada, Department of Geodesy, Faculty of Geodesy and Geomatics Engineering, K. N. Toosi University of Technology, Tehran, Iran , https://openalex.org/I80543232 , Center for Remote Sensing and Geographic Information System Research, The Faculty of Earth Sciences, Shahid Beheshti University, Tehran, Iran , https://openalex.org/I48379061 , Department of Computer and Geospatial Sciences, University of Gävle, Gävle, Sweden , Department of Geodetic Infrastructure, Geodata Division, Lantmäteriet, Gävle, Sweden , https://openalex.org/I4210141702 , https://openalex.org/I4210096968 , Earth Sciences Department, Faculty of Natural Science, University of Tabriz, Tabriz, Iran , https://openalex.org/I41832843 , Department of Minerals and Groundwater Resources, Faculty of Earth Sciences, Shahid Beheshti University, Tehran, Iran , https://openalex.org/I48379061 , Ecohydrology Research Group, Department of Earth and Environmental Sciences and Water Institute, University of Waterloo, Waterloo, Ontario, Canada, https://openalex.org/I151746483 , https://openalex.org/A5040655535 , https://openalex.org/A5111646381 , https://openalex.org/A5034288858 , https://openalex.org/A5103312121 , https://openalex.org/A5056253060 , https://openalex.org/A5002533480 , Siavash Shami , M. Shahriari , Faramarz Nilfouroushan , Neda Forghani , Maryam Salimi , Mir Amir Mohammad Reshadi , https://orcid.org/0000-0002-6369-7170 , NA , https://orcid.org/0000-0003-1744-7004 , NA , NA , https://orcid.org/0000-0001-7975-5083 A5111646381 1
W4392573751 Estimation of land displacement in East Baton Rouge Parish, Louisiana, using InSAR: Comparisons with GNSS and machine learning models 2024-03-07 2024 Synthetic Aperture Radar (SAR) Applications and Techniques 0.9998 Aerospace Engineering Engineering Physical Sciences T10801 first , middle , middle , last , https://openalex.org/I121820613 , Louisiana State University , https://ror.org/05ect4e57 , US , funder , https://openalex.org/I121820613 , https://openalex.org/I80543232 , K.N.Toosi University of Technology , https://ror.org/0433abe34 , IR , funder , https://openalex.org/I80543232 , https://openalex.org/I48379061 , Shahid Beheshti University , https://ror.org/0091vmj44 , IR , education , https://openalex.org/I48379061 , https://openalex.org/I100930933 , University College Dublin , https://ror.org/05m7pjf47 , IE , funder , https://openalex.org/I100930933 , US , IR , IR , IE , TRUE , FALSE , FALSE , FALSE , Ahmed Abdalla , Siavash Shami , Mohammad Amin Shahriari , Mahdi Khoshlahjeh Azar , Department of Civil and Environmental Engineering, Louisiana State University, LA 70803, Baton Rouge, USA , Department of Geodesy, Faculty of Geodesy and Geomatics Engineering, K. N. Toosi University of Technology, Tehran, Iran , Center for Remote Sensing and Geographic Information System Research, The Faculty of Earth Sciences, Shahid Beheshti University, Tehran, Iran, SFI Research Centre in Applied Geosciences (iCRAG), University College Dublin, Belfield, Dublin 4, Ireland , UCD School of Earth Sciences, University College Dublin, Belfield, Dublin 4, Ireland , Department of Civil and Environmental Engineering, Louisiana State University, LA 70803, Baton Rouge, USA , https://openalex.org/I121820613 , Department of Geodesy, Faculty of Geodesy and Geomatics Engineering, K. N. Toosi University of Technology, Tehran, Iran , https://openalex.org/I80543232 , Center for Remote Sensing and Geographic Information System Research, The Faculty of Earth Sciences, Shahid Beheshti University, Tehran, Iran, https://openalex.org/I48379061 , UCD School of Earth Sciences, University College Dublin, Belfield, Dublin 4, Ireland , SFI Research Centre in Applied Geosciences (iCRAG), University College Dublin, Belfield, Dublin 4, Ireland , https://openalex.org/I100930933 , https://openalex.org/I100930933 , https://openalex.org/A5072765914 , https://openalex.org/A5040655535 , https://openalex.org/A5111646381 , https://openalex.org/A5028021938 , Ahmed Abdalla , Siavash Shami , M. Shahriari , Mahdi Khoshlahjeh Azar , https://orcid.org/0000-0003-4305-8248 , https://orcid.org/0000-0002-6369-7170 , NA , https://orcid.org/0000-0002-7428-6799 A5111646381 1
W4381846028 Neural network architecture optimization using automated machine learning for borehole resistivity measurements 2023-04-27 2023 Geophysical and Geoelectrical Methods 0.9998 Geophysics Earth and Planetary Sciences Physical Sciences T10572 first , middle , middle , last , https://openalex.org/I4210126338 , Software Competence Center Hagenberg (Austria) , https://ror.org/02ks3nr96 , AT , company , https://openalex.org/I4210126338 , https://openalex.org/I169108374 , https://openalex.org/I2802176441 , https://openalex.org/I110594554 , University of the Basque Country , Basque Center for Applied Mathematics , Ikerbasque , https://ror.org/000xsnr85 , https://ror.org/03b21sh32 , https://ror.org/01cc3fy72 , ES , ES , ES , funder , funder , other , https://openalex.org/I169108374 , https://openalex.org/I2802176441 , https://openalex.org/I110594554 , https://openalex.org/I4210126338 , Software Competence Center Hagenberg (Austria) , https://ror.org/02ks3nr96 , AT , company , https://openalex.org/I4210126338 , https://openalex.org/I169108374 , https://openalex.org/I2802176441 , University of the Basque Country , Basque Center for Applied Mathematics , https://ror.org/000xsnr85 , https://ror.org/03b21sh32 , ES , ES , funder , funder , https://openalex.org/I169108374 , https://openalex.org/I2802176441 , AT , ES , AT , ES , FALSE , FALSE , FALSE , FALSE , M Shahriari , D Pardo , S Kargaran , T Teijeiro , GE Healthcare Austria GmbH , Tiefenbach 15, 4871 Zipf , Austria , Software Competence Center Hagenberg GmbH (SCCH) , Softwarepark 32a, 4232 Hagenberg , Austria, Basque Center for Applied Mathematics, (BCAM) , 48009 Bilbao , Spain , Department of Mathematics, University of the Basque Country (UPV/EHU) , Leioa 48940 , Spain , Ikerbasque (Basque Foundation for Sciences) , 48009 Bilbao , Spain , Software Competence Center Hagenberg GmbH (SCCH) , Softwarepark 32a, 4232 Hagenberg , Austria, Basque Center for Applied Mathematics, (BCAM) , 48009 Bilbao , Spain , Department of Mathematics, University of the Basque Country (UPV/EHU) , Leioa 48940 , Spain , GE Healthcare Austria GmbH , Tiefenbach 15, 4871 Zipf , Austria , Software Competence Center Hagenberg GmbH (SCCH) , Softwarepark 32a, 4232 Hagenberg , Austria, https://openalex.org/I4210126338 , Department of Mathematics, University of the Basque Country (UPV/EHU) , Leioa 48940 , Spain , Basque Center for Applied Mathematics, (BCAM) , 48009 Bilbao , Spain , Ikerbasque (Basque Foundation for Sciences) , 48009 Bilbao , Spain , https://openalex.org/I169108374 , https://openalex.org/I2802176441 , https://openalex.org/I110594554 , Software Competence Center Hagenberg GmbH (SCCH) , Softwarepark 32a, 4232 Hagenberg , Austria, https://openalex.org/I4210126338 , Department of Mathematics, University of the Basque Country (UPV/EHU) , Leioa 48940 , Spain , Basque Center for Applied Mathematics, (BCAM) , 48009 Bilbao , Spain , https://openalex.org/I169108374 , https://openalex.org/I2802176441 , https://openalex.org/A5111646381 , https://openalex.org/A5082696717 , https://openalex.org/A5066639524 , https://openalex.org/A5028757448 , M. Shahriari , David Pardo , S. Kargaran , Tomás Teijeiro , NA , https://orcid.org/0000-0002-1101-2248 , NA , https://orcid.org/0000-0002-2175-7382 A5111646381 2
W1971450968 Analytical Modeling of Bank Cash Flow: An Uncertain System Dynamics Approach 2015-01-01 2015 Banking stability, regulation, efficiency 0.6583 Finance Economics, Econometrics and Finance Social Sciences T10127 first , TRUE , Majid Shahriari , https://openalex.org/A5112039075, Majid Shahriari , NA A5112039075 3
W2272663843 AN INVESTIGATION OF THE EFFECT PHYTOREMEDIATION ON DISSIPATION RATE OF TOTAL PETROLEUM HYDROCARBONS IN A LIME SOIL 2008-01-01 2008 Municipal Solid Waste Management 0.2098 Industrial and Manufacturing Engineering Environmental Science Physical Sciences T11108 first , middle , last , FALSE , FALSE , FALSE , M H Shahriari , Savaghebi Firouzabadi Gh.R. , D Minaei Tehrani , https://openalex.org/A5112039075, https://openalex.org/A5002056791, https://openalex.org/A5112040075, Majid Shahriari , Savaghebi Firouzabadi Gh.R. , D Minaei Tehrani , NA , NA , NA A5112039075 4

In addition, the following were flagged by chatGPT as “borderline cases” but I couldn’t find any reason to verify that they weren’t our researcher of interest:

  • Odd topic (air quality) that is out of M Shahriari’s wheelhouse, but the author M Shahriari here is listed as from the Nuclear Engineering Dept at Shahid Beheshti
    • Athari, M., Sohrabpour, M., Shahriari, M., & Rostami, S. (2004). Elemental characterization of TSP and two size fractions of airborne particulate matter from Tehran by INAA and AAS. Journal of radioanalytical and nuclear chemistry, 260(2), 351-356.
  • “Borehole” topic is odd for him, but it seems like they were done when he was at grad school (?) at Amir Kabir University of Technology
    • Shahriari, M., & Sohrabpour, M. (2000). Borehole parametric study for neutron induced capture γ-ray spectrometry using the MCNP code. Applied Radiation and Isotopes, 52(1), 127-135.
    • Sohrabpour, M., Shahriari, M., Zarifian, V., & Moghadam, K. K. (1999). Borehole prompt gamma neutron activation and comparison with Monte Carlo simulation using MCNP code: Borehole PGNAA experiment comparison with MCNP. Applied radiation and isotopes, 50(4), 805-810.

List of “yellow flagged” papers and their topics

library(dplyr)
library(knitr)
library(kableExtra)

# Show yellow-flagged works (red_flag > 4)
majid_works_long %>%
  distinct(title, .keep_all = TRUE) %>%
  filter(red_flag > 4) %>%
  kable(caption = "List of 'Yellow Flagged' works and their topics") %>%
  kable_styling(full_width = FALSE, bootstrap_options = c("striped", "hover")) %>%
  scroll_box(width = "100%", height = "500px")
List of ‘Yellow Flagged’ works and their topics
id title publication_date publication_year topic score subfield field domain topics_id authorships author_id red_flag
W2078244416 Elemental characterization of TSP and two size fractions of airborne particulate matter from Tehran by INAA and AAS 2004-01-01 2004 Air Quality and Health Impacts 0.9961 Health, Toxicology and Mutagenesis Environmental Science Physical Sciences T10190 first , middle , middle , last , https://openalex.org/I158248296 , Amirkabir University of Technology , https://ror.org/04gzbav43 , IR , funder , https://openalex.org/I158248296 , https://openalex.org/I102962589 , Atomic Energy Organization of Iran , https://ror.org/04feqxb79 , IR , government , https://openalex.org/I102962589 , https://openalex.org/I48379061 , Shahid Beheshti University , https://ror.org/0091vmj44 , IR , education , https://openalex.org/I48379061 , https://openalex.org/I102962589 , Atomic Energy Organization of Iran , https://ror.org/04feqxb79 , IR , government , https://openalex.org/I102962589 , IR , IR , IR , IR , FALSE , FALSE , FALSE , FALSE , M. Athari , M. Sohrabpour , M. Shahriari , S. Rostami , Physics Department, Amirkabir University of Technology (Tehran Polytechnic), Tehran, Iran, Gamma Irradiation Center Atomic Energy Organization of Iran, Tehran, Iran , Nuclear Engineering Department, Shahid Beheshti University, Tehran, Iran. , Gamma Irradiation Center Atomic Energy Organization of Iran, Tehran, Iran , Physics Department, Amirkabir University of Technology (Tehran Polytechnic), Tehran, Iran, https://openalex.org/I158248296 , Gamma Irradiation Center Atomic Energy Organization of Iran, Tehran, Iran , https://openalex.org/I102962589 , Nuclear Engineering Department, Shahid Beheshti University, Tehran, Iran. , https://openalex.org/I48379061 , Gamma Irradiation Center Atomic Energy Organization of Iran, Tehran, Iran , https://openalex.org/I102962589 , https://openalex.org/A5059645385 , https://openalex.org/A5043624191 , https://openalex.org/A5111646381 , https://openalex.org/A5026414732 , Mir Hadi Athari , M. Sohrabpour , M. Shahriari , Saman Rostami , https://orcid.org/0000-0002-2779-2226 , NA , NA , NA A5111646381 6
W2071311553 Borehole parametric study for neutron induced capture γ-ray spectrometry using the MCNP code 2000-01-01 2000 Nuclear Physics and Applications 0.9999 Radiation Physics and Astronomy Physical Sciences T11949 first , last , https://openalex.org/I158248296 , Amirkabir University of Technology , https://ror.org/04gzbav43 , IR , funder , https://openalex.org/I158248296 , https://openalex.org/I102962589 , Atomic Energy Organization of Iran , https://ror.org/04feqxb79 , IR , government , https://openalex.org/I102962589 , IR , IR , FALSE , FALSE , M Shahriari , M Sohrabpour , Physics Department, Amir-Kabir University of Technology, Tehran, Iran , Gamma Irradiation Center, Atomic Energy Organization of Iran, POB 11365-8486, Tehran, Iran, Physics Department, Amir-Kabir University of Technology, Tehran, Iran , https://openalex.org/I158248296 , Gamma Irradiation Center, Atomic Energy Organization of Iran, POB 11365-8486, Tehran, Iran, https://openalex.org/I102962589 , https://openalex.org/A5111646381 , https://openalex.org/A5043624191 , M. Shahriari , M. Sohrabpour , NA , NA A5111646381 5
W1553051535 Borehole prompt gamma neutron activation and comparison with Monte Carlo simulation using MCNP code 1999-04-01 1999 Nuclear Physics and Applications 0.9999 Radiation Physics and Astronomy Physical Sciences T11949 first , middle , middle , last , https://openalex.org/I102962589 , Atomic Energy Organization of Iran , https://ror.org/04feqxb79 , IR , government , https://openalex.org/I102962589 , https://openalex.org/I158248296 , Amirkabir University of Technology , https://ror.org/04gzbav43 , IR , funder , https://openalex.org/I158248296 , https://openalex.org/I102962589 , Atomic Energy Organization of Iran , https://ror.org/04feqxb79 , IR , government , https://openalex.org/I102962589 , IR , IR , IR , FALSE , FALSE , FALSE , FALSE , M. Sohrabpour , M. Shahriari , V. Zarifian , K.K. Moghadam , Gamma Irradiation Center, Atomic Energy Organization of Iran, POB 11365-8486, Tehran, I.R. Iran, Physics Department, Amir Kabir University of Technology, Tehran, I.R. Iran , Nuclear Research Center, Atomic Energy Organization of Iran, POB 11365-8486, Tehran, I.R. Iran , Gamma Irradiation Center, Atomic Energy Organization of Iran, POB 11365-8486, Tehran, I.R. Iran, https://openalex.org/I102962589 , Physics Department, Amir Kabir University of Technology, Tehran, I.R. Iran , https://openalex.org/I158248296 , Nuclear Research Center, Atomic Energy Organization of Iran, POB 11365-8486, Tehran, I.R. Iran , https://openalex.org/I102962589 , https://openalex.org/A5043624191 , https://openalex.org/A5111646381 , https://openalex.org/A5084946711 , https://openalex.org/A5035266764 , M. Sohrabpour , M. Shahriari , V. Zarifian , K. Kamali Moghadam , NA , NA , NA , NA A5111646381 5
# Keep only works with red_flag < 1 or red_flag > 4
majid_works_long <- majid_works_long %>%
  filter(red_flag < 1 | red_flag > 4)

# Pivot to wide format
majid_works <- majid_works_long %>%
  group_by(id) %>%
  mutate(row_num = row_number()) %>%
  ungroup() %>%
  pivot_wider(
    id_cols = c(title, publication_date, id, author_id, authorships, publication_year),
    names_from = row_num,
    values_from = c(topic, score, subfield, field, domain),
    names_glue = "{.value}_{row_num}"
  )

# Show how many rows remain
nrow(majid_works)
## [1] 53
#saveRDS(majid_works_long, file.path("/standard/nsdpi_storage/people/czj9zj/DiD_data_3topic/extra_data", "majid_works_long.rds"))

After consolidating the author profiles and resolving the red flags, we have a total of 52 works for Majid Shahriari

Extract Majid’s Topics

topic_summary <- readRDS("/standard/nsdpi_storage/people/czj9zj/DiD_data_3topic/extra_data/topic_summary.rds")

# Get unique topics from majid_works_long
majid_unique_topics <- unique(majid_works_long$topic)

# Subset topic_summary where Topic matches
majid_keywords_v1 <- topic_summary[topic_summary$Topic %in% majid_unique_topics, ]

# Save
#saveRDS(majid_keywords_v1, file = file.path(data_path, "majid_keywords_v1.rds"))
extract_institutions_for_authors <- function(works_df, author_ids) {
  # Dependencies: dplyr, tidyr, purrr
  # author_ids: character vector like c("A5046683464", "A5053153243", ...)
  
  # Build URL set from IDs
  target_urls <- paste0("https://openalex.org/", unique(na.omit(author_ids)))
  
  # 1-row NA placeholder for missing institutions
  na_inst <- tibble::tibble(
    id           = NA_character_,
    display_name = NA_character_,
    ror          = NA_character_,
    country_code = NA_character_,
    type         = NA_character_
  )
  
  works_df %>%
    dplyr::transmute(
      work_id          = id,
      work_title       = title,
      publication_year = dplyr::coalesce(
        publication_year,
        suppressWarnings(as.integer(substr(as.character(publication_date), 1, 4)))
      ),
      authorships
    ) %>%
    tidyr::unnest(authorships, keep_empty = TRUE) %>%              # one row per author
    dplyr::filter(author.id %in% target_urls) %>%                  # keep only your target author(s)
    dplyr::mutate(
      institutions = purrr::map(institutions, function(x) {        # handle empty institutions
        if (is.data.frame(x) && nrow(x) > 0) {
          x[, intersect(names(x), c("id","display_name","ror","country_code","type")), drop = FALSE]
        } else {
          na_inst
        }
      }),
      matched_author_id = gsub("^https://openalex.org/", "", author.id)
    ) %>%
    tidyr::unnest(institutions, keep_empty = TRUE) %>%
    dplyr::rename(
      inst_openalex = id,
      inst_name     = display_name,
      inst_ror      = ror,
      inst_country  = country_code,
      inst_type     = type,
      author_openalex = author.id
    ) %>%
    dplyr::mutate(
      source_author_id = matched_author_id
    ) %>%
    dplyr::select(
      work_id, work_title, publication_year,
      author_position, is_corresponding,
      author_openalex,
      inst_openalex, inst_name, inst_ror, inst_country, inst_type,
      source_author_id
    ) %>%
    dplyr::distinct()
}

Institution

Tab 1

library(dplyr)
library(ggplot2)
library(forcats)

# Majid candidate author IDs
ids <- c("A5028976637", "A5102177495", "A5111646381", "A5112039075")

# Extract institutions for all Majid candidates
insts_majid <- extract_institutions_for_authors(
  works_df   = majid_works, 
  author_ids = ids
)

# Overall counts
inst_counts <- insts_majid %>%
  mutate(inst_name = if_else(is.na(inst_name) | inst_name == "", "Unknown / missing", inst_name)) %>%
  count(inst_name, sort = TRUE)

# Horizontal bar plot
ggplot(inst_counts, aes(x = n, y = fct_reorder(inst_name, n))) +
  geom_col() +
  labs(
    title = "Institution Distribution for Majid Shahriari",
    x = "Count",
    y = "Institution"
  ) +
  theme_minimal()

Tab 2

library(dplyr)
library(ggplot2)
library(forcats)

# 9 Abbasi candidate author IDs
abbasi_ids <- c(
  "A5046683464","A5053153243","A5019064523",
  "A5103485250","A5030806477","A5103401909",
  "A5103918614","A5024862143","A5037724110"
)

# Extract institutions for all Abbasi candidates
insts_abbasi <- extract_institutions_for_authors(
  works_df   = abbasi_works,   # <- your merged works df for Abbasi
  author_ids = abbasi_ids
)

# Counts (overall)
inst_counts <- insts_abbasi %>%
  mutate(inst_name = if_else(is.na(inst_name) | inst_name == "", "Unknown / missing", inst_name)) %>%
  count(inst_name, sort = TRUE)

# 2) Overall distribution (horizontal bar plot)
ggplot(inst_counts, aes(x = n, y = fct_reorder(inst_name, n))) +
  geom_col() +
  labs(
    title = "Institution Distribution for Fereydoon Abbasi Davani",
    x = "Count",
    y = "Institution"
  ) +
  theme_minimal()

Tab 3

insts_masoud <- extract_institutions_for_authors(masoud_works,  c("A5059661145", "A5111436477"))


inst_counts <- insts_masoud %>%
  mutate(inst_name = if_else(is.na(inst_name) | inst_name == "",
                             "Unknown / missing", inst_name)) %>%
  count(inst_name, sort = TRUE)

# 2) Overall distribution (horizontal bar plot)
ggplot(inst_counts,
       aes(x = n, y = fct_reorder(inst_name, n))) +
  geom_col() +
  labs(
    title = "Institution Distribution for Masoud Alimohammadi",
    x = "Count",
    y = "Institution"
  ) +
  theme_minimal()

Tab 4

# 1) Extract institutions for Ardeshir Hosseinpour's works
insts_hosseinpour <- extract_institutions_for_authors(
  hosseinpour_works, 
  c("A5048006655", "A5028383055")   # his two OpenAlex IDs
)

# 2) Clean and count institutional affiliations
inst_counts_hosseinpour <- insts_hosseinpour %>%
  mutate(inst_name = if_else(is.na(inst_name) | inst_name == "",
                             "Unknown / missing", inst_name)) %>%
  count(inst_name, sort = TRUE)

# 3) Visualize distribution (horizontal bar plot)
ggplot(inst_counts_hosseinpour,
       aes(x = n, y = fct_reorder(inst_name, n))) +
  geom_col() +
  labs(
    title = "Institution Distribution for Ardeshir Hosseinpour",
    x = "Count",
    y = "Institution"
  ) +
  theme_minimal()

library(dplyr)
library(ggplot2)
library(forcats)
library(patchwork)

# Define a custom palette
layer_colors <- c(
  "Majid"       = "#587CA0",  # blue-gray
  "Abbasi"      = "#B3C7D6",  # light blue-gray
  "Masoud"      = "#808080",  # dark gray
  "Hosseinpour" = "#404040"   # very dark gray
)

# helper: make a horizontal bar plot with custom fill + subtitle
plot_inst_dist <- function(works_df, author_ids, title, subtitle_text, fill_color){
  extract_institutions_for_authors(works_df, author_ids) %>%
    mutate(inst_name = if_else(is.na(inst_name) | inst_name == "", "Unknown / missing", inst_name)) %>%
    count(inst_name, sort = TRUE) %>%
    ggplot(aes(x = n, y = fct_reorder(inst_name, n))) +
    geom_col(fill = fill_color) +
    labs(title = title,
         subtitle = subtitle_text,
         x = "Count", y = "Institution") +
    theme_minimal(base_size = 10) +
    theme(
      plot.title = element_text(face = "bold", size = 11),
      plot.subtitle = element_text(size = 9, margin = margin(b = 6)),
      panel.grid.major.y = element_blank()
    )
}

# Build the four plots with subtitles showing "Total Works Identified"
p1 <- plot_inst_dist(
  works_df      = majid_works,
  author_ids    = ids,
  title         = "Institution Distribution for Majid Shahriari",
  subtitle_text = "Total Works Identified: 52",
  fill_color    = layer_colors["Majid"]
)

p2 <- plot_inst_dist(
  works_df      = abbasi_works,
  author_ids    = c("A5046683464","A5053153243","A5019064523",
                    "A5103485250","A5030806477","A5103401909",
                    "A5103918614","A5024862143","A5037724110"),
  title         = "Institution Distribution for Fereydoon Abbasi Davani",
  subtitle_text = "Total Works Identified: 125",
  fill_color    = layer_colors["Abbasi"]
)

p3 <- plot_inst_dist(
  works_df      = masoud_works,
  author_ids    = c("A5059661145","A5111436477"),
  title         = "Institution Distribution for Masoud Alimohammadi",
  subtitle_text = "Total Works Identified: 69",
  fill_color    = layer_colors["Masoud"]
)

p4 <- plot_inst_dist(
  works_df      = hosseinpour_works,
  author_ids    = c("A5048006655","A5028383055"),
  title         = "Institution Distribution for Ardeshir Hosseinpour",
  subtitle_text = "Total Works Identified: 11",
  fill_color    = layer_colors["Hosseinpour"]
)

# 2x2 grid
combined <- (p1 | p2) / (p3 | p4)

# show in RMarkdown and/or save
combined

# Save to your data_path
data_path <- "/standard/nsdpi_storage/people/czj9zj/extra_data"

ggsave(
  filename = file.path(data_path, "institution_distributions_2x2.pdf"),
  plot     = combined,
  width    = 16,
  height   = 8,
  device   = cairo_pdf
)

ggsave(
  filename = file.path(data_path, "institution_distributions_2x2.png"),
  plot     = combined,
  width    = 16,
  height   = 8,
  dpi      = 300
)
library(dplyr)
library(purrr)
library(knitr)
library(kableExtra)
library(dplyr)
library(purrr)

extra_data_path <- file.path("/standard/nsdpi_storage/people/czj9zj/DiD_data_3topic", "extra_data")

abbasi_works_long <- readRDS(file.path(extra_data_path, "abbasi_works_long.rds"))
abbasi_works <- readRDS(file.path(extra_data_path, "abbasi_works.rds"))

# Build exclusive topic sets
majid_topics  <- unique(majid_works_long$topic)
abbasi_topics <- unique(abbasi_works_long$topic)
majid_unique_topics  <- setdiff(majid_topics, abbasi_topics)

# Helper: does a work have ANY high-confidence "topic" in the given exclusive set?
has_highconf_exclusive <- function(topic_tbl, exclusive_set, min_score = 0.97) {
  nrow(topic_tbl) > 0 &&
    any(topic_tbl$type == "topic" &
        topic_tbl$score >= min_score &
        topic_tbl$display_name %in% exclusive_set)
}

# Works matching Majid's EXCLUSIVE topics (not shared)
sbu_majid_unique_works <- works_393 %>%
  filter(map_lgl(topics, ~ has_highconf_exclusive(.x, majid_unique_topics, min_score = 0.97)))

# Complement: works NOT matching Majid's exclusive topics
sbu_non_majid_unique_works <- works_393 %>%
  filter(!map_lgl(topics, ~ has_highconf_exclusive(.x, majid_unique_topics, min_score = 0.97)))

Abbasi Plot

F. Abbasi Profiles

Possible author IDs for Freyedoon Abbasi Davani (or: Feryidoon, Freidoon, Fereidon, Fereydoun, Fereydoon, Ferydoon; Abbassi Davani, Abbasi-Davani, AbbasiDavani

  • A5046683464 (1 work)
  • A5053153243 (1 work)
  • A5019064523 (1 work)
  • A5103485250 (1 work)
  • A5030806477 (1 work)
  • A5103401909 (13 works)
  • A5103918614 (1 work)
  • A5024862143 (1 work)
  • A5037724110 (104 works)
library(dplyr)
library(kableExtra)
library(tidyr)

# Build the data with consistent types (use NA for missing numeric values)
authors_raw <- tibble::tribble(
  ~`Author ID`, ~`Author Name`,              ~`Alternate Names`,                                                                                                                                          ~Institution,                  ~`Past institutions`,                                                                                                                                            ~ORCID, ~`H-index`, ~`i10-index`, ~Works, ~Citations,
  "<a href='https://openalex.org/authors/a5046683464' target='_blank'>A5046683464</a>", "Feryidoon Abbasi Davani", "Feryidoon Abbasi Davani",                                                                                                                  "Shahid Beheshti University", "Shahid Beheshti University",                                                                                                                                        NA,     NA,        NA,          1,      NA,
  "<a href='https://openalex.org/authors/a5053153243' target='_blank'>A5053153243</a>", "Freidoon Abbasi Davani",   "Freidoon Abbasi Davani",                                                                                                                    NA,                          NA,                                                                                                                                                              NA,     1,         NA,          1,      3,
  "<a href='https://openalex.org/authors/a5019064523' target='_blank'>A5019064523</a>", "Abbasi Davani Fereydoun",  "Abbasi Davani Fereydoun",                                                                                                                   "Shahid Beheshti University", "Shahid Beheshti University",                                                                                                                                        NA,     1,         NA,          2,      2,
  "<a href='https://openalex.org/authors/a5103485250' target='_blank'>A5103485250</a>", "Fereidon Abbasi Davani",   "Fereidon Abbasi Davani",                                                                                                                    "Shahid Beheshti University", "Shahid Beheshti University",                                                                                                                                        NA,     NA,        NA,          2,      NA,
  "<a href='https://openalex.org/authors/a5030806477' target='_blank'>A5030806477</a>", "Abbasi Davani Fereydoon",  "Abbasi Davani Fereydoon",                                                                                                                   NA,                          NA,                                                                                                                                                              NA,     NA,        NA,          1,      NA,
  "<a href='https://openalex.org/authors/a5103401909' target='_blank'>A5103401909</a>", "Fereydoon Abbasi Davani",  "Fereydoon Abbasi Davani",                                                                                                                   "Shahid Beheshti University", "Shahid Beheshti University",                                                                                                                                        NA,     2,         NA,          13,     6,
  "<a href='https://openalex.org/authors/a5103918614' target='_blank'>A5103918614</a>", "Ferydoon Abbasi Davani",   "Ferydoon Abbasi Davani",                                                                                                                    "Shahid Beheshti University", "Shahid Beheshti University",                                                                                                                                        NA,     NA,        NA,          1,      NA,
  "<a href='https://openalex.org/authors/a5024862143' target='_blank'>A5024862143</a>", "Fereydoon Abbassi Davani", "Fereydoon Abbassi Davani",                                                                                                                  "Shahid Beheshti University", "Shahid Beheshti University",                                                                                                                                        NA,     1,         NA,          1,      2,
  "<a href='https://openalex.org/authors/a5037724110' target='_blank'>A5037724110</a>", "F. Abbasi Davani",         "Freydon AbbasiDavani; Fereydoun Abbasi Davani; F. Abbasi‐Davani; Freydoun Abbasi Davani; Fereydoun Abbasi‐Davani; F. Abbasi Davani; F.AbbasiDavani", "Shahid Beheshti University", "Shahid Beheshti University; University of Tehran; Institute for Research in Fundamental Sciences; Islamic Azad University Bandar Abbas; Atomic Energy Organization of Iran; Nuclear Science and Technology Research Institute", "Yes",  11,        14,         104,    414
)

# Convert NAs to "--" for display, keeping hyperlinks intact
authors_tbl <- authors_raw %>%
  mutate(across(c(`H-index`,`i10-index`,`Works`,`Citations`), as.numeric)) %>%
  mutate(across(everything(), ~ifelse(is.na(.), "--", as.character(.))))

kbl(
  authors_tbl,
  caption = "OpenAlex Author IDs for Abbasi Davani Variants",
  escape  = FALSE,
  format  = "html"
) %>%
  kable_styling(full_width = FALSE, bootstrap_options = c("striped","hover","condensed","responsive")) %>%
  row_spec(0, bold = TRUE, color = "#001f4d", background = "#F8F9FA")
OpenAlex Author IDs for Abbasi Davani Variants
Author ID Author Name Alternate Names Institution Past institutions ORCID H-index i10-index Works Citations
A5046683464 Feryidoon Abbasi Davani Feryidoon Abbasi Davani Shahid Beheshti University Shahid Beheshti University 1
A5053153243 Freidoon Abbasi Davani Freidoon Abbasi Davani 1 1 3
A5019064523 Abbasi Davani Fereydoun Abbasi Davani Fereydoun Shahid Beheshti University Shahid Beheshti University 1 2 2
A5103485250 Fereidon Abbasi Davani Fereidon Abbasi Davani Shahid Beheshti University Shahid Beheshti University 2
A5030806477 Abbasi Davani Fereydoon Abbasi Davani Fereydoon 1
A5103401909 Fereydoon Abbasi Davani Fereydoon Abbasi Davani Shahid Beheshti University Shahid Beheshti University 2 13 6
A5103918614 Ferydoon Abbasi Davani Ferydoon Abbasi Davani Shahid Beheshti University Shahid Beheshti University 1
A5024862143 Fereydoon Abbassi Davani Fereydoon Abbassi Davani Shahid Beheshti University Shahid Beheshti University 1 1 2
A5037724110 F. Abbasi Davani Freydon AbbasiDavani; Fereydoun Abbasi Davani; F. Abbasi‐Davani; Freydoun Abbasi Davani; Fereydoun Abbasi‐Davani; F. Abbasi Davani; F.AbbasiDavani Shahid Beheshti University Shahid Beheshti University; University of Tehran; Institute for Research in Fundamental Sciences; Islamic Azad University Bandar Abbas; Atomic Energy Organization of Iran; Nuclear Science and Technology Research Institute Yes 11 14 104 414

With Majid Shahriari, our issue was false positives (including works that were not actually by him). Here, I think we’re dealing with an issue of false negatives: not including all the works that F Abbasi Davani published. For this reason, I have attempted to compile a list of all the possible spellings and combinations of his name as they may be indexed in OpenAlex. But I didn’t spend a bunch of time trying to identify if there are works in the list that he didn’t actually write.

Note that F. Abbasi Davani has a Google scholar page (M Shahriari did not) on which he is associated with 145 papers. This list only yields 125. At some point in the future, we may be interested in tracking down the missing papers and adding them.

library(dplyr)
library(purrr)
library(tidyr)

data_path_iran <- "/standard/nsdpi_storage/people/czj9zj/DiD_data_3topic/Iran"

# Map of file names to author IDs
files_authors <- tibble(
  file = c(
    "works_FAD_5046.rds","works_FAD_5053.rds","works_FAD_5019.rds",
    "works_FAD_5103.rds","works_FAD_5030.rds","works_FAD_510340.rds",
    "works_FAD_51039.rds","works_FAD_5024.rds","works_FAD_5037.rds"
  ),
  author_id = c(
    "A5046683464","A5053153243","A5019064523",
    "A5103485250","A5030806477","A5103401909",
    "A5103918614","A5024862143","A5037724110"
  )
)

# Make data_path explicit in the function signature
read_and_process <- function(file, author_id, data_path) {
  df <- readRDS(file.path(data_path, file)) %>%
    select(id, title, publication_date, publication_year, topics, authorships)

  if (file == "works_FAD_5019.rds") {
    df <- df %>% filter(map_lgl(topics, ~ nrow(.x) > 0))
  }

  df %>%
    mutate(
      topics = map(
        topics,
        ~ select(.x, display_name, score, subfield.display_name, field.display_name, domain.display_name)
      ),
      author_id = author_id
    ) %>%
    unnest(topics)
}

# Pass data_path explicitly via pmap_dfr
abbasi_works_long <- pmap_dfr(
  list(file = files_authors$file,
       author_id = files_authors$author_id,
       data_path = list(data_path_iran)),             # <- stable path
  read_and_process
) %>%
  rename(topic = display_name) %>%
  rename_with(~ gsub("\\.?display_name", "", .x)) %>%
  mutate(across(where(is.character), ~ gsub("https://openalex.org/", "", .x, fixed = TRUE)))

abbasi_works <- abbasi_works_long %>%
  group_by(id) %>%
  mutate(row_num = row_number()) %>%
  ungroup() %>%
  pivot_wider(
    id_cols = c(title, publication_date, publication_year, id, author_id, authorships),
    names_from = row_num,
    values_from = c(topic, score, subfield, field, domain),
    names_glue = "{.value}_{row_num}"
  )

#extra_data_path <- file.path("/standard/nsdpi_storage/people/czj9zj/DiD_data_3topic", "extra_data")

#if (!dir.exists(extra_data_path)) dir.create(extra_data_path, recursive = TRUE)

#saveRDS(abbasi_works, file.path(extra_data_path, "abbasi_works.rds"))
#saveRDS(abbasi_works_long, file.path(extra_data_path, "abbasi_works_long.rds"))

nrow(abbasi_works)
## [1] 125

After consolidating all author profiles, we have a total of 125 works for Freyedoon Abbasi Davani.

Extract Abbasi’s Topics

topic_summary <- readRDS("/standard/nsdpi_storage/people/czj9zj/DiD_data_3topic/extra_data/topic_summary.rds")

# Get unique topics
abbasi_unique_topics <- unique(abbasi_works_long$topic)

# Subset topic_summary where Topic matches
abbasi_keywords_v1 <- topic_summary[topic_summary$Topic %in% abbasi_unique_topics, ]

# Save
#saveRDS(abbasi_keywords_v1, file = file.path(data_path, "abbasi_keywords_v1.rds"))

Ploting

library(dplyr)
library(purrr)

# Build exclusive topic sets
majid_topics  <- unique(majid_works_long$topic)
abbasi_topics <- unique(abbasi_works_long$topic)
abbasi_unique_topics <- setdiff(abbasi_topics, majid_topics)

# Helper: does a work have ANY high-confidence "topic" in the given exclusive set?
has_highconf_exclusive <- function(topic_tbl, exclusive_set, min_score = 0.97) {
  nrow(topic_tbl) > 0 &&
    any(topic_tbl$type == "topic" &
        topic_tbl$score >= min_score &
        topic_tbl$display_name %in% exclusive_set)
}

# Works matching Abbasi's EXCLUSIVE topics (not shared)
sbu_abbasi_unique_works <- works_393 %>%
  filter(map_lgl(topics, ~ has_highconf_exclusive(.x, abbasi_unique_topics, min_score = 0.97)))

# Complement: works NOT matching Abbasi's exclusive topics
sbu_non_abbasi_unique_works <- works_393 %>%
  filter(!map_lgl(topics, ~ has_highconf_exclusive(.x, abbasi_unique_topics, min_score = 0.97)))

Majid and Abbasi Combined Plot

library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ readr 2.1.5     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ readr::col_factor()      masks scales::col_factor()
## ✖ flextable::compose()     masks purrr::compose()
## ✖ scales::discard()        masks purrr::discard()
## ✖ dplyr::filter()          masks stats::filter()
## ✖ jsonlite::flatten()      masks purrr::flatten()
## ✖ kableExtra::group_rows() masks dplyr::group_rows()
## ✖ dplyr::lag()             masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(lubridate)
library(scales)
library(plotly)
## 
## Attaching package: 'plotly'
## 
## The following objects are masked from 'package:flextable':
## 
##     highlight, style
## 
## The following object is masked from 'package:httr':
## 
##     config
## 
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## 
## The following object is masked from 'package:stats':
## 
##     filter
## 
## The following object is masked from 'package:graphics':
## 
##     layout
path <- "/standard/nsdpi_storage/people/czj9zj/DiD_data_3topic"
data_path <- file.path(path, "extra_data")
works_tagged <- readRDS(file.path(path, "works_tagged_topic.rds"))

# 1. Function to prepare timeline data at the topic level, excluding "Both"
prepare_combined_author_timelines <- function(works_tagged) {
  works_tagged %>%
    mutate(
      monthly = floor_date(as.Date(publication_date), "month"),
      topic_category = factor(
        topic_category,
        levels = c("Majid Only", "Abbasi Only", "Neither") # removed "Both"
      )
    ) %>%
    filter(!is.na(topic_category)) %>%       # drop NAs
    filter(topic_category != "Both") %>%     # drop "Both"
    group_by(monthly, topic_category) %>%
    summarise(count = n(), .groups = "drop") %>%
    rename(
      year_month = monthly,
      count_type = topic_category
    ) -> monthly_long
  
  list(monthly_long = monthly_long)
}

# 2. Prepare data
timeline_data <- prepare_combined_author_timelines(works_tagged)

# 3. Load events (excluding Ali-Mohammadi assassination)
major_events_filtered <- readRDS(file.path(data_path, "major_events_filtered.rds")) %>%
  filter(event != "Assassination of Massoud Ali-Mohammadi")

# Add Majid Shahriari’s assassination date
assassination_date <- as.Date("2010-11-29")

# 4. Define sabotage styles
sabotage_styles <- tibble::tibble(
  event = c("Stuxnet Cyberattack", "Natanz Explosion", "Natanz Blackout"),
  color = c("darkorange", "#008", "darkmagenta"),
  linetype = c("dotted", "dotdash", "dashed")
)

# Join sabotage styles to events
sabotage_events <- major_events_filtered %>%
  filter(category == "Sabotage") %>%
  left_join(sabotage_styles, by = "event") %>%
  mutate(event = factor(event, levels = sabotage_styles$event))

# 5. Colors for publication categories (no "Both")
pub_colors <- c(
  "Majid Only" = "#1f78b4",
  "Abbasi Only" = "coral",
  "Neither" = "gray4",
  setNames(sabotage_styles$color, sabotage_styles$event)
)
# --- build per-facet y ranges
yranges <- timeline_data$monthly_long %>%
  group_by(count_type) %>%
  summarise(ymin = 0, ymax = max(count, na.rm = TRUE) * 1.05, .groups = "drop")

# sabotage lines expanded across facets
sabotage_lines <- tidyr::crossing(
  sabotage_events %>% select(event, date, linetype, color),
  yranges
)

# assassination line across facets
assassination_lines <- tidyr::crossing(
  tibble(event = "Assassination", date = assassination_date),
  yranges
) %>%
  mutate(color = "#e31a1c", linetype = "solid")

# --- plot: replace both geom_vline() with geom_segment()
p <- ggplot(timeline_data$monthly_long,
            aes(x = year_month, y = count, color = count_type)) +
  geom_smooth(method = "loess", span = 0.25, se = TRUE, linewidth = 1) +

  # assassination
  geom_segment(
    data = assassination_lines,
    aes(x = date, xend = date, y = ymin, yend = ymax),
    inherit.aes = FALSE, linewidth = 1, color = "#e31a1c", linetype = "solid"
  ) +

  # sabotage (keeps legend)
  geom_segment(
    data = sabotage_lines,
    aes(x = date, xend = date, y = ymin, yend = ymax, color = event, linetype = event),
    inherit.aes = FALSE, linewidth = 1, show.legend = TRUE
  ) +

  facet_wrap(~count_type, scales = "free_y", ncol = 1) +
  labs(
    title = "Publication Output at Shahid Beheshti University",
    subtitle = "Solid red line = Assassination attempt (Nov 29, 2010) • Colored dashed lines = Sabotage Events",
    x = "Publication Date", y = "Monthly Publication Count",
    color = "Publication Trend", linetype = "Sabotage Event"
  ) +
  scale_color_manual(
    values = c(pub_colors),  # your existing vector
    breaks = c("Majid Only", "Abbasi Only", "Neither"),
    guide = guide_legend(order = 1)
  ) +
  scale_linetype_manual(
    values = setNames(sabotage_styles$linetype, sabotage_styles$event),
    guide = guide_legend(order = 2, override.aes = list(color = sabotage_styles$color))
  ) +
  scale_x_date(date_breaks = "2 years", date_labels = "%Y",
               limits = c(as.Date("2000-01-01"), NA)) +
  theme_minimal(base_size = 13) +
  theme(axis.text.x = element_text(angle = 60, hjust = 1),
        legend.position = "bottom", legend.box = "vertical")

# 7. Save & print
#ggsave(file.path(path, "plots/combined_topic_timelines.png"), plot = p, width = 12, height = 8, units = "in")

ggplotly(p)
## `geom_smooth()` using formula = 'y ~ x'
library(tidyverse)
library(lubridate)
library(scales)
library(plotly)

path <- "/standard/nsdpi_storage/people/czj9zj/DiD_data_3topic"
data_path <- file.path(path, "extra_data")
works_tagged <- readRDS(file.path(path, "works_tagged_topic.rds"))

# --- Prepare combined monthly counts (exclude "Both"; drop "Neither" later) ---
prepare_combined_author_timelines <- function(works_tagged) {
  works_tagged %>%
    mutate(
      monthly = floor_date(as.Date(publication_date), "month"),
      topic_category = factor(topic_category, levels = c("Majid Only", "Abbasi Only", "Neither"))
    ) %>%
    filter(!is.na(topic_category), topic_category != "Both") %>%
    group_by(monthly, topic_category) %>%
    summarise(count = n(), .groups = "drop") %>%
    rename(year_month = monthly, count_type = topic_category)
}

timeline_data <- prepare_combined_author_timelines(works_tagged) %>%
  filter(count_type %in% c("Majid Only", "Abbasi Only"))   # keep only these two series

# --- Events ---
major_events_filtered <- readRDS(file.path(data_path, "major_events_filtered.rds")) %>%
  filter(event != "Assassination of Massoud Ali-Mohammadi")
assassination_date <- as.Date("2010-11-29")

# --- Styles for sabotage events (+ JCPOA) -----------------------------------
sabotage_styles <- tibble::tibble(
  event    = c("Stuxnet Cyberattack", "Natanz Explosion", "Natanz Blackout", "JCPOA Agreement"),
  color    = c("darkorange", "#008", "darkmagenta", "tan4"),  # note: "#008" may fail; use "#000088" if needed
  linetype = c("dotted", "dotdash", "dashed", "solid")
)

# Merge styles onto your sabotage_events data and append JCPOA row
# (assumes sabotage_events has a 'date' column)
sabotage_events <- sabotage_events %>%
  dplyr::bind_rows(tibble::tibble(
    event = "JCPOA Agreement",
    date  = as.Date("2015-07-01")
  )) %>%
  dplyr::left_join(sabotage_styles, by = "event")

# --- Colors for the two publication series only ---
pub_colors <- c(
  "Majid Only"  = "#1f78b4",
  "Abbasi Only" = "coral"
)

# --- Dynamic y-limit computed from the two lines only ---
ymax_limit <- max(timeline_data$count, na.rm = TRUE) * 1.05

# --- Build line data to span full height of the plot ---
assassination_line <- tibble(
  date  = assassination_date,
  ymin  = 0,
  ymax  = ymax_limit
)

sabotage_lines_stuxnet <- sabotage_events %>%
  dplyr::filter(event == "Stuxnet Cyberattack") %>%
  dplyr::mutate(ymin = 0, ymax = ymax_limit)

sabotage_lines_explosion <- sabotage_events %>%
  dplyr::filter(event == "Natanz Explosion") %>%
  dplyr::mutate(ymin = 0, ymax = ymax_limit)

sabotage_lines_blackout <- sabotage_events %>%
  dplyr::filter(event == "Natanz Blackout") %>%
  dplyr::mutate(ymin = 0, ymax = ymax_limit)

# NEW: JCPOA full-height segment
sabotage_lines_jcpoa <- sabotage_events %>%
  dplyr::filter(event == "JCPOA Agreement") %>%
  dplyr::mutate(ymin = 0, ymax = ymax_limit)

# --- Plot (single panel; segments so ggplotly shows verticals) ---
p <- ggplot(timeline_data, aes(x = year_month, y = count, color = count_type)) +
  geom_smooth(method = "loess", span = 0.25, se = FALSE, linewidth = 1) +

  # Assassination line (solid red)
  geom_segment(
    data = assassination_line,
    aes(x = date, xend = date, y = ymin, yend = ymax),
    inherit.aes = FALSE, linewidth = 1, color = "#e31a1c", linetype = "solid"
  ) +

  # Sabotage lines ------------------------------------------------------------
  geom_segment(
    data = sabotage_lines_stuxnet,
    aes(x = date, xend = date, y = ymin, yend = ymax, linetype = event),
    inherit.aes = FALSE, linewidth = 1, color = "darkorange", show.legend = TRUE
  ) +
  geom_segment(
    data = sabotage_lines_explosion,
    aes(x = date, xend = date, y = ymin, yend = ymax, linetype = event),
    inherit.aes = FALSE, linewidth = 1, color = "#008", show.legend = TRUE
  ) +
  geom_segment(
    data = sabotage_lines_blackout,
    aes(x = date, xend = date, y = ymin, yend = ymax, linetype = event),
    inherit.aes = FALSE, linewidth = 1, color = "darkmagenta", show.legend = TRUE
  ) +
  # JCPOA line ---------------------------------------------------------------
  geom_segment(
    data = sabotage_lines_jcpoa,
    aes(x = date, xend = date, y = ymin, yend = ymax, linetype = event),
    inherit.aes = FALSE, linewidth = 1, color = "tan4", show.legend = TRUE
  ) +

  labs(
    title = "Publication Output Within F. Abbasi-Davani exclusive & M. Shahriari exclusive Topics at Shahid Beheshti University",
    subtitle = "Solid red = Assassination attempt (Nov 29, 2010) • Colored dashed/solid lines = Events",
    x = "Publication Date",
    y = "Monthly Publication Count",
    color = "Publication Trend",
    linetype = "Sabotage Event"
  ) +
  scale_color_manual(values = pub_colors, breaks = c("Majid Only", "Abbasi Only")) +
  scale_linetype_manual(values = setNames(sabotage_styles$linetype, sabotage_styles$event)) +
  scale_x_date(
    date_breaks = "2 years",
    date_labels = "%Y",
    limits = c(as.Date("2000-01-01"), NA)
  ) +
  coord_cartesian(ylim = c(0, ymax_limit)) +
  theme_minimal(base_size = 13) +
  theme(
    axis.text.x = element_text(angle = 60, hjust = 1),
    legend.position = "bottom",
    legend.box = "vertical"
  )

# --- Interactive (lock y range so Plotly doesn't auto-rescale) ---
ggplotly(p) %>%
  layout(yaxis = list(range = c(0, 30)))
## `geom_smooth()` using formula = 'y ~ x'

Masoud Plot

Hard to find by name. I’ll use published articles to find instead: https://imiranian.com/masoud-alimohammadi/

library(dplyr)
library(kableExtra)

authors_tbl <- tibble::tribble(
  ~`Author ID`,      ~`Author Name`,        ~`Alternate Names`,                                ~Institution,          ~`Past institutions`,                                                                                  ~ORCID, ~`H-index`, ~`i10-index`, ~Works, ~Citations,
  "A5111436477",     "Masoud Alimohammadi", "Masoud Alimohammadi",                              "Ilam University",     "Ilam University; University of Tehran; Institute for Research in Fundamental Sciences; Institute for Cognitive Science Studies", "—",   4,  4,  9,   90,
  "A5059661145",     "M. Alimohammadi",     "M. Alimohammadi; Mehdi Alimohammadi",              "University of Tehran","University of Tehran; ICSS; IPM; IAU North Tehran Branch; IASBS +2 more",                               "Yes", 15, 21, 60, 805
) %>%
  mutate(`Author ID` = paste0(
    "<a href='https://openalex.org/authors/", tolower(`Author ID`), "' target='_blank'>", `Author ID`, "</a>"
  ))

kbl(
  authors_tbl,
  caption = "OpenAlex Author IDs for Masoud Alimohammadi",
  escape  = FALSE,
  format  = "html"
) %>%
  kable_styling(full_width = FALSE, bootstrap_options = c("striped","hover","condensed","responsive")) %>%
  row_spec(0, bold = TRUE, color = "#001f4d", background = "#F8F9FA")
OpenAlex Author IDs for Masoud Alimohammadi
Author ID Author Name Alternate Names Institution Past institutions ORCID H-index i10-index Works Citations
A5111436477 Masoud Alimohammadi Masoud Alimohammadi Ilam University Ilam University; University of Tehran; Institute for Research in Fundamental Sciences; Institute for Cognitive Science Studies 4 4 9 90
A5059661145 M. Alimohammadi M. Alimohammadi; Mehdi Alimohammadi University of Tehran University of Tehran; ICSS; IPM; IAU North Tehran Branch; IASBS +2 more Yes 15 21 60 805

Third candidate profile (ruled out)

We also looked at a third OpenAlex profile as a potential match: Author ID A5043319567. The main institution affiliated is Shiraz University, which is where Masoud earned his B.Sc. in Mathematics. Also, we notice that the top topic of this scholar is Nuclear physics research studies which seemed promesing. However, the earliest publication on this profile is from 2016, i.e., six years after Masoud’s death (2010), so we rule this profile out.

Masoud Possible works

ImIranian.com is a free, user-generated “Who’s Who” platform designed to profile prominent Iranians across disciplines such as technology, politics, sports, arts, and academia. Much like Wikipedia, it is collaborative and open to contributions from anyone with internet access, which makes it a valuable cultural starting point but not a definitive or scholarly database. Its stated mission is to highlight Iranian achievements and provide a positive representation of Iranians worldwide, rather than to serve as a rigorous academic reference. For this reason, while I am using the site’s listing of 53 publications attributed to Masoud Ali-Mohammadi as a curated reference point, I treat it cautiously—as a supplementary dataset to cross-verify against authoritative bibliographic databases like OpenAlex.This dual approach allows me to build dataframes anchored in a public cultural record, while ensuring accuracy through structured, reproducible metadata from OpenAlex. My goal is to at least find these possible 53 works and any other work that the ImIranian.com website could have possible missed.

library(dplyr)
library(knitr)
library(kableExtra)

masoud_53works <- readRDS("/standard/nsdpi_storage/people/czj9zj/extra_data/masoud_53works.rds")

masoud_53works %>%
  distinct(title) %>%
  mutate(ID = row_number()) %>%
  select(ID, title) %>%
  kable(
    caption = "List of 53 Possible Publications of Masoud Alimohammadi",
    escape  = FALSE
  ) %>%
  kable_styling(full_width = FALSE, bootstrap_options = c("striped","hover")) %>%
  kableExtra::add_footnote(
    label = "Source: <a href='https://imiranian.com/masoud-alimohammadi/' target='_blank'>imiranian.com/masoud-alimohammadi</a>.",
    notation = "none",
    escape = FALSE
  ) %>%
  scroll_box(width = "100%", height = "500px")
List of 53 Possible Publications of Masoud Alimohammadi
ID title
1 Level-one SU(N) WZNW models on higher-genus Riemann surfaces, Int. Jour. Mod. Phys. A8 (1993)
2 SU(N)1 correlation functions on higher-genus Riemann surfaces, Int. Jour. Mod. Phys. A8 (1993)
3 Some correlators of SU(3)3 WZW models on higher-genus Riemann surfaces, Mod. Phys. Lett. A9 (1994)
4 SU(N)1 fusion rule and modular transformation matrix by orthogonal polynomials, IL Nuovo Cimento B109 (1994)
5 Gauging SL(2,R) and SL(2,R) X U(1) by their nilpotent subgroups, Int. Jour. Mod. Phys. A10 (1995) 115
6 2-D Gravity as a limit of the SL(2,R) black hole, Mod. Phys. Lett. A10 (1995)
7 Quantum chains with GLq(2) symmetry, Jour. Math. Phys. 37 (1996)
8 Quantum group symmetry of the quantum Hall effect on the non-flat surfaces, Jour. Phys. A29 (1996) 559
9 Laughlin states on the Poincare half-plane and their quantum group symmetry, Jour. Phys. A29 (1996) 5551
10 n-point functions of 2d Yang-Mills theories on Riemann surfaces, Int. Jour. Mod. Phys. A12 (1997) 1959
11 A pseudo-conformal representation of the Virasoro algebra, Mod. Phys. Lett. A12 (1997) 1349
12 Observables of the generalized 2D Yang-Mills theories on arbitrary surfaces: a path integral approach , Mod. Phys. Lett. A12 (1997) 2265
13 Green functions of 2-dimensional Yang-Mills theories on nonorientable surfaces, Z. Phys. C76 (1997) 729
14 Large-N limit of the generalized 2-dimensional Yang-Mills theories, Nucl. Phys. B510 (1998) 313
15 Derivation of quantum theories: symmetries and the exact solution of the derived system, Int. Jour. Mod. Phys. A13 (1998) 2833
16 Exact solution of a one-parameter family of asymmetric exclusion processes, Phys. Rev. E57 (1998)
17 Neutrino oscillation in a space-time with torsion, Mod. Phys. Lett. A14 (1999) 267
18 Uniqueness of the minimum of the free energy of the 2D Yang-Mills theory at large N, Mod. Phys. Lett. A14 (1999)
19 Coulomb gas representation of quantum Hall effect on Riemann surfaces, Jour. Phys. A32 (1999)
20 Phase structure of the generalized two dimensional Yang-Mills theories on sphere, Eur. Phys. Jour. C8 (1999)
21 A two-parametric family of asymmetric exclusion processes and its exact solution, Jour. Stat. Phys. 97 (1999)
22 Generalized simplicial chiral models, Nucl. Phys. B565 (2000)
23 Large-N limit of the generalized 2D Yang-Mills theory on cylinder, Nucl. Phys. B577 (2000)
24 Class of integrable diffusion-reaction processes, Phys. Rev. E62 (2000)
25 Quantum reflection of massless neutrinos from a torsion-induced potential, Int. Jour. Mod. Phys. A15 (2000)
26 Confinement and screening of the Schwinger model on the Poincare half plane, Int. Jour. Mod. Phys. A16 (2001)
27 More on generalized simplicial chiral models, Int. Jour. Mod. Phys. A16 (2001)
28 On the phase structure of two-dimensional generalized Yang-Mills theories, Nucl. Phys. B597 (2001)
29 Massive Schwinger model and its confining aspects on curved space-time, Phys. Rev. D63 (2001)
30 Berry phase for spin-1/2 particles moving in a spacetime with torsion, Eur. Phys. Jour. C21 (2001)
31 Exactly solvable models through the empty interval method, Phys. Rev. E64 (2001)
32 p-species integrable reaction-diffusion processes, Jour. Phys. A35 (2002)
33 Exactly solvable models through the empty interval method, for more-than-two-site interactions, Jour. Phys. A36 (2003)
34 Spin 0 and spin 1/2 quantum relativistic particles in a constant gravitational field, Annals of Physics 304 (2003)
35 Exactly solvable models through the generalized empty interval method, for multi-species interactions, Eur. Phys. Jour. B31 (2003)
36 Spin 0 and spin 1/2 particles in a constant scalar-curvature background, Annals of Physics 310 (2004)
37 Large-N limit of the two-dimensional Yang-Mills theory on surfaces with boundaries, Nucl. Phys. B696 (2004)
38 Solvable multi-species reaction-diffusion processes, including the extended drop-push model, Eur. Phys. Jour. B42 (2004)
39 A statistical mechanical deconvolution of the differential scanning calorimetric profiles of the thermal denaturation of cyanomethemoglobin, The Protein Jour. 24 (2005)
40 Multi-species extension of the solvable partially asymmetric reaction-diffusion processes, Jour. Math. Phys. 46 (2005) 053306
41 Electrostatic self-energy and Bekenstein entropy bound in the massive Schwinger model, Gen. Rel. Grav. 37 (2005)
42 Large-N behavior of the Wilson loops of generalized two-dimensional Yang-Mills theories, Nucl. Phys. B 733 (2006)
43 Solvable reaction-diffusion processes without exclusion, Jour. Math. Phys. 47 (2006)
44 Phase transitions of large-N two-dimensional Yang-Mills and generalized Yang-Mills theories in the double scaling limit, Eur. Phys. Jour. C 47 (2006)
45 Attractor solutions for general hessence dark energy, Phys. Rev. D 73 (2006)
46 Transition from quintessence to phantom phase in quintom model, Phys. Rev. D 74 (2006)
47 Cosmological coincidence problem in interacting dark energy models, Phys. Rev. D 74 (2006)
48 The w = -1 crossing of the quintom model with slowly-varying potentials, Phys. Lett. B 648 (2007)
49 Non-Douglas-Kazakov phase transition of two-dimensional generalized Yang-Mills theories, Eur. Phys. Jour. C 51 (2007)
50 Asymptotic behavior of \(omega\) in general quintom model, Gen. Rel. Grav. 40 (2008)
51 Klein-Gordon and Dirac particles in non-constant scalar-curvature background, Int. Jour. Mod. Phys. A 23 (2008)
52 Quantum induced w = -1 crossing of the quintessence and phantom models, JCAP 0901 (2009)
53 Remarks on generalized Gauss-Bonnet dark energy, Phys. Rev. D 79 (2009)
Source: imiranian.com/masoud-alimohammadi.
#your_email <- "czj9zj@virginia.edu"  # Replace with your email for better API performance

#Fetch all works for Masoud Alimohammadi candidate IDs
#works_5111436477 <- get_author_works("A5111436477", email = your_email)
#works_5059661145 <- get_author_works("A5059661145", email = your_email)  


#saveRDS(works_5111436477, "/standard/nsdpi_storage/people/czj9zj/extra_data/works_5111436477.rds")
#saveRDS(works_5059661145, "/standard/nsdpi_storage/people/czj9zj/extra_data/works_5059661145.rds")


# Read the two possible Masoud Alimohammadi author IDs
works_5111 <- readRDS("/standard/nsdpi_storage/people/czj9zj/extra_data/works_5111436477.rds")  # A5111436477
works_5059 <- readRDS("/standard/nsdpi_storage/people/czj9zj/extra_data/works_5059661145.rds")  # A5059661145


library(dplyr)
library(knitr)
library(kableExtra)
library(dplyr)

all_masoud_works_openalex <- bind_rows(
  works_5111 %>%
    select(id, title, publication_date, publication_year, topics, authorships) %>%
    mutate(author_id = "A5111436477"),
  works_5059 %>%
    select(id, title, publication_date, publication_year, topics, authorships) %>%
    mutate(author_id = "A5059661145")
) %>%
  mutate(across(where(is.character),
                ~ gsub("https://openalex.org/", "", .x, fixed = TRUE)))


all_masoud_works_openalex %>%
  mutate(ID = row_number()) %>%
  select(ID, title) %>%
  kable(
    caption = "List of OpenAlex Works for Masoud Alimohammadi (two candidate author IDs)",
    escape  = FALSE
  ) %>%
  kable_styling(full_width = FALSE, bootstrap_options = c("striped","hover")) %>%
  kableExtra::add_footnote(
    label = paste0(
      "Source: OpenAlex (Author IDs: ",
      "<a href='https://openalex.org/authors/a5111436477' target='_blank'>A5111436477</a> and ",
      "<a href='https://openalex.org/authors/a5059661145' target='_blank'>A5059661145</a>)."
    ),
    notation = "none",
    escape = FALSE
  ) %>%
  scroll_box(width = "100%", height = "500px")
List of OpenAlex Works for Masoud Alimohammadi (two candidate author IDs)
ID title
1 New Activated Carbon from Persian Mesquite Grain as an Excellent Adsorbent
2 Asymptotic behavior of ω in general quintom model
3 Solvable reaction-diffusion processes without exclusion
4 A Statistical Mechanical Deconvolution of the Differential Scanning Calorimetric Profiles of the Thermal Denaturation of Cyanomethemoglobin
5 On the phase structure of two-dimensional generalized Yang–Mills theories
6 Generalized 2D Yang-Mills theories: Large-N limit and Phase Structure
7 Generalized simplicial chiral models
8 Quantum chains with GL<i>q</i>(2) symmetry
9 SOME CORRELATORS OF <font>SU</font>(3)<sub>3</sub> WZW MODELS ON HIGHER-GENUS RIEMANN SURFACES
10 The Association of Job Involvement with Group Counseling Based on Motivational Interviewing
11 A class of solvable reaction–diffusion processes on a Cayley tree
12 Remarks on generalized scalar-tensor models of dark energy
13 Phase space of generalized Gauss-Bonnet dark energy
14 Class of solvable reaction-diffusion processes on Bethe lattice
15 Remarks on generalized Gauss-Bonnet dark energy
16 Quantum induced ω = −1 crossing of the quintessence and phantom models
17 Quantum attractors of generalized Gauss-Bonnet dark energy
18 KLEIN–GORDON AND DIRAC PARTICLES IN NONCONSTANT SCALAR-CURVATURE BACKGROUND
19 Non-Douglas–Kazakov phase transition of two-dimensional generalized Yang–Mills theories
20 The <mml:math xmlns:mml=“http://www.w3.org/1998/Math/MathML” altimg=“si1.gif” overflow=“scroll”><mml:mi>ω</mml:mi><mml:mo>=</mml:mo><mml:mo>−</mml:mo><mml:mn>1</mml:mn></mml:math> crossing of the quintom model with slowly-varying potentials
21 Cosmological coincidence problem in interacting dark energy models
22 Transition from quintessence to the phantom phase in the quintom model
23 The w = -1 crossing of the quintom model with arbitrary potential
24 Phase transitions of large-N two-dimensional Yang–Mills and generalized Yang–Mills theories in the double scaling limit
25 Attractor solutions for general hessence dark energy
26 Large-N behavior of the Wilson loops of generalized two-dimensional Yang–Mills theories
27 Electrostatic self-energy and Bekenstein entropy bound in the massive Schwinger model
28 GENERALIZED INTEGRABLE MULTI-SPECIES REACTION-DIFFUSION PROCESSES
29 Multispecies extension of the solvable partially asymmetric reaction–diffusion processes
30 Solvable multi-species reaction-diffusion processes, including the extended drop-push model
31 Large-N limit of the two-dimensional Yang–Mills theory on surfaces with boundaries
32 Spin-0 and spin-1/2 particles in a constant scalar-curvature background
33 Spin 0 and spin 1/2 quantum relativistic particles in a constant gravitational field
34 Exactly solvable models through the generalized empty interval method, for multi-species interactions
35 Exactly solvable models through the empty interval method, for more-than-two-site interactions
36 <i>p</i>-species integrable reaction–diffusion processes
37 Exactly solvable models through the empty-interval method
38 Berry phase for spin-1/2 particles moving in a space-time with torsion
39 Massive Schwinger model and its confining aspects on curved space-time
40 CONFINEMENT AND SCREENING OF THE SCHWINGER MODEL ON THE POINCARÉ HALF PLANE
41 MORE ON GENERALIZED SIMPLICIAL CHIRAL MODELS
42 QUANTUM REFLECTION OF MASSLESS NEUTRINOS FROM A TORSION-INDUCED POTENTIAL
43 Class of integrable diffusion-reaction processes
44 Large- limit of the generalized 2DYang–Mills theory on cylinder
45 Confinement and screening of the Schwinger model on the Poincare half plane
46 Phase structure of the generalized two-dimensional Yang-Mills theory on sphere
47 UNIQUENESS OF THE MINIMUM OF THE FREE ENERGY OF THE 2-D YANG–MILLS THEORY AT LARGE N
48 NEUTRINO OSCILLATION IN A SPACE–TIME WITH TORSION
49 A two–parametric family of asymmetric exclusion processes and its exact solution
50 Coulomb gas representation of quantum Hall effect on Riemann surfaces
51 DERIVATION OF QUANTUM THEORIES: SYMMETRIES AND THE EXACT SOLUTION OF THE DERIVED SYSTEM
52 Exact solution of a one-parameter family of asymmetric exclusion processes
53 A two–parametric family of asymmetric exclusion processes
54 Large-N limit of the generalized two-dimensional Yang-Mills theories
55 Large-N limit of the generalized two-dimensional Yang-Mills theories
56 Greens functions of 2-dimensional Yang-Mills theories on nonorientable surfaces
57 Observables of the Generalized 2D Yang–Mills Theories on Arbitrary Surfaces: A Path Integral Approach
58 A Pseudo-Conformal Representation of the Virasoro Algebra
59 n-Point Functions of 2d Yang–Mills Theories on Riemann Surfaces
60 Laughlin states on the Poincaré half-plane and their quantum group symmetry
61 Quantum group symmetry of the quantum Hall effect on non-flat surfaces
62 Green functions of 2-dimensional Yang-Mills theories on nonorientable surfaces
63 2-D GRAVITY AS A LIMIT OF THE SL(2, \({\mathbb R}\)) BLACK HOLE
64 GAUGING SL(2, R) AND SL(2, R)×U(1) BY THEIR NILPOTENT SUBGROUPS
65 SU(N) 1 fusion rule and modular transformation matrix by orthogonal polynomials
66 Vertex Operators of SL(2,R) Black Hole and 2-d gravity
67 LEVEL-ONE <font>SU</font>(N) WZNW MODELS ON HIGHER-GENUS RIEMANN SURFACES
68 <font>SU</font>(N)<sub>1</sub> CORRELATION FUNCTIONS ON HIGHER-GENUS RIEMANN SURFACES
69 Nilpotent Gauging of SL(2,R)\(WZNW\) models, and Liouville Field
Source: OpenAlex (Author IDs: A5111436477 and A5059661145).

After creating the complete list of 69 works from openalex, we notice that the paper titled “Large-N limit of the generalized two-dimensional Yang-Mills theories” appears under two distict work_id: https://openalex.org/works/W2085132458 and https://openalex.org/works/W2950405282 under the same author id: a5059661145. Thus, in total, there are 68 works associated with Masoud Alimohammadi from OpenAlex.

map_5111 <- tribble(
  ~work_number, ~author_id,    ~title_matched,
   3,           "5111436477",  "SOME CORRELATORS OF <font>SU</font>(3)<sub>3</sub> WZW MODELS ON HIGHER-GENUS RIEMANN SURFACES",
   7,           "5111436477",  "Quantum chains with GL<i>q</i>(2) symmetry",
  22,           "5111436477",  "Generalized simplicial chiral models",
  28,           "5111436477",  "On the phase structure of two-dimensional generalized Yang–Mills theories",
  39,           "5111436477",  "A Statistical Mechanical Deconvolution of the Differential Scanning Calorimetric Profiles of the Thermal Denaturation of Cyanomethemoglobin",
  43,           "5111436477",  "Solvable reaction-diffusion processes without exclusion",
  50,           "5111436477",  "Asymptotic behavior of ω in general quintom model"
)
library(dplyr)
library(tibble)

# Map canonical row numbers (1..53) to their exact works_5059 titles:
map_5059 <- tribble(
  ~work_number, ~author_id, ~title_matched,
   1, "5059661145", "LEVEL-ONE <font>SU</font>(N) WZNW MODELS ON HIGHER-GENUS RIEMANN SURFACES",
   2, "5059661145", "<font>SU</font>(N)<sub>1</sub> CORRELATION FUNCTIONS ON HIGHER-GENUS RIEMANN SURFACES",
   4, "5059661145", "SU(N) 1 fusion rule and modular transformation matrix by orthogonal polynomials",
   5, "5059661145", "GAUGING SL(2, R) AND SL(2, R)×U(1) BY THEIR NILPOTENT SUBGROUPS",
   6, "5059661145", "2-D GRAVITY AS A LIMIT OF THE SL(2, ${\\mathbb R}$) BLACK HOLE",
   8, "5059661145", "Quantum group symmetry of the quantum Hall effect on non-flat surfaces",
   9, "5059661145", "Laughlin states on the Poincaré half-plane and their quantum group symmetry",
  10, "5059661145", "n-Point Functions of 2d Yang–Mills Theories on Riemann Surfaces",
  11, "5059661145", "A Pseudo-Conformal Representation of the Virasoro Algebra",
  12, "5059661145", "Observables of the Generalized 2D Yang–Mills Theories on Arbitrary Surfaces: A Path Integral Approach",
  13, "5059661145", "Green functions of 2-dimensional Yang-Mills theories on nonorientable surfaces",
  14, "5059661145", "Large-N limit of the generalized two-dimensional Yang-Mills theories",
  15, "5059661145", "DERIVATION OF QUANTUM THEORIES: SYMMETRIES AND THE EXACT SOLUTION OF THE DERIVED SYSTEM",
  16, "5059661145", "Exact solution of a one-parameter family of asymmetric exclusion processes",
  17, "5059661145", "NEUTRINO OSCILLATION IN A SPACE–TIME WITH TORSION",
  18, "5059661145", "UNIQUENESS OF THE MINIMUM OF THE FREE ENERGY OF THE 2-D YANG–MILLS THEORY AT LARGE N",
  19, "5059661145", "Coulomb gas representation of quantum Hall effect on Riemann surfaces",
  20, "5059661145", "Phase structure of the generalized two-dimensional Yang-Mills theory on sphere",
  21, "5059661145", "A two--parametric family of asymmetric exclusion processes and its exact solution",
  23, "5059661145", "Large- limit of the generalized 2DYang–Mills theory on cylinder",
  24, "5059661145", "Class of integrable diffusion-reaction processes",
  25, "5059661145", "QUANTUM REFLECTION OF MASSLESS NEUTRINOS FROM A TORSION-INDUCED POTENTIAL",
  26, "5059661145", "Confinement and screening of the Schwinger model on the Poincare half plane",
  27, "5059661145", "MORE ON GENERALIZED SIMPLICIAL CHIRAL MODELS",
  29, "5059661145", "Massive Schwinger model and its confining aspects on curved space-time",
  30, "5059661145", "Berry phase for spin-1/2 particles moving in a space-time with torsion",
  31, "5059661145", "Exactly solvable models through the empty-interval method",
  32, "5059661145", "<i>p</i>-species integrable reaction–diffusion processes",
  33, "5059661145", "Exactly solvable models through the empty interval method, for more-than-two-site interactions",
  34, "5059661145", "Spin 0 and spin 1/2 quantum relativistic particles in a constant gravitational field",
  35, "5059661145", "Exactly solvable models through the generalized empty interval method, for multi-species interactions",
  36, "5059661145", "Spin-0 and spin-1/2 particles in a constant scalar-curvature background",
  37, "5059661145", "Large-N limit of the two-dimensional Yang–Mills theory on surfaces with boundaries",
  38, "5059661145", "Solvable multi-species reaction-diffusion processes, including the extended drop-push model",
  40, "5059661145", "Multispecies extension of the solvable partially asymmetric reaction–diffusion processes",
  41, "5059661145", "Electrostatic self-energy and Bekenstein entropy bound in the massive Schwinger model",
  42, "5059661145", "Large-N behavior of the Wilson loops of generalized two-dimensional Yang–Mills theories",
  44, "5059661145", "Phase transitions of large-N two-dimensional Yang–Mills and generalized Yang–Mills theories in the double scaling limit",
  45, "5059661145", "Attractor solutions for general hessence dark energy",
  46, "5059661145", "Transition from quintessence to the phantom phase in the quintom model",
  47, "5059661145", "Cosmological coincidence problem in interacting dark energy models",
  48, "5059661145", "The <mml:math xmlns:mml=\"http://www.w3.org/1998/Math/MathML\" altimg=\"si1.gif\" overflow=\"scroll\"><mml:mi>ω</mml:mi><mml:mo>=</mml:mo><mml:mo>−</mml:mo><mml:mn>1</mml:mn></mml:math> crossing of the quintom model with slowly-varying potentials",
  49, "5059661145", "Non-Douglas–Kazakov phase transition of two-dimensional generalized Yang–Mills theories",
  51, "5059661145", "KLEIN–GORDON AND DIRAC PARTICLES IN NONCONSTANT SCALAR-CURVATURE BACKGROUND",
  52, "5059661145", "Quantum induced ω = −1 crossing of the quintessence and phantom models",
  53, "5059661145", "Remarks on generalized Gauss-Bonnet dark energy"
)
library(dplyr)

# --- Build one lookup from BOTH works tables (title -> metadata) --------------
lookup_all <- bind_rows(
  works_5111 %>%
    transmute(
      title_key        = title,                     # exact string used in maps
      id               = id,
      publication_date = as.character(publication_date),
      publication_year = suppressWarnings(as.integer(substr(as.character(publication_date), 1, 4))),
      topics           = topics,
      authorships      = authorships              # <— keep authorships
    ),
  works_5059 %>%
    transmute(
      title_key        = title,
      id               = id,
      publication_date = as.character(publication_date),
      publication_year = suppressWarnings(as.integer(substr(as.character(publication_date), 1, 4))),
      topics           = topics,
      authorships      = authorships              # <— keep authorships
    )
)

# --- 1) Combine maps & collapse per work_number (no pub fields here) ----------
combined_map <- bind_rows(
  map_5111 %>% mutate(source = "a1"),
  map_5059 %>% mutate(source = "a2")
) %>%
  group_by(work_number) %>%
  summarise(
    author_id = {
      ids <- unique(na.omit(author_id))
      if (length(ids) > 1) "both" else if (length(ids) == 1) ids else NA_character_
    },
    title_key      = dplyr::first(na.omit(title_matched), default = NA_character_),
    title_matched  = paste(unique(na.omit(title_matched)), collapse = " | "),
    .groups = "drop"
  )

# --- 2) Join the metadata AFTER summarise -------------------------------------
combined_map <- combined_map %>%
  left_join(lookup_all, by = "title_key") %>%
  select(-title_key)

# --- 3) Join onto the canonical 53 & finalize columns -------------------------
masoud_53works <- masoud_53works %>%
  mutate(work_number = row_number()) %>%
  # drop only columns we are re-creating (add authorships here in case it already existed)
  select(-any_of(c("id","publication_date","publication_year","topics","authorships","author_id","author_number"))) %>%
  left_join(combined_map, by = "work_number") %>%
  mutate(
    author_id = factor(author_id, levels = c("5111436477","5059661145","both"))
  ) %>%
  # *** keep authorships in the final output ***
  select(id, title, title_matched, publication_date, publication_year, topics, authorships, author_id) %>%
  mutate(across(where(is.character),
                ~ gsub("https://openalex.org/", "", .x, fixed = TRUE)))


masoud_53works %>%
  mutate(ID = row_number()) %>%
  select(
    ID,
    `Title` = title,
    `Matched OpenAlex title` = title_matched,
    `Author ID` = author_id
  ) %>%
  kable(
    caption = "List of 53 Possible Publications of Masoud Alimohammadi (with OpenAlex matches)",
    escape  = FALSE
  ) %>%
  kable_styling(full_width = FALSE, bootstrap_options = c("striped","hover")) %>%
  kableExtra::add_footnote(
    label = paste0(
      "Source: OpenAlex (Author IDs: ",
      "<a href='https://openalex.org/authors/a5111436477' target='_blank'>A5111436477</a> and ",
      "<a href='https://openalex.org/authors/a5059661145' target='_blank'>A5059661145</a>)."
    ),
    notation = "none",
    escape = FALSE
  ) %>%
  scroll_box(width = "100%", height = "500px")
List of 53 Possible Publications of Masoud Alimohammadi (with OpenAlex matches)
ID Title Matched OpenAlex title Author ID
1 Level-one SU(N) WZNW models on higher-genus Riemann surfaces, Int. Jour. Mod. Phys. A8 (1993) LEVEL-ONE <font>SU</font>(N) WZNW MODELS ON HIGHER-GENUS RIEMANN SURFACES 5059661145
2 SU(N)1 correlation functions on higher-genus Riemann surfaces, Int. Jour. Mod. Phys. A8 (1993) <font>SU</font>(N)<sub>1</sub> CORRELATION FUNCTIONS ON HIGHER-GENUS RIEMANN SURFACES 5059661145
3 Some correlators of SU(3)3 WZW models on higher-genus Riemann surfaces, Mod. Phys. Lett. A9 (1994) SOME CORRELATORS OF <font>SU</font>(3)<sub>3</sub> WZW MODELS ON HIGHER-GENUS RIEMANN SURFACES 5111436477
4 SU(N)1 fusion rule and modular transformation matrix by orthogonal polynomials, IL Nuovo Cimento B109 (1994) SU(N) 1 fusion rule and modular transformation matrix by orthogonal polynomials 5059661145
5 Gauging SL(2,R) and SL(2,R) X U(1) by their nilpotent subgroups, Int. Jour. Mod. Phys. A10 (1995) 115 GAUGING SL(2, R) AND SL(2, R)×U(1) BY THEIR NILPOTENT SUBGROUPS 5059661145
6 2-D Gravity as a limit of the SL(2,R) black hole, Mod. Phys. Lett. A10 (1995) 2-D GRAVITY AS A LIMIT OF THE SL(2, \({\mathbb R}\)) BLACK HOLE 5059661145
7 Quantum chains with GLq(2) symmetry, Jour. Math. Phys. 37 (1996) Quantum chains with GL<i>q</i>(2) symmetry 5111436477
8 Quantum group symmetry of the quantum Hall effect on the non-flat surfaces, Jour. Phys. A29 (1996) 559 Quantum group symmetry of the quantum Hall effect on non-flat surfaces 5059661145
9 Laughlin states on the Poincare half-plane and their quantum group symmetry, Jour. Phys. A29 (1996) 5551 Laughlin states on the Poincaré half-plane and their quantum group symmetry 5059661145
10 n-point functions of 2d Yang-Mills theories on Riemann surfaces, Int. Jour. Mod. Phys. A12 (1997) 1959 n-Point Functions of 2d Yang–Mills Theories on Riemann Surfaces 5059661145
11 A pseudo-conformal representation of the Virasoro algebra, Mod. Phys. Lett. A12 (1997) 1349 A Pseudo-Conformal Representation of the Virasoro Algebra 5059661145
12 Observables of the generalized 2D Yang-Mills theories on arbitrary surfaces: a path integral approach , Mod. Phys. Lett. A12 (1997) 2265 Observables of the Generalized 2D Yang–Mills Theories on Arbitrary Surfaces: A Path Integral Approach 5059661145
13 Green functions of 2-dimensional Yang-Mills theories on nonorientable surfaces, Z. Phys. C76 (1997) 729 Green functions of 2-dimensional Yang-Mills theories on nonorientable surfaces 5059661145
14 Large-N limit of the generalized 2-dimensional Yang-Mills theories, Nucl. Phys. B510 (1998) 313 Large-N limit of the generalized two-dimensional Yang-Mills theories 5059661145
15 Large-N limit of the generalized 2-dimensional Yang-Mills theories, Nucl. Phys. B510 (1998) 313 Large-N limit of the generalized two-dimensional Yang-Mills theories 5059661145
16 Derivation of quantum theories: symmetries and the exact solution of the derived system, Int. Jour. Mod. Phys. A13 (1998) 2833 DERIVATION OF QUANTUM THEORIES: SYMMETRIES AND THE EXACT SOLUTION OF THE DERIVED SYSTEM 5059661145
17 Exact solution of a one-parameter family of asymmetric exclusion processes, Phys. Rev. E57 (1998) Exact solution of a one-parameter family of asymmetric exclusion processes 5059661145
18 Neutrino oscillation in a space-time with torsion, Mod. Phys. Lett. A14 (1999) 267 NEUTRINO OSCILLATION IN A SPACE–TIME WITH TORSION 5059661145
19 Uniqueness of the minimum of the free energy of the 2D Yang-Mills theory at large N, Mod. Phys. Lett. A14 (1999) UNIQUENESS OF THE MINIMUM OF THE FREE ENERGY OF THE 2-D YANG–MILLS THEORY AT LARGE N 5059661145
20 Coulomb gas representation of quantum Hall effect on Riemann surfaces, Jour. Phys. A32 (1999) Coulomb gas representation of quantum Hall effect on Riemann surfaces 5059661145
21 Phase structure of the generalized two dimensional Yang-Mills theories on sphere, Eur. Phys. Jour. C8 (1999) Phase structure of the generalized two-dimensional Yang-Mills theory on sphere 5059661145
22 A two-parametric family of asymmetric exclusion processes and its exact solution, Jour. Stat. Phys. 97 (1999) A two–parametric family of asymmetric exclusion processes and its exact solution 5059661145
23 Generalized simplicial chiral models, Nucl. Phys. B565 (2000) Generalized simplicial chiral models 5111436477
24 Large-N limit of the generalized 2D Yang-Mills theory on cylinder, Nucl. Phys. B577 (2000) Large- limit of the generalized 2DYang–Mills theory on cylinder 5059661145
25 Class of integrable diffusion-reaction processes, Phys. Rev. E62 (2000) Class of integrable diffusion-reaction processes 5059661145
26 Quantum reflection of massless neutrinos from a torsion-induced potential, Int. Jour. Mod. Phys. A15 (2000) QUANTUM REFLECTION OF MASSLESS NEUTRINOS FROM A TORSION-INDUCED POTENTIAL 5059661145
27 Confinement and screening of the Schwinger model on the Poincare half plane, Int. Jour. Mod. Phys. A16 (2001) Confinement and screening of the Schwinger model on the Poincare half plane 5059661145
28 More on generalized simplicial chiral models, Int. Jour. Mod. Phys. A16 (2001) MORE ON GENERALIZED SIMPLICIAL CHIRAL MODELS 5059661145
29 On the phase structure of two-dimensional generalized Yang-Mills theories, Nucl. Phys. B597 (2001) On the phase structure of two-dimensional generalized Yang–Mills theories 5111436477
30 Massive Schwinger model and its confining aspects on curved space-time, Phys. Rev. D63 (2001) Massive Schwinger model and its confining aspects on curved space-time 5059661145
31 Berry phase for spin-1/2 particles moving in a spacetime with torsion, Eur. Phys. Jour. C21 (2001) Berry phase for spin-1/2 particles moving in a space-time with torsion 5059661145
32 Exactly solvable models through the empty interval method, Phys. Rev. E64 (2001) Exactly solvable models through the empty-interval method 5059661145
33 p-species integrable reaction-diffusion processes, Jour. Phys. A35 (2002) <i>p</i>-species integrable reaction–diffusion processes 5059661145
34 Exactly solvable models through the empty interval method, for more-than-two-site interactions, Jour. Phys. A36 (2003) Exactly solvable models through the empty interval method, for more-than-two-site interactions 5059661145
35 Spin 0 and spin 1/2 quantum relativistic particles in a constant gravitational field, Annals of Physics 304 (2003) Spin 0 and spin 1/2 quantum relativistic particles in a constant gravitational field 5059661145
36 Exactly solvable models through the generalized empty interval method, for multi-species interactions, Eur. Phys. Jour. B31 (2003) Exactly solvable models through the generalized empty interval method, for multi-species interactions 5059661145
37 Spin 0 and spin 1/2 particles in a constant scalar-curvature background, Annals of Physics 310 (2004) Spin-0 and spin-1/2 particles in a constant scalar-curvature background 5059661145
38 Large-N limit of the two-dimensional Yang-Mills theory on surfaces with boundaries, Nucl. Phys. B696 (2004) Large-N limit of the two-dimensional Yang–Mills theory on surfaces with boundaries 5059661145
39 Solvable multi-species reaction-diffusion processes, including the extended drop-push model, Eur. Phys. Jour. B42 (2004) Solvable multi-species reaction-diffusion processes, including the extended drop-push model 5059661145
40 A statistical mechanical deconvolution of the differential scanning calorimetric profiles of the thermal denaturation of cyanomethemoglobin, The Protein Jour. 24 (2005) A Statistical Mechanical Deconvolution of the Differential Scanning Calorimetric Profiles of the Thermal Denaturation of Cyanomethemoglobin 5111436477
41 Multi-species extension of the solvable partially asymmetric reaction-diffusion processes, Jour. Math. Phys. 46 (2005) 053306 Multispecies extension of the solvable partially asymmetric reaction–diffusion processes 5059661145
42 Electrostatic self-energy and Bekenstein entropy bound in the massive Schwinger model, Gen. Rel. Grav. 37 (2005) Electrostatic self-energy and Bekenstein entropy bound in the massive Schwinger model 5059661145
43 Large-N behavior of the Wilson loops of generalized two-dimensional Yang-Mills theories, Nucl. Phys. B 733 (2006) Large-N behavior of the Wilson loops of generalized two-dimensional Yang–Mills theories 5059661145
44 Solvable reaction-diffusion processes without exclusion, Jour. Math. Phys. 47 (2006) Solvable reaction-diffusion processes without exclusion 5111436477
45 Phase transitions of large-N two-dimensional Yang-Mills and generalized Yang-Mills theories in the double scaling limit, Eur. Phys. Jour. C 47 (2006) Phase transitions of large-N two-dimensional Yang–Mills and generalized Yang–Mills theories in the double scaling limit 5059661145
46 Attractor solutions for general hessence dark energy, Phys. Rev. D 73 (2006) Attractor solutions for general hessence dark energy 5059661145
47 Transition from quintessence to phantom phase in quintom model, Phys. Rev. D 74 (2006) Transition from quintessence to the phantom phase in the quintom model 5059661145
48 Cosmological coincidence problem in interacting dark energy models, Phys. Rev. D 74 (2006) Cosmological coincidence problem in interacting dark energy models 5059661145
49 The w = -1 crossing of the quintom model with slowly-varying potentials, Phys. Lett. B 648 (2007) The <mml:math xmlns:mml=“http://www.w3.org/1998/Math/MathML” altimg=“si1.gif” overflow=“scroll”><mml:mi>ω</mml:mi><mml:mo>=</mml:mo><mml:mo>−</mml:mo><mml:mn>1</mml:mn></mml:math> crossing of the quintom model with slowly-varying potentials 5059661145
50 Non-Douglas-Kazakov phase transition of two-dimensional generalized Yang-Mills theories, Eur. Phys. Jour. C 51 (2007) Non-Douglas–Kazakov phase transition of two-dimensional generalized Yang–Mills theories 5059661145
51 Asymptotic behavior of \(omega\) in general quintom model, Gen. Rel. Grav. 40 (2008) Asymptotic behavior of ω in general quintom model 5111436477
52 Klein-Gordon and Dirac particles in non-constant scalar-curvature background, Int. Jour. Mod. Phys. A 23 (2008) KLEIN–GORDON AND DIRAC PARTICLES IN NONCONSTANT SCALAR-CURVATURE BACKGROUND 5059661145
53 Quantum induced w = -1 crossing of the quintessence and phantom models, JCAP 0901 (2009) Quantum induced ω = −1 crossing of the quintessence and phantom models 5059661145
54 Remarks on generalized Gauss-Bonnet dark energy, Phys. Rev. D 79 (2009) Remarks on generalized Gauss-Bonnet dark energy 5059661145
Source: OpenAlex (Author IDs: A5111436477 and A5059661145).

Now that we have collected the 53 works, this raises the following question: What are those other 2 papers from works_5111 and works_5059 that are not part of the list given by https://imiranian.com/masoud-alimohammadi/? Are these actually his works and the list is missing works or are these have mistakenly associated to Masoud Alimohammadi by OpenAlex? To answer that question, we look at the papers who’s titles do not appear in the 53 works list listed by https://imiranian.com/masoud-alimohammadi/.

# rows in all_masoud_works_openalex$title that are NOT in masoud_53works$title_matched
not_masoud_53works <- all_masoud_works_openalex %>%
  distinct(title, .keep_all = TRUE) %>%
  anti_join(
    masoud_53works %>%
      filter(!is.na(title_matched)) %>%
      distinct(title_matched) %>%
      rename(title = title_matched),   # <-- make the join key names match
    by = "title"
  )

# (optional) pretty table
library(knitr)
library(kableExtra)
not_masoud_53works %>%
  mutate(ID = row_number()) %>%
  select(ID, title, publication_date, publication_year, author_id, authorships) %>%
  kable(caption = "List of the 15 OpenAlex works not the List of 53 Possible Publications of Masoud Alimohammadi") %>%
  kable_styling(full_width = FALSE, bootstrap_options = c("striped", "hover")) %>%
  kableExtra::add_footnote(
    label = "Source: OpenAlex author IDs: <a href='https://openalex.org/authors/A5111436477' target='_blank'>A5111436477</a>, <a href='https://openalex.org/authors/A5059661145' target='_blank'>A5059661145</a>.",
    notation = "none", escape = FALSE
  ) %>%
  scroll_box(width = "100%", height = "500px")
List of the 15 OpenAlex works not the List of 53 Possible Publications of Masoud Alimohammadi
ID title publication_date publication_year author_id authorships
1 New Activated Carbon from Persian Mesquite Grain as an Excellent Adsorbent 2017-03-01 2017 A5111436477 first , middle , last , https://openalex.org/I4210116604 , Ilam University , https://ror.org/01r277z15 , IR , funder , https://openalex.org/I4210116604 , https://openalex.org/I4210116604 , Ilam University , https://ror.org/01r277z15 , IR , funder , https://openalex.org/I4210116604 , https://openalex.org/I4210116604 , Ilam University , https://ror.org/01r277z15 , IR , funder , https://openalex.org/I4210116604 , IR , IR , IR , FALSE , FALSE , FALSE , Ensieh Ghasemian Lemraski , Soheila Sharafinia , Masoud Alimohammadi , ilam university , ilam university , ilam university , ilam university , https://openalex.org/I4210116604 , ilam university , https://openalex.org/I4210116604 , ilam university , https://openalex.org/I4210116604 , https://openalex.org/A5006459975 , https://openalex.org/A5090198902 , https://openalex.org/A5111436477 , Ensieh Ghasemian Lemraski , Soheila Sharafinia , Masoud Alimohammadi , https://orcid.org/0000-0002-9597-0602, NA , NA
2 Generalized 2D Yang-Mills theories: Large-N limit and Phase Structure 2000-10-11 2000 A5111436477 first , https://openalex.org/I4210146419 , Institute for Research in Fundamental Sciences, https://ror.org/04xreqs31 , IR , funder , https://openalex.org/I4210146419 , IR , TRUE , Masoud Alimohammadi , Institute for Research in Fundamental Sciences, Institute for Research in Fundamental Sciences, https://openalex.org/I4210146419 , https://openalex.org/A5111436477 , Masoud Alimohammadi , NA
3 The Association of Job Involvement with Group Counseling Based on Motivational Interviewing 2024-01-04 2024 A5059661145 first , middle , middle , last , FALSE , FALSE , FALSE , FALSE , mehdi alimohammadi , Kianoosh Zahrakar, Professor , Farshad Mohsenzadeh, Assistant Professor., AbdolRahim Kasaei. Assistant Professor. , https://openalex.org/A5059661145 , https://openalex.org/A5093649064 , https://openalex.org/A5093649065 , https://openalex.org/A5093649066 , M. Alimohammadi , Professor Kianoosh Zahrakar , Assistant Professor. Farshad Mohsenzadeh , AbdolRahim Kasaei. Assistant Professor. , https://orcid.org/0000-0003-0499-1350 , NA , NA , NA
4 A class of solvable reaction–diffusion processes on a Cayley tree 2010-01-03 2010 A5059661145 first , last , https://openalex.org/I23946033 , University of Tehran , https://ror.org/05vf56z40 , IR , funder , https://openalex.org/I23946033 , https://openalex.org/I23946033 , University of Tehran , https://ror.org/05vf56z40 , IR , funder , https://openalex.org/I23946033 , IR , IR , FALSE , FALSE , M. Alimohammadi , N. Olanj , Department of Physics, University of Tehran, North Karegar Avenue, Tehran, Iran, Department of Physics, University of Tehran, North Karegar Avenue, Tehran, Iran, Department of Physics, University of Tehran, North Karegar Avenue, Tehran, Iran, https://openalex.org/I23946033 , Department of Physics, University of Tehran, North Karegar Avenue, Tehran, Iran, https://openalex.org/I23946033 , https://openalex.org/A5059661145 , https://openalex.org/A5040976951 , M. Alimohammadi , N. Olanj , https://orcid.org/0000-0003-0499-1350 , https://orcid.org/0000-0003-3810-3665
5 Remarks on generalized scalar-tensor models of dark energy 2009-09-25 2009 A5059661145 first , last , https://openalex.org/I23946033 , University of Tehran , https://ror.org/05vf56z40 , IR , funder , https://openalex.org/I23946033 , https://openalex.org/I23946033 , University of Tehran , https://ror.org/05vf56z40 , IR , funder , https://openalex.org/I23946033 , IR , IR , FALSE , FALSE , M. Alimohammadi , H. Behnamian , Department of Physics, University of Tehran, North Karegar Avenue, Tehran, Iran, Department of Physics, University of Tehran, North Karegar Avenue, Tehran, Iran, Department of Physics, University of Tehran, North Karegar Avenue, Tehran, Iran, https://openalex.org/I23946033 , Department of Physics, University of Tehran, North Karegar Avenue, Tehran, Iran, https://openalex.org/I23946033 , https://openalex.org/A5059661145 , https://openalex.org/A5002831367 , M. Alimohammadi , Hadi Behnamian , https://orcid.org/0000-0003-0499-1350 , https://orcid.org/0000-0001-9071-424X
6 Phase space of generalized Gauss-Bonnet dark energy 2009-08-25 2009 A5059661145 first , last , https://openalex.org/I23946033 , University of Tehran , https://ror.org/05vf56z40 , IR , funder , https://openalex.org/I23946033 , https://openalex.org/I23946033 , University of Tehran , https://ror.org/05vf56z40 , IR , funder , https://openalex.org/I23946033 , IR , IR , FALSE , FALSE , M. Alimohammadi , A. Ghalee , Department of Physics, University of Tehran, North Karegar Avenue, Tehran, Iran, Department of Physics, University of Tehran, North Karegar Avenue, Tehran, Iran, Department of Physics, University of Tehran, North Karegar Avenue, Tehran, Iran, https://openalex.org/I23946033 , Department of Physics, University of Tehran, North Karegar Avenue, Tehran, Iran, https://openalex.org/I23946033 , https://openalex.org/A5059661145 , https://openalex.org/A5042178726 , M. Alimohammadi , Amir Ghalee , https://orcid.org/0000-0003-0499-1350 , NA
7 Class of solvable reaction-diffusion processes on Bethe lattice 2009-04-06 2009 A5059661145 first , last , FALSE , FALSE , M. Alimohammadi , N. Olanj , https://openalex.org/A5059661145 , https://openalex.org/A5040976951 , M. Alimohammadi , N. Olanj , https://orcid.org/0000-0003-0499-1350, https://orcid.org/0000-0003-3810-3665
8 Quantum attractors of generalized Gauss-Bonnet dark energy 2009-01-01 2009 A5059661145 first , last , FALSE , FALSE , M Alimohammadi , N Agharafiei , https://openalex.org/A5059661145 , https://openalex.org/A5050685254 , M. Alimohammadi , N Agharafiei , https://orcid.org/0000-0003-0499-1350, NA
9 The w = -1 crossing of the quintom model with arbitrary potential 2006-08-03 2006 A5059661145 first , last , FALSE , FALSE , M. Alimohammadi , H. Mohseni Sadjadi , https://openalex.org/A5059661145 , https://openalex.org/A5081482597 , M. Alimohammadi , H. Mohseni Sadjadi , https://orcid.org/0000-0003-0499-1350, https://orcid.org/0000-0002-3251-4132
10 GENERALIZED INTEGRABLE MULTI-SPECIES REACTION-DIFFUSION PROCESSES 2005-05-01 2005 A5059661145 first , https://openalex.org/I23946033 , University of Tehran , https://ror.org/05vf56z40 , IR , funder , https://openalex.org/I23946033 , IR , TRUE , M. ALIMOHAMMADI , Physics Department, University of Tehran, North Karegar Ave., 14395 Tehran, Iran, Physics Department, University of Tehran, North Karegar Ave., 14395 Tehran, Iran, https://openalex.org/I23946033 , https://openalex.org/A5059661145 , M. Alimohammadi , https://orcid.org/0000-0003-0499-1350
11 CONFINEMENT AND SCREENING OF THE SCHWINGER MODEL ON THE POINCARÉ HALF PLANE 2001-04-10 2001 A5059661145 first , last , https://openalex.org/I23946033 , University of Tehran , https://ror.org/05vf56z40 , IR , funder , https://openalex.org/I23946033 , https://openalex.org/I23946033 , https://openalex.org/I3145578848 , https://openalex.org/I4210146419 , University of Tehran , Institute for Cognitive Science Studies , Institute for Research in Fundamental Sciences , https://ror.org/05vf56z40 , https://ror.org/0378cd528 , https://ror.org/04xreqs31 , IR , IR , IR , funder , facility , funder , https://openalex.org/I23946033 , https://openalex.org/I3145578848 , https://openalex.org/I4210146419 , IR , IR , FALSE , FALSE , H. MOHSENI SADJADI , M. ALIMOHAMMADI , Physics Department, University of Tehran, North Karegar, Tehran, Iran , Institute for Studies in Theoretical Physics and Mathematics, PO Box 5531, Tehran 19395, Iran, Physics Department, University of Tehran, North Karegar, Tehran, Iran , Physics Department, University of Tehran, North Karegar, Tehran, Iran , https://openalex.org/I23946033 , Physics Department, University of Tehran, North Karegar, Tehran, Iran , Institute for Studies in Theoretical Physics and Mathematics, PO Box 5531, Tehran 19395, Iran, https://openalex.org/I23946033 , https://openalex.org/I3145578848 , https://openalex.org/I4210146419 , https://openalex.org/A5081482597 , https://openalex.org/A5059661145 , H. Mohseni Sadjadi , M. Alimohammadi , https://orcid.org/0000-0002-3251-4132 , https://orcid.org/0000-0003-0499-1350
12 A two–parametric family of asymmetric exclusion processes 1998-05-13 1998 A5059661145 first , middle , last , FALSE , FALSE , FALSE , M. Alimohammadi , V. Karimipour , M. Khorrami , https://openalex.org/A5059661145 , https://openalex.org/A5056183265 , https://openalex.org/A5013031184 , M. Alimohammadi , Vahid Karimipour , Mohammad Khorrami , https://orcid.org/0000-0003-0499-1350, https://orcid.org/0000-0001-5496-4647, https://orcid.org/0000-0002-2524-5237
13 Greens functions of 2-dimensional Yang-Mills theories on nonorientable surfaces 1997-12-01 1997 A5059661145 first , last , IR , IR , FALSE , FALSE , M. Alimohammadi , M. Khorrami , Physics Department, University of Teheran, North Karegar, Tehran, Iran, Physics Department, University of Teheran, North Karegar, Tehran, Iran, Physics Department, University of Teheran, North Karegar, Tehran, Iran, Physics Department, University of Teheran, North Karegar, Tehran, Iran, https://openalex.org/A5059661145 , https://openalex.org/A5013031184 , M. Alimohammadi , Mohammad Khorrami , https://orcid.org/0000-0003-0499-1350 , https://orcid.org/0000-0002-2524-5237
14 Vertex Operators of SL(2,R) Black Hole and 2-d gravity 1994-01-01 1994 A5059661145 first , last , https://openalex.org/I3145578848 , https://openalex.org/I4210146419 , Institute for Cognitive Science Studies , Institute for Research in Fundamental Sciences , https://ror.org/0378cd528 , https://ror.org/04xreqs31 , IR , IR , facility , funder , https://openalex.org/I3145578848 , https://openalex.org/I4210146419 , IR , FALSE , FALSE , M. Alimohammadi , F. Ardalan , Institute for Studies in Theoretical Physics and Mathematics, Tehran, Iran, Institute for Studies in Theoretical Physics and Mathematics, Tehran, Iran, https://openalex.org/I3145578848 , https://openalex.org/I4210146419 , https://openalex.org/A5059661145 , https://openalex.org/A5076913797 , M. Alimohammadi , F. Ardalan , https://orcid.org/0000-0003-0499-1350 , NA
15 Nilpotent Gauging of SL(2,R)\(WZNW\) models, and Liouville Field 1993-04-07 1993 A5059661145 first , middle , last , FALSE , FALSE , FALSE , M.Alimohammadi , F.Ardalan , H.Arfaei , https://openalex.org/A5059661145 , https://openalex.org/A5076913797 , https://openalex.org/A5105822588 , M. Alimohammadi , F. Ardalan , H. Arfaei , https://orcid.org/0000-0003-0499-1350, NA , https://orcid.org/0000-0002-3031-0048
Source: OpenAlex author IDs: A5111436477, A5059661145.

The goal now is to manually check each of these 15 works that don’t appear to be part of Masoud’s works, at least based on our list of 53 works, are actually not part of his published works. Out of these list, only two works appear to be indeed not part of Masoud’s works:

  • The Association of Job Involvement with Group Counseling Based on Motivational Interviewing

  • New Activated Carbon from Persian Mesquite Grain as an Excellent Adsorbent

These were not only publised after his death, in 2024 and 2017 respectively, so we decide to remove them.

Now, we get that the complete set of works for

library(dplyr)
# Cutoff = date of death
cutoff <- as.Date("2010-01-12")

# Keep only OpenAlex works published BEFORE 12 Jan 2010
not_before_2010 <- not_masoud_53works %>%
  mutate(publication_date = as.Date(publication_date)) %>%
  filter(!is.na(publication_date) & publication_date < cutoff)

# Merge with your 53 (missing cols in not_before_2010 become NA)
masoud_works <- bind_rows(
  masoud_53works %>%
    mutate(publication_date = as.Date(publication_date),
           author_id = as.character(author_id)),
  not_before_2010 %>%
    mutate(author_id = as.character(author_id))
) %>%
  select(any_of(names(masoud_53works)), everything())

After consolidating all author profiles, we have a total of 66 works for Masoud Alimohammadi.

library(dplyr)
library(purrr)
library(tidyr)

masoud_works_long <- masoud_works %>%
  # keep only the columns we care about (won't error if some are missing)
  select(any_of(c("id", "title", "publication_date", "publication_year", "topics", "author_id"))) %>%
  # keep rows with a non-empty topics tibble (optional; drop if you want to keep all)
  filter(map_lgl(topics, ~ !is.null(.x) && is.data.frame(.x) && nrow(.x) > 0)) %>%
  # trim/rename columns inside each topics tibble
  mutate(
    topics = map(
      topics,
      ~ .x %>%
        select(
          display_name, score,
          `subfield.display_name`, `field.display_name`, `domain.display_name`
        ) %>%
        rename(topic = display_name) %>%
        rename_with(~ gsub("\\.?display_name", "", .x))   # drops ".display_name" suffixes
    )
  ) %>%
  # UNNEST topics (this is the only change vs your nested version)
  unnest(cols = topics) %>%
  # strip OpenAlex URL prefixes from any character columns
  mutate(across(where(is.character), ~ gsub("https://openalex.org/", "", .x, fixed = TRUE)))


#saveRDS(masoud_works_long, file.path("/standard/nsdpi_storage/people/czj9zj/DiD_data_3topic/extra_data", "masoud_works_long.rds"))

Extract Masoud’s Topics

library(dplyr)

# Unique topics from Masoud's works (drop NAs just in case)
masoud_unique_topics <- masoud_works_long %>%
  distinct(topic) %>%
  filter(!is.na(topic)) %>%
  pull(topic)

# Subset to those topics
masoud_keywords_v1 <- topic_summary %>%
  filter(Topic %in% masoud_unique_topics)

# Save
#saveRDS(masoud_keywords_v1, file.path(data_path, "masoud_keywords_v1.rds"))

While several topic labels in the profiles of M. Shahriari and F. Abbasi Davani appear medical (e.g., Advanced Radiotherapy Techniques, Medical Imaging Techniques and Applications, Radiopharmaceutical Chemistry), there is good indication that they represent medical-physics/engineering work applied to medicine rather than clinical outcomes research.For instance, the topics radiation detection and dosimetry, accelerator/beam physics, imaging physics, nuclear instrumentation,

library(dplyr)
library(stringr)

# --- 1) Classifier (regex-based, covers all current & future topics) ----------
classify_topic <- function(x) {
  x0 <- tolower(trimws(x))

  medical_pat <- paste(c(
    "imaging",                      # X-ray/CT/MRI, breast imaging
    "radiother",                    # radiotherapy
    "\\btherapy\\b",                # generic therapy (filtered by context words below)
    "dosimetry.*(therapy|dose|imaging)?", # therapy/dose contexts
    "oncolog|tumou?r|cancer|melanoma|patholog",
    "ocular|ophthal|glaucoma|retin",
    "radiopharm",                   # radiopharmaceuticals
    "hemostasis|surgical",          # surgical safety items
    "nail diseases|hormone|estrogen",
    "drug delivery"
  ), collapse = "|")

  med_adj_pat <- paste(c(
    "dosimetry",                    # radiation effects & dosimetry (non-clinical)
    "radiation detection|scintillator",
    "shielding",
    "biosens|bioanalys",            # biosensing/bioanalysis tools
    "magnetic nanopart",
    "ultrasound|cavitation"
  ), collapse = "|")

  health_pat <- paste(c(
    "air quality|aerosol",
    "radon|radioactive.*(contamination|transfer)",
    "environmental and industrial safety"
  ), collapse = "|")

  dplyr::case_when(
    str_detect(x0, medical_pat)    ~ "medical",
    str_detect(x0, med_adj_pat)    ~ "medical-adjacent",
    str_detect(x0, health_pat)     ~ "health-related",
    TRUE                           ~ "not-medical"
  )
}

# --- 2) Apply to your data frames (Topic column) -------------------------------
majid_keywords_v1  <- majid_keywords_v1  %>% mutate(medical_category = classify_topic(Topic))
abbasi_keywords_v1 <- abbasi_keywords_v1 %>% mutate(medical_category = classify_topic(Topic))


masoud_exclusive_topic <- masoud_keywords_v1 %>%
  select(topic = Topic)   # keep only "Topic", rename it to "topic"
library(dplyr)
library(tidyr)
library(scales)
library(kableExtra)

cats <- c("medical","medical-adjacent","health-related","not-medical")

# helper to count & ensure all categories
count_cats <- function(df, who) {
  df %>%
    count(medical_category) %>%
    complete(medical_category = cats, fill = list(n = 0)) %>%
    mutate(dataset = who)
}

majid_cnt  <- count_cats(majid_keywords_v1,  "Majid")
abbasi_cnt <- count_cats(abbasi_keywords_v1, "Abbasi")

both <- bind_rows(majid_cnt, abbasi_cnt) %>%
  group_by(dataset) %>%
  mutate(pct = n/sum(n)) %>%
  ungroup()

# build one value "n (xx.x%)"
both <- both %>%
  mutate(val = sprintf("%d (%.1f%%)", n, pct*100))

tbl <- both %>%
  select(medical_category, dataset, val) %>%
  pivot_wider(names_from = dataset, values_from = val) %>%
  arrange(factor(medical_category, levels = cats)) %>%
  rename(Category = medical_category) %>%
  add_row(Category = "Total",
          Majid  = sprintf("%d (100%%)", sum(majid_cnt$n)),
          Abbasi = sprintf("%d (100%%)", sum(abbasi_cnt$n)))

kbl(
  tbl,
  caption = "Topic Categories by Author (count with %)",
  align   = "lcc",
  escape  = FALSE
) %>%
  kable_styling(full_width = FALSE, bootstrap_options = c("striped","hover","condensed","responsive")) %>%
  row_spec(0, bold = TRUE)
Topic Categories by Author (count with %)
Category Majid Abbasi
medical 13 (31.0%) 19 (18.4%)
medical-adjacent 2 (4.8%) 4 (3.9%)
health-related 2 (4.8%) 3 (2.9%)
not-medical 25 (59.5%) 77 (74.8%)
Total 42 (100%) 103 (100%)

Ardeshir Hosseinpour

library(dplyr)
library(tidyr)
library(purrr)
library(stringr)
library(knitr)
library(kableExtra)

# set your data path
data_path <- "/standard/nsdpi_storage/people/czj9zj/extra_data"

# --- build long table of works + topics for both Hosseinpour profiles ---
hosseinpour_works_long <- bind_rows(
  readRDS(file.path(data_path, "works_AH_5028.rds")) %>%
    select(id, title, publication_date, publication_year, authorships, topics) %>%
    mutate(
      topics = map(topics, ~ dplyr::select(.x,
        display_name, score,
        subfield.display_name, field.display_name, domain.display_name
      )),
      author_id = "A5028383055"  # maps to 5028 file
    ) %>%
    unnest(topics),

  readRDS(file.path(data_path, "works_AH_5048.rds")) %>%
    select(id, title, publication_date, publication_year, authorships, topics) %>%
    mutate(
      topics = map(topics, ~ dplyr::select(.x,
        display_name, score,
        subfield.display_name, field.display_name, domain.display_name
      )),
      author_id = "A5048006655"  # maps to 5048 file
    ) %>%
    unnest(topics)
) %>%
  rename(topic = display_name) %>%
  # remove ".display_name" suffixes for cleaner column names
  rename_with(~ gsub("\\.?display_name$", "", .x)) %>%
  # strip OpenAlex URL prefixes if present anywhere
  mutate(across(where(is.character),
                ~ gsub("https://openalex.org/", "", .x, fixed = TRUE)))

# --- pivot wider so one row = one work (with numbered topic fields) ---
hosseinpour_works <- hosseinpour_works_long %>%
  group_by(id) %>%
  mutate(row_num = row_number()) %>%
  ungroup() %>%
  pivot_wider(
    id_cols   = c(title, publication_date, publication_year, id, author_id, authorships),
    names_from = row_num,
    values_from = c(topic, score, subfield, field, domain),
    names_glue = "{.value}_{row_num}"
  )


saveRDS(
  hosseinpour_works_long,
  file = file.path(data_path, "hosseinpour_works_long.rds")
)

# Save the wide-format works table
saveRDS(
  hosseinpour_works,
  file = file.path(data_path, "hosseinpour_works.rds")
)

# --- quick listing table of distinct titles (use nice_table if you have it) ---
titles_tbl <- hosseinpour_works_long %>%
  distinct(title, publication_year) %>%
  arrange(publication_year)

# If you have nice_table(), use it:
# nice_table(titles_tbl, title = "List of Ardeshir Hosseinpour works")

# Otherwise, a LaTeX-ready table via kableExtra:
kbl(titles_tbl,
    format = "latex",
    booktabs = TRUE,
    caption = "List of Ardeshir Hosseinpour Works") %>%
  kable_styling(latex_options = c("hold_position", "scale_down"),
                font_size = 10)
data_path <- "/standard/nsdpi_storage/people/czj9zj/extra_data"
shiraz_university_long <- readRDS(file.path(data_path, "shiraz_university_cleanedLONG.rds"))

#make a list of topics that are only listed on the works that A. Hosseinpour authored
hosseinpour_topics = data.frame("topic" = unique(hosseinpour_works_long$topic))

#clean and pivot the Shiraz University works dataframe wide. this includes 1) turning the "type" of publication from a string into a factor, 2) pivoting wider to make one row per work, with the three topics pivoted wide rather than long, 3) floor the date to the first of the month to allow for analysis by monthly rate, 4) create variable to indicate whether a paper should be classified as physics or not
shiraz_university_works = shiraz_university_long %>% 
  mutate(type = as.factor(type)) %>% 
  group_by(id) %>% 
  mutate(row_num = row_number()) %>%
  ungroup() %>%
  pivot_wider(
    id_cols = c(title, publication_date, id, type),
    names_from = row_num,
    values_from = topic,
    names_glue = "{.value}_{row_num}") %>% 
  mutate(publication_month = floor_date(publication_date, "month")) %>% 
  rowwise() %>% 
  mutate(topic_condition = if_else(any(c(topic_1, topic_2, topic_3) %in% hosseinpour_topics$topic),'Electromagnetism physics areas', 'All other areas')) 
# Extract unique topics for Hosseinpour from the works data
hosseinpour_unique_topics <- unique(hosseinpour_works_long$topic)

# Now filter the topic_summary with those
hosseinpour_keywords_v1 <- topic_summary[topic_summary$Topic %in% hosseinpour_unique_topics, ]


data_path <- "/standard/nsdpi_storage/people/czj9zj/extra_data"

# Save Hosseinpour keywords table as RDS
saveRDS(
  hosseinpour_keywords_v1, 
  file = file.path(data_path, "hosseinpour_keywords_v1.rds")
)

DiD Preliminary Analysis

Majid and Abbasi

base_path <- "/standard/nsdpi_storage/people/czj9zj/DiD_data_3topic/extra_data"
  
# load data
df <- read_rds(file.path(base_path, "shahid_beheshti_university_cleanedLONG.rds")) %>%  # version sent on 08/15/2025
  filter(institution == "Shahid Beheshti University") %>%
  glimpse()
## Rows: 97,538
## Columns: 7
## $ id               <chr> "W2061438946", "W2061438946", "W2061438946", "W428807…
## $ title            <chr> "Grey Wolf Optimizer", "Grey Wolf Optimizer", "Grey W…
## $ publication_date <date> 2014-01-22, 2014-01-22, 2014-01-22, 2020-04-03, 2020…
## $ topic            <chr> "Metaheuristic Optimization Algorithms Research", "Ad…
## $ score            <dbl> 0.9999, 0.9940, 0.9761, 0.9999, 0.9986, 0.9980, 0.999…
## $ type             <chr> "article", "article", "article", "article", "article"…
## $ institution      <chr> "Shahid Beheshti University", "Shahid Beheshti Univer…
# create baseline panel data set
units <- unique(df$topic)  # extract the unique topic values for any work published at Shahid Beheshti

time <- seq.Date(
  from = as.Date("2000-01-01"),  # sequence every month from Jan. 2000 to July 2025
  to   = as.Date("2025-06-01"),
  by   = "month"
)

panel <- expand.grid(topic = units, publication_month = time)  # ensure every topic is observed for every month

# join the works df with the panel to create clean_df
# first, recode to first of the month
df$publication_month <- as.Date(format(df$publication_date, "%Y-%m-01"))  # month-level time indicator

# aggregate to the month level 
group_df <- df %>%
  group_by(topic, publication_month) %>%
  summarize(n_pubs = n(), .groups = "drop") %>%
  glimpse()
## Rows: 75,392
## Columns: 3
## $ topic             <chr> "14-3-3 protein interactions", "14-3-3 protein inter…
## $ publication_month <date> 2015-01-01, 2019-04-01, 2022-09-01, 2020-10-01, 201…
## $ n_pubs            <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 1…
# third, join
clean_df <- left_join(panel, group_df, by = c("topic", "publication_month")) %>%
  glimpse()
## Rows: 1,145,970
## Columns: 3
## $ topic             <chr> "Metaheuristic Optimization Algorithms Research", "A…
## $ publication_month <date> 2000-01-01, 2000-01-01, 2000-01-01, 2000-01-01, 200…
## $ n_pubs            <int> NA, NA, NA, 4, NA, NA, 1, NA, NA, NA, NA, NA, NA, NA…
# finally, recode NAs to be 0
clean_df$n_pubs <- replace_na(clean_df$n_pubs, 0)  # NA means no publication observed

# load in the works list associated with each of the treatment conditions
core      <- read_rds(file.path(base_path, "core_physics_topics.rds"))
shahriari <- read_rds(file.path(base_path, "shahriari_exclusive_topic.rds"))
abbasi    <- read_rds(file.path(base_path, "abbasi_exclusive_topic.rds"))

# create an indicator for which group a topic belongs to
clean_df <- clean_df %>%
  mutate(
    topic_condition = case_when(
      topic %in% core$topic      ~ "Nuclear physics core areas",
      topic %in% shahriari$topic ~ "M. Shahriari exclusive areas",
      topic %in% abbasi$topic    ~ "F. Abbasi-Davani exclusive areas",
      TRUE                       ~ "All other areas"   # <- fallback case
    )
  ) %>%
  glimpse()
## Rows: 1,145,970
## Columns: 4
## $ topic             <chr> "Metaheuristic Optimization Algorithms Research", "A…
## $ publication_month <date> 2000-01-01, 2000-01-01, 2000-01-01, 2000-01-01, 200…
## $ n_pubs            <int> 0, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ topic_condition   <chr> "All other areas", "All other areas", "All other are…
# save out the clean DiD friendly dataframe
write_rds(clean_df, file.path(base_path, "sbu_clean_did.rds"))
# load required packages
library(tidyverse)
library(marginaleffects)

# load data
df_1 <- clean_df %>% 
  filter(topic_condition == "Nuclear physics core areas" | topic_condition == "All other areas") %>%
  mutate(plot_topic = ifelse(topic_condition == "Nuclear physics core areas", "SBU Nuclear", "SBU Other")) %>%
  mutate(post_1 = ifelse(publication_month >= "2010-12-01", 1, 0)) %>%
  mutate(post_2 = ifelse(publication_month >= "2015-07-01", 1, 0)) %>%
  glimpse()
## Rows: 1,114,758
## Columns: 7
## $ topic             <chr> "Metaheuristic Optimization Algorithms Research", "A…
## $ publication_month <date> 2000-01-01, 2000-01-01, 2000-01-01, 2000-01-01, 200…
## $ n_pubs            <int> 0, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ topic_condition   <chr> "All other areas", "All other areas", "All other are…
## $ plot_topic        <chr> "SBU Other", "SBU Other", "SBU Other", "SBU Other", …
## $ post_1            <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ post_2            <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
df <- df_1 %>%
  mutate(
    time_period = case_when(
      publication_month <  as.Date("2010-12-01") ~ "Before Assassination",
      publication_month >= as.Date("2010-12-01") & publication_month < as.Date("2015-07-01")
        ~ "After Assassination & Before JCPOA",
      publication_month >= as.Date("2015-07-01") ~ "After JCPOA"
    ),
    time_period = factor(time_period,
      levels = c("Before Assassination","After Assassination & Before JCPOA","After JCPOA")),
    # give legend-ready labels now
    plot_topic = factor(plot_topic,
      levels = c("SBU Nuclear","SBU Other"),
      labels = c("F. Abbasi-Davani exclusive","M. Shahriari exclusive"))
  )

# model
out <- glm(n_pubs ~ plot_topic * time_period, data = df, family = poisson())

# predictions
gg <- marginaleffects::avg_predictions(out, variables = c("plot_topic","time_period"), vcov = ~ topic)

# plot
ggplot(gg, aes(time_period, estimate, ymin = conf.low, ymax = conf.high, color = plot_topic)) +
  geom_pointrange(linewidth = 1, position = position_dodge(width = .15)) +
  scale_color_manual(values = c("coral", "#1f78b4")) +
  scale_x_discrete(labels = c("Before Assassination",
                              "After Assassination\n& Before JCPOA",
                              "After JCPOA")) +
  coord_cartesian(ylim = c(0, 0.6)) +
  labs(y = "Predicted Publications per Month", x = NULL, color = NULL,
       title = "Change in Scientific Output over Time") +
  theme_minimal() +
  theme(legend.position = "bottom")

# load required packages
library(tidyverse)
library(marginaleffects)

# 1) Load & prep --------------------------------------------------------------
df_1 <- clean_df %>% 
  filter(topic_condition %in% c("Nuclear physics core areas", "All other areas")) %>%
  mutate(
    publication_month = as.Date(publication_month),
    plot_topic = ifelse(topic_condition == "Nuclear physics core areas",
                        "SBU Nuclear", "SBU Other"),
    post_1 = as.integer(publication_month >= as.Date("2010-12-01")),
    post_2 = as.integer(publication_month >= as.Date("2015-07-01"))
  )

# 2) Define event cut points (NO COVID) --------------------------------------
events <- tribble(
  ~event,                       ~date,
  "Stuxnet Cyberattack",        as.Date("2010-06-17"),
  "Assassination",              as.Date("2010-12-01"),  # use your preferred threshold
  "JCPOA Agreement",            as.Date("2015-07-01"),
  "Natanz Explosion",           as.Date("2020-07-02"),
  "Natanz Blackout",            as.Date("2021-04-11")
) %>% arrange(date)

# Build breaks from data range + events
start_date <- min(df_1$publication_month, na.rm = TRUE)
end_date   <- max(df_1$publication_month, na.rm = TRUE) + 1  # right-open interval guard

breaks <- c(start_date, events$date, end_date)

labels <- c(
  "Pre–Stuxnet",
  "Post–Stuxnet\npre–Assassination",
  "Post–Assassination\npre–JCPOA",
  "Post–JCPOA\npre–Natanz Explosion",
  "Post–Natanz Explosion\npre–Natanz Blackout",
  "Post–Natanz Blackout"
)

# 3) Build the multi-event factor --------------------------------------------
df <- df_1 %>%
  mutate(
    time_period = cut(publication_month, breaks = breaks, labels = labels, right = FALSE),
    time_period = factor(time_period, levels = labels),
    plot_topic  = factor(plot_topic, levels = c("SBU Nuclear","SBU Other"))
  ) %>%
  filter(!is.na(time_period))

# 4) Model (Poisson) ----------------------------------------------------------
# If 'topic' isn't in df, change vcov below to "HC3"
out <- glm(n_pubs ~ plot_topic * time_period, data = df, family = poisson())

# 5) Predictions --------------------------------------------------------------
gg <- marginaleffects::avg_predictions(
  out,
  variables = c("plot_topic","time_period"),
  vcov = ~ topic
)

library(ggplot2)



# 6) Plot ---------------------------------------------------------------------
# Predictions
preds <- marginaleffects::avg_predictions(
  out,
  variables = c("plot_topic","time_period"),
  vcov = ~ topic   # change/remove if 'topic' isn't in your data
)

# Plot
ggplot(preds, aes(x = time_period,
                  y = estimate,
                  ymin = conf.low, ymax = conf.high,
                  color = plot_topic)) +
  geom_pointrange(linewidth = 1,
                  position = position_dodge(width = 0.25)) +
  scale_color_manual(values = c("SBU Nuclear" = "coral",
                                "SBU Other"   = "#1f78b4")) +
  labs(y = "Predicted Publications per Month",
       x = NULL, color = NULL,
       title = "Change in Scientific Output Across Events",
       subtitle = "Windows split at Stuxnet → Assassination → JCPOA → Natanz Explosion → Natanz Blackout") +
  theme_minimal() +
  theme(legend.position = "bottom",
        axis.text.x = element_text(angle = 30, hjust = 1))

library(tidyverse)
library(marginaleffects)

# load & prep: keep only the two exclusive groups you care about
df <- clean_df %>% 
  filter(topic_condition %in% c("Nuclear physics core areas", "All other areas")) %>%
  mutate(
    # relabel topics into just two groups of interest
    plot_topic = ifelse(topic_condition == "Nuclear physics core areas",
                        "F. Abbasi-Davani exclusive",
                        "M. Shahriari exclusive"),
    publication_month = as.Date(publication_month),
    # create a simple before/after indicator
    time_period = ifelse(publication_month < as.Date("2010-12-01"),
                         "Before Assassination",
                         "After Assassination"),
    time_period = factor(time_period, 
                         levels = c("Before Assassination","After Assassination")),
    plot_topic = factor(plot_topic,
                        levels = c("F. Abbasi-Davani exclusive","M. Shahriari exclusive"))
  )

# model
out <- glm(n_pubs ~ plot_topic * time_period, data = df, family = poisson())

# predictions
gg <- marginaleffects::avg_predictions(out, variables = c("plot_topic","time_period"), vcov = ~ topic)

# plot
ggplot(gg, aes(x = time_period, y = estimate, ymin = conf.low, ymax = conf.high, color = plot_topic)) +
  geom_pointrange(linewidth = 1, position = position_dodge(width = .2)) +
  scale_color_manual(values = c("#20BF55", "orange")) +
  coord_cartesian(ylim = c(0, 0.6)) +
  labs(y = "Predicted Publications per Month",
       x = NULL,
       color = NULL,
       title = "Change in Scientific Output after Assassination",
       subtitle = "95% CI clustered by topic") +
  theme_minimal() +
  theme(legend.position = "bottom")

library(tidyverse)
library(marginaleffects)

# ---------- 1) Load & prep ----------
df <- clean_df %>%
  mutate(
    publication_month = as.Date(publication_month),

    # collapse into just two groups (rename to avoid the reserved word)
    group_var = case_when(
      topic_condition == "Nuclear physics core areas" ~ "SBU Nuclear",
      topic_condition == "All other areas"           ~ "SBU Other",
      TRUE ~ NA_character_
    ),
    time_period = ifelse(publication_month < as.Date("2010-12-01"),
                         "Before Assassination", "After Assassination")
  ) %>%
  filter(!is.na(group_var)) %>%
  mutate(
    group_var   = factor(group_var,   levels = c("SBU Nuclear","SBU Other")),
    time_period = factor(time_period, levels = c("Before Assassination","After Assassination"))
  )

# ---------- 2) Model & predictions ----------
m <- glm(n_pubs ~ group_var * time_period, data = df, family = poisson())

pred <- marginaleffects::avg_predictions(
  m, variables = c("group_var","time_period"), vcov = ~ topic
)

# ---------- 3) Plot ----------
ggplot(pred, aes(x = time_period, y = estimate,
                 ymin = conf.low, ymax = conf.high, color = group_var)) +
  geom_pointrange(linewidth = 1, position = position_dodge(width = .2)) +
  scale_color_manual(values = c("SBU Nuclear" = "#212738",
                                "SBU Other"   = "#20BF55")) +
  coord_cartesian(ylim = c(0, 0.55)) +
  labs(
    title = "Change in Scientific Output after Assassination",
    subtitle = "95% CI calculated using standard errors clustered by topic.",
    x = NULL, y = "Predicted Publications per Month", color = NULL
  ) +
  theme_minimal() +
  theme(legend.position = "bottom")

library(tidyverse)

# --- Assumes you already built `clean_df` with columns: topic, publication_month, n_pubs ---
base_path <- "/standard/nsdpi_storage/people/czj9zj/DiD_data_3topic/extra_data"

# Normalize topic strings from your lists
core_set      <- read_rds(file.path(base_path, "core_physics_topics.rds")) %>%
  transmute(topic = str_trim(as.character(topic))) %>% distinct() %>% pull(topic)

shahri_excl   <- read_rds(file.path(base_path, "shahriari_exclusive_topic.rds")) %>%
  transmute(topic = str_trim(as.character(topic))) %>% distinct() %>% pull(topic)

abbasi_excl   <- read_rds(file.path(base_path, "abbasi_exclusive_topic.rds")) %>%
  transmute(topic = str_trim(as.character(topic))) %>% distinct() %>% pull(topic)

# Inclusive sets = core ∪ exclusive
shahri_incl_set <- union(core_set, shahri_excl)
abbasi_incl_set <- union(core_set, abbasi_excl)

# Build three group data frames
df_shah_incl <- clean_df %>%
  filter(topic %in% shahri_incl_set) %>%
  mutate(topic_condition = "M. Shahriari inclusive areas")

df_abb_incl <- clean_df %>%
  filter(topic %in% abbasi_incl_set) %>%
  mutate(topic_condition = "F. Abbasi-Davani inclusive areas")

df_other <- clean_df %>%
  filter(!(topic %in% union(shahri_incl_set, abbasi_incl_set))) %>%
  mutate(topic_condition = "All other areas")

# Bind together (core topics appear in BOTH inclusive groups by design)
clean_df_inclusive <- bind_rows(df_shah_incl, df_abb_incl, df_other) %>%
  mutate(
    topic_condition = factor(
      topic_condition,
      levels = c("M. Shahriari inclusive areas",
                 "F. Abbasi-Davani inclusive areas",
                 "All other areas")
    )
  )

# Optional: quick sanity checks
print(count(clean_df_inclusive, topic_condition, sort = TRUE))
##                    topic_condition       n
## 1                  All other areas 1107108
## 2 F. Abbasi-Davani inclusive areas   33354
## 3     M. Shahriari inclusive areas   13158
# Core topics duplicated into both inclusive labels:
# clean_df_inclusive %>% filter(topic %in% core_set) %>% count(topic_condition)

# Save if you want to use this downstream
write_rds(clean_df_inclusive, file.path(base_path, "sbu_clean_did_inclusive.rds"))
library(tidyverse)
library(marginaleffects)

# ---- Use the inclusive dataset you built earlier ----
# clean_df_inclusive must have: topic, publication_month, n_pubs, topic_condition
df_use <- clean_df_inclusive %>%
  mutate(publication_month = as.Date(publication_month))

# ---- Define event windows (no COVID) ----
events <- tribble(
  ~event,                ~date,
  "Stuxnet Cyberattack",  as.Date("2010-06-17"),
  "Assassination",        as.Date("2010-12-01"),   # adjust if you use a different exact date
  "JCPOA Agreement",      as.Date("2015-07-01"),
  "Natanz Explosion",     as.Date("2020-07-02"),
  "Natanz Blackout",      as.Date("2021-04-11")
) %>% arrange(date)

start_date <- min(df_use$publication_month, na.rm = TRUE)
end_date   <- max(df_use$publication_month, na.rm = TRUE) + 1  # right-open guard

breaks <- c(start_date, events$date, end_date)
labels <- c(
  "Pre–Stuxnet",
  "Post–Stuxnet\npre–Assassination",
  "Post–Assassination\npre–JCPOA",
  "Post–JCPOA\npre–Explosion",
  "Post–Explosion\npre–Blackout",
  "Post–Blackout"
)

# ---- Create time_period on the SAME data you model ----
df_use <- df_use %>%
  mutate(
    time_period = cut(publication_month, breaks = breaks, labels = labels, right = FALSE),
    time_period = factor(time_period, levels = labels),
    # lock the 3 plotting groups exactly as built earlier
    topic_condition = factor(
      topic_condition,
      levels = c("M. Shahriari inclusive areas",
                 "F. Abbasi-Davani inclusive areas",
                 "All other areas")
    )
  ) %>%
  filter(!is.na(time_period))

# ---- Model (Poisson) ----
# If you don't want to cluster by topic (or topic is missing), use vcov = "HC3" in avg_predictions()
out <- glm(n_pubs ~ topic_condition * time_period, data = df_use, family = poisson())

# ---- Predictions ----
gg <- marginaleffects::avg_predictions(
  out,
  variables = c("topic_condition","time_period"),
  vcov = ~ topic
)

# ---- Plot ----
# nicer dodge so groups don't overlap
pd <- position_dodge(width = 0.35)

ggplot(gg, aes(
  x = time_period, y = estimate,
  ymin = conf.low, ymax = conf.high,
  color = topic_condition
)) +
  geom_pointrange(position = pd, linewidth = 0.9, fatten = 1.2) +
  scale_color_manual(values = c(
    "M. Shahriari inclusive areas"     = "#1f78b4",
    "F. Abbasi-Davani inclusive areas" = "coral",
    "All other areas"                  = "#7A7A7A"
  )) +
  labs(
    y = "Predicted Publications per Month",
    x = NULL, color = NULL,
    title = "Change in Scientific Output Across Events",
    subtitle = "Windows split at Stuxnet → Assassination → JCPOA → Natanz Explosion → Natanz Blackout",
    caption = "95% CI calculated using standard errors clustered by topic."
  ) +
  theme_minimal() +
  theme(
    legend.position = "bottom",
    axis.text.x = element_text(angle = 30, hjust = 1),
    plot.caption.position = "plot",
    plot.caption = element_text(hjust = 1, size = 9)
  )

# nice IRR table with cluster-robust SEs (cluster = topic)
library(broom)
library(sandwich)
library(lmtest)
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
library(dplyr)
library(stringr)
library(gt)

# 1) Cluster-robust variance-covariance (by topic)
vc_topic <- sandwich::vcovCL(out, cluster = df_use$topic)

# 2) Coefficient test using that VCOV
ct <- lmtest::coeftest(out, vcov. = vc_topic)

# 3) Tidy + transform to IRR and 95% CI
tbl <- broom::tidy(ct) %>%
  mutate(
    IRR = exp(estimate),
    CI_low  = exp(estimate - 1.96 * std.error),
    CI_high = exp(estimate + 1.96 * std.error),
    `95% CI` = sprintf("[%.3f, %.3f]", CI_low, CI_high),
    Term = term %>%
      str_replace("^topic_condition", "Topic: ") %>%
      str_replace("^time_period", "Period: ") %>%
      str_replace(":", " × ")        # interaction pretty-print
  ) %>%
  transmute(
    Term,
    IRR,
    `Std. Error` = std.error,
    `p-value` = p.value,
    `95% CI`
  )

# 4) Pretty table
gt_tbl <- gt(tbl) %>%
  fmt_number(columns = c(IRR, `Std. Error`, `p-value`), decimals = 3) %>%
  tab_header(
    title = md("**Poisson GLM — Incidence Rate Ratios (IRR)**"),
    subtitle = "Outcome: monthly publication counts"
  ) %>%
  tab_source_note(md("*95% CI calculated using standard errors clustered by topic"))

gt_tbl
Poisson GLM — Incidence Rate Ratios (IRR)
Outcome: monthly publication counts
Term IRR Std. Error p-value 95% CI
(Intercept) 0.070 0.133 0.000 [0.054, 0.091]
Topic × F. Abbasi-Davani inclusive areas 0.959 0.192 0.829 [0.658, 1.399]
Topic × All other areas 0.364 0.144 0.000 [0.275, 0.483]
Period × Post–Stuxnet pre–Assassination 2.387 0.221 0.000 [1.549, 3.679]
Period × Post–Assassination pre–JCPOA 3.696 0.145 0.000 [2.781, 4.911]
Period × Post–JCPOA pre–Explosion 5.110 0.135 0.000 [3.921, 6.659]
Period × Post–Explosion pre–Blackout 5.747 0.189 0.000 [3.969, 8.322]
Period × Post–Blackout 4.616 0.161 0.000 [3.365, 6.332]
Topic × F. Abbasi-Davani inclusive areas:time_periodPost–Stuxnet pre–Assassination 0.937 0.188 0.728 [0.648, 1.353]
Topic × All other areas:time_periodPost–Stuxnet pre–Assassination 1.022 0.224 0.924 [0.658, 1.585]
Topic × F. Abbasi-Davani inclusive areas:time_periodPost–Assassination pre–JCPOA 1.024 0.155 0.880 [0.755, 1.388]
Topic × All other areas:time_periodPost–Assassination pre–JCPOA 0.904 0.150 0.502 [0.674, 1.213]
Topic × F. Abbasi-Davani inclusive areas:time_periodPost–JCPOA pre–Explosion 0.929 0.190 0.700 [0.640, 1.349]
Topic × All other areas:time_periodPost–JCPOA pre–Explosion 1.010 0.144 0.947 [0.761, 1.339]
Topic × F. Abbasi-Davani inclusive areas:time_periodPost–Explosion pre–Blackout 0.960 0.244 0.866 [0.594, 1.550]
Topic × All other areas:time_periodPost–Explosion pre–Blackout 1.290 0.197 0.197 [0.876, 1.900]
Topic × F. Abbasi-Davani inclusive areas:time_periodPost–Blackout 0.882 0.225 0.577 [0.568, 1.371]
Topic × All other areas:time_periodPost–Blackout 1.151 0.171 0.411 [0.824, 1.608]
*95% CI calculated using standard errors clustered by topic

Masoud

library(tidyverse)

base_path <- "/standard/nsdpi_storage/people/czj9zj/DiD_data_3topic/extra_data"

# 1) Load UT works ------------------------------------------------------------
df <- read_rds(file.path(base_path, "university_of_Tehran_cleanedLONG.rds")) %>%
  mutate(
    topic = str_trim(as.character(topic)),
    publication_month = as.Date(format(publication_date, "%Y-%m-01"))
  )
# If the file contains multiple institutions, keep UT only (safe-guard)
if ("institution" %in% names(df)) {
  df <- df %>% filter(institution == "University of Tehran")
}

# 2) Build topic x month panel (complete) -------------------------------------
units <- sort(unique(df$topic))
time  <- seq.Date(from = as.Date("2000-01-01"), to = as.Date("2025-06-01"), by = "month")

panel <- tidyr::crossing(
  topic = units,
  publication_month = time
)

# 3) Aggregate monthly counts & join to panel ---------------------------------
group_df <- df %>%
  count(topic, publication_month, name = "n_pubs")

clean_df <- panel %>%
  left_join(group_df, by = c("topic", "publication_month")) %>%
  mutate(n_pubs = replace_na(n_pubs, 0))

# 4) Load topic sets ----------------------------------------------------------
core   <- read_rds(file.path(base_path, "core_physics_topics.rds")) %>%
  transmute(topic = str_trim(as.character(topic))) %>% distinct()

masoud_exclusive_topic <- masoud_keywords_v1 %>%
  select(topic = Topic)

masoud <- masoud_exclusive_topic
#masoud <- read_rds(file.path(base_path, "masoud_exclusive_topic.rds")) %>%  # you created this earlier

#transmute(topic = str_trim(as.character(topic))) %>% distinct()

# 5) Label groups (Masoud exclusive vs core vs others) ------------------------
clean_df <- clean_df %>%
  mutate(
    topic_condition = case_when(
      topic %in% core$topic   ~ "Nuclear physics core areas",
      topic %in% masoud$topic ~ "Masoud Ali-Mohammadi exclusive areas",
      TRUE                    ~ "All other areas"
    ),
    topic_condition = factor(
      topic_condition,
      levels = c("Masoud Ali-Mohammadi exclusive areas",
                 "Nuclear physics core areas",
                 "All other areas")
    )
  )

# Optional quick check
print(count(clean_df, topic_condition, sort = TRUE))
## # A tibble: 3 × 2
##   topic_condition                            n
##   <fct>                                  <int>
## 1 All other areas                      1235322
## 2 Masoud Ali-Mohammadi exclusive areas   14076
## 3 Nuclear physics core areas              7650
# 6) Save DiD-friendly UT dataset --------------------------------------------
write_rds(clean_df, file.path(base_path, "ut_clean_did.rds"))
library(tidyverse)
library(marginaleffects)

base_path <- "/standard/nsdpi_storage/people/czj9zj/DiD_data_3topic/extra_data"

# --- Load UT DiD-ready data (built earlier) ---
ut <- read_rds(file.path(base_path, "ut_clean_did.rds")) %>%
  mutate(
    publication_month = as.Date(publication_month),
    # map to three plotting groups (keep labels explicit)
    plot_group = case_when(
      topic_condition == "Masoud Ali-Mohammadi exclusive areas" ~ "Masoud exclusive",
      topic_condition == "Nuclear physics core areas"            ~ "UT Nuclear",
      topic_condition == "All other areas"                       ~ "UT Other",
      TRUE ~ NA_character_
    )
  ) %>%
  filter(!is.na(plot_group))

# --- Before vs After assassination (Masoud: Jan 12, 2010) ---
assassination_date <- as.Date("2010-01-12")
df_use <- ut %>%
  mutate(
    time_period = if_else(publication_month < assassination_date,
                          "Before Assassination", "After Assassination"),
    time_period = factor(time_period, levels = c("Before Assassination","After Assassination")),
    plot_group  = factor(plot_group, levels = c("UT Nuclear","Masoud exclusive","UT Other"))
  )

# --- Poisson model ---
out <- glm(n_pubs ~ plot_group * time_period, data = df_use, family = poisson())

# --- Average predictions (cluster SEs by topic if available) ---
if ("topic" %in% names(df_use)) {
  gg <- avg_predictions(out, variables = c("plot_group","time_period"), vcov = ~ topic)
} else {
  gg <- avg_predictions(out, variables = c("plot_group","time_period"), vcov = "HC3")
}

# --- Plot (similar style) ---
pd <- position_dodge(width = 0.25)

p_masoud <- ggplot(gg, aes(x = time_period, y = estimate,
                           ymin = conf.low, ymax = conf.high,
                           color = plot_group)) +
  geom_pointrange(position = pd, linewidth = 1) +
  scale_color_manual(values = c(
    "UT Nuclear"       = "black",
    "Masoud exclusive" = "darkolivegreen",   # near-black
    "UT Other"         = "#7A7A7A"    # green
  )) +
  coord_cartesian(ylim = c(0, 0.55)) +
  labs(
    title   = "Change in Scientific Output after Assassination",
    x       = NULL,
    y       = "Predicted Publications per Month",
    color   = NULL,
    caption = "95% CI calculated using standard errors clustered by topic."
  ) +
  theme_minimal() +
  theme(
    legend.position       = "bottom",
    axis.text.x           = element_text(angle = 0, hjust = 0.5),
    plot.caption.position = "plot",
    plot.caption          = element_text(hjust = 1, size = 9)
  )

p_masoud

# Optional: save
ggsave(file.path("/standard/nsdpi_storage/people/czj9zj/DiD_data_3topic", "plots/masoud_assassination_before_after.png"),
       p_masoud, width = 8, height = 6, dpi = 300)
library(dplyr)
library(stringr)
library(broom)
library(sandwich)
library(lmtest)
library(gt)

## 1) Robust VCOV (cluster by topic if present; otherwise HC3)
if ("topic" %in% names(df_use)) {
  vc <- sandwich::vcovCL(out, cluster = df_use$topic)
  cap <- "95% CI and p-values use standard errors clustered by topic."
  n_clusters <- dplyr::n_distinct(df_use$topic)
} else {
  vc <- sandwich::vcovHC(out, type = "HC3")
  cap <- "95% CI and p-values use HC3 robust standard errors."
  n_clusters <- NA_integer_
}

## 2) Tidy results with robust SEs
ct <- lmtest::coeftest(out, vcov. = vc)

tbl <- broom::tidy(ct) %>%
  mutate(
    IRR     = exp(estimate),
    CI_low  = exp(estimate - 1.96 * std.error),
    CI_high = exp(estimate + 1.96 * std.error),
    `95% CI` = sprintf("[%.3f, %.3f]", CI_low, CI_high),
    Term = term %>%
      str_replace("^\\(Intercept\\)$", "(Intercept)") %>%
      str_replace("^plot_group", "Group: ") %>%
      str_replace("^time_period", "Period: ") %>%
      str_replace(":", " × ")
  ) %>%
  transmute(
    Term,
    IRR,
    `Std. Error` = std.error,
    `z` = statistic,
    `p-value` = p.value,
    `95% CI`
  )

## 3) Pretty table
gt_tbl <- gt(tbl) %>%
  fmt_number(columns = c(IRR, `Std. Error`, z, `p-value`), decimals = 3) %>%
  tab_header(
    title = md("**Poisson GLM — Incidence Rate Ratios (IRR)**"),
    subtitle = paste0(
      "Outcome: monthly publication counts; N = ", nrow(df_use),
      if (!is.na(n_clusters)) paste0("; Clusters (topic) = ", n_clusters) else ""
    )
  ) %>%
  tab_source_note(cap)

gt_tbl
Poisson GLM — Incidence Rate Ratios (IRR)
Outcome: monthly publication counts; N = 1257048; Clusters (topic) = 4108
Term IRR Std. Error z p-value 95% CI
(Intercept) 0.144 0.253 −7.671 0.000 [0.088, 0.236]
Group × Masoud exclusive 1.086 0.304 0.270 0.787 [0.598, 1.971]
Group × UT Other 0.532 0.255 −2.474 0.013 [0.323, 0.877]
Period × After Assassination 2.010 0.194 3.602 0.000 [1.375, 2.939]
Group × Masoud exclusive:time_periodAfter Assassination 1.386 0.259 1.260 0.207 [0.834, 2.301]
Group × UT Other:time_periodAfter Assassination 2.124 0.196 3.850 0.000 [1.447, 3.116]
95% CI and p-values use standard errors clustered by topic.
base_path <- "/standard/nsdpi_storage/people/czj9zj/DiD_data_3topic/extra_data"

#saveRDS(masoud_exclusive_topic, file.path(base_path, "masoud_exclusive_topic.rds"))

# Masoud set (one column 'topic')
masoud_set <- masoud_exclusive_topic %>%
  transmute(topic = str_trim(as.character(topic))) %>%
  distinct() %>% pull(topic)

# Load UT data and build two groups from membership (NOT topic_condition)
ut <- read_rds(file.path(base_path, "ut_clean_did.rds")) %>%
  mutate(
    topic = str_trim(as.character(topic)),
    publication_month = as.Date(publication_month),
    plot_group = if_else(topic %in% masoud_set, "UT Quantum Physics", "UT Other")
  ) %>%
  filter(publication_month < as.Date("2015-01-01")) %>%    # pre-2015 only
  select(topic, publication_month, n_pubs, plot_group)     # keep essentials

# Avoid 'group' var name conflict if it exists
if ("group" %in% names(ut)) ut <- rename(ut, group_var = group)

# Before vs After assassination (Masoud: 2010-01-12)
assassination_cut <- as.Date("2010-01-12")  # or "2010-01-01" / "2010-02-01" per your convention

df_use <- ut %>%
  mutate(
    time_period = if_else(publication_month < assassination_cut,
                          "Before Assassination", "After Assassination"),
    time_period = factor(time_period, levels = c("Before Assassination","After Assassination")),
    plot_group  = factor(plot_group,  levels = c("UT Quantum Physics","UT Other"))
  )

# Poisson model
out <- glm(n_pubs ~ plot_group * time_period, data = df_use, family = poisson())

# Average predictions (cluster by topic if available)
gg <- if ("topic" %in% names(df_use)) {
  marginaleffects::avg_predictions(out, variables = c("plot_group","time_period"), vcov = ~ topic)
} else {
  marginaleffects::avg_predictions(out, variables = c("plot_group","time_period"), vcov = "HC3")
}

# Plot (UT colors)
pd <- position_dodge(width = 0.25)
p <- ggplot(gg, aes(time_period, estimate, ymin = conf.low, ymax = conf.high, color = plot_group)) +
  geom_pointrange(position = pd, linewidth = 1) +
  scale_color_manual(values = c("UT Quantum Physics" = "#57C4E5", "UT Other" = "#212738")) +
  labs(
    title   = "Change in Scientific Output after Assasination",
    x = NULL, y = "Predicted Publications per Month", color = NULL,
    caption = "95% CI calculated using standard errors clustered by topic."
  ) +
  theme_minimal() +
  theme(
    legend.position       = "bottom",
    plot.caption.position = "plot",
    plot.caption          = element_text(hjust = 1, size = 9)
  )

print(p)

library(dplyr)
library(tidyr)
library(lubridate)
library(ggplot2)
library(marginaleffects)
library(patchwork)

# 0) Colors (to match your look)
col_core  <- "#57C4E5"  # light blue (core)
col_other <- "#212738"  # near-black (other)


file_path <- "/standard/nsdpi_storage/people/czj9zj/DiD_data_3topic/extra_data/shahid_beheshti_university_cleanedLONG.rds"

# Read the RDS file
shahid_beheshti_university_cleanedLONG <- readRDS(file_path)

# 1) Load SBU long
sbu_long <- shahid_beheshti_university_cleanedLONG %>%
  filter(institution == "Shahid Beheshti University") %>%
  mutate(publication_month = floor_date(as.Date(publication_date), "month"))

# 2) Define the "Core nuclear physics areas" topic set (Majid ∩ Abbasi)
core_topics <- intersect(unique(majid_works_long$topic),
                         unique(abbasi_works_long$topic))

# 3) Count publications per topic × month
topic_month_counts <- sbu_long %>%
  count(topic, publication_month, name = "n_pubs")

# 4) Complete a full panel (every topic across the full month range)
all_topics <- unique(topic_month_counts$topic)
month_seq  <- seq.Date(as.Date("2000-01-01"), as.Date("2025-06-01"), by = "month")

panel_sbu <- tidyr::crossing(
  topic = all_topics,
  publication_month = month_seq
) %>%
  left_join(topic_month_counts, by = c("topic","publication_month")) %>%
  mutate(
    n_pubs = tidyr::replace_na(n_pubs, 0),
    area   = if_else(topic %in% core_topics, "Core nuclear physics areas", "All other areas"),
    area   = factor(area, levels = c("Core nuclear physics areas","All other areas")),
    time_period = if_else(publication_month < as.Date("2010-11-29"),
                          "Before Assassination", "After Assassination"),
    time_period = factor(time_period, levels = c("Before Assassination","After Assassination")),
    tr = ifelse(area == "Core nuclear physics areas" & time_period == "After Assassination", 1, 0)
  ) %>%
  filter(publication_month >= as.Date("2005-11-29"),
         publication_month <= as.Date("2015-11-29"))


sbu_fit <- glm(n_pubs ~ area * time_period, data = panel_sbu, family = poisson())

# Average predictions for the 2×2 cells; cluster SEs by topic (good practice)
pred_df <- marginaleffects::avg_predictions(
  sbu_fit,
  variables = c("area","time_period"),
  vcov = ~ topic
)
p_dot <- ggplot(pred_df,
                aes(x = time_period, y = estimate,
                    ymin = conf.low, ymax = conf.high,
                    color = area)) +
  geom_pointrange(position = position_dodge(width = 0.35), linewidth = 1) +
  scale_color_manual(values = c("Core nuclear physics areas" = col_core,
                                "All other areas"            = col_other)) +
  labs(
    title = "(B) Differences in academic productivity by area",
    y = "Predicted Publications per Topic·Month",
    x = NULL, color = NULL
  ) +
  coord_cartesian(ylim = c(0, max(pred_df$conf.high) * 1.05)) +
  theme_minimal(base_size = 13) +
  theme(legend.position = "none")
monthly_publication_rate <- sbu_long %>%
  mutate(area = if_else(topic %in% core_topics, "Core nuclear physics areas", "All other areas")) %>%
  count(area, publication_month, name = "n") %>%
  filter(publication_month > as.Date("2000-01-01"),
         publication_month < as.Date("2020-01-01"))

p_ts <- ggplot(
  transform(monthly_publication_rate,
            area = factor(area, levels = c("Core nuclear physics areas","All other areas"))),
  aes(x = publication_month, y = n, color = area)) +
  geom_smooth(method = "loess", span = 0.3, se = FALSE, linewidth = 1.25) +
  scale_color_manual(values = c("Core nuclear physics areas" = col_core,
                                "All other areas"            = col_other)) +
  facet_grid(rows = vars(area), scales = "free") +
  theme_classic(base_size = 13) +
  theme(
    strip.background = element_rect(color = "white", linewidth = 0),
    legend.position  = "none",
    axis.text.x      = element_text(angle = 60, hjust = 1)
  ) +
  labs(
    title = "(A) Publication Rate at Shahid Beheshti University",
    y = "Monthly Publication Count", x = NULL
  ) +
  scale_x_date(date_breaks = "2 year", date_labels = "%Y") +
  geom_vline(xintercept=as.numeric(as.Date('2010-11-29')), linetype='solid', color='#F97068') +
  geom_text(x = as.numeric(as.Date('2011-03-12')), y = 120, label = "M. Shahriari assassinated", angle=90, color='#F97068', check_overlap = TRUE, size=2.5)+
  geom_vline(xintercept=as.numeric(as.Date('2015-07-14')), linetype='dashed', color='black') +
  geom_text(x = as.numeric(as.Date('2015-10-14')), y = 120, label = "JCPOA - sanctions lifted", angle=90, color='black', check_overlap = TRUE, size=2.5)

#p_ts

Option 1

9/22/25 - Maura and I talked about 3 options to create the plots.

p_ts_leg <- p_ts + labs(color = "") + theme(legend.position = "bottom")


library(cowplot)
## 
## Attaching package: 'cowplot'
## The following object is masked from 'package:gt':
## 
##     as_gtable
## The following object is masked from 'package:patchwork':
## 
##     align_plots
## The following object is masked from 'package:lubridate':
## 
##     stamp
leg <- cowplot::get_legend(p_ts_leg)
## `geom_smooth()` using formula = 'y ~ x'
p_ts_noleg  <- p_ts  + theme(legend.position = "none")
p_dot_noleg <- p_dot + theme(legend.position = "none")


top_row  <- cowplot::plot_grid(p_ts_noleg, p_dot_noleg, ncol = 2, align = "h")
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Graphs cannot be horizontally aligned unless the axis parameter is
## set. Placing graphs unaligned.
combined <- cowplot::plot_grid(top_row, leg, ncol = 1, rel_heights = c(1, 0.10))

combined

Option 2

monthly_publication_rate <- sbu_long %>%
  mutate(area = if_else(topic %in% core_topics, "Core nuclear physics areas", "All other areas")) %>%
  count(area, publication_month, name = "n") %>%
  filter(publication_month > as.Date("2005-01-01"),
         publication_month < as.Date("2015-01-01"))

p_ts <- ggplot(
  transform(monthly_publication_rate,
            area = factor(area, levels = c("Core nuclear physics areas","All other areas"))),
  aes(x = publication_month, y = n, color = area)) +
  geom_smooth(method = "loess", span = 0.3, se = FALSE, linewidth = 1.25) +
  scale_color_manual(values = c("Core nuclear physics areas" = col_core,
                                "All other areas"            = col_other)) +
  facet_grid(rows = vars(area), scales = "free") +
  theme_classic(base_size = 13) +
  theme(
    strip.background = element_rect(color = "white", linewidth = 0),
    legend.position  = "none",
    axis.text.x      = element_text(angle = 60, hjust = 1)
  ) +
  labs(
    title = "(A) Publication Rate at Shahid Beheshti University",
    y = "Monthly Publication Count", x = NULL
  ) +
  scale_x_date(date_breaks = "1 year", date_labels = "%Y") +
  geom_vline(xintercept=as.numeric(as.Date('2010-11-29')), linetype='solid', color='#F97068') +
  geom_text(x = as.numeric(as.Date('2011-03-12')), y = 120, label = "M. Shahriari assassinated", angle=90, color='#F97068', check_overlap = TRUE, size=2.5)+
  geom_vline(xintercept=as.numeric(as.Date('2015-07-14')), linetype='dashed', color='black') +
  geom_text(x = as.numeric(as.Date('2015-10-14')), y = 120, label = "JCPOA - sanctions lifted", angle=90, color='black', check_overlap = TRUE, size=2.5)

#p_ts
p_ts_leg <- p_ts + labs(color = "Areas") + theme(legend.position = "bottom")


library(cowplot)
leg <- cowplot::get_legend(p_ts_leg)
## `geom_smooth()` using formula = 'y ~ x'
p_ts_noleg  <- p_ts  + theme(legend.position = "none")
p_dot_noleg <- p_dot + theme(legend.position = "none")


top_row  <- cowplot::plot_grid(p_ts_noleg, p_dot_noleg, ncol = 2, align = "h")
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Graphs cannot be horizontally aligned unless the axis parameter is
## set. Placing graphs unaligned.
combined <- cowplot::plot_grid(top_row, leg, ncol = 1, rel_heights = c(1, 0.10))

combined

meta_df <- readRDS("/standard/nsdpi_storage/people/czj9zj/DiD_data_3topic/meta_df.rds")
meta_output <- readRDS("/standard/nsdpi_storage/people/czj9zj/DiD_data_3topic/meta_output.rds")
new_names <- c(
  "Shahid Beheshti - Nuclear Physics\nvs \nShahid Beheshti - Nontargeted topics",
  "Shahid Beheshti University of Medical Sciences - Nuclear Physics\nvs \nShahid Beheshti University of Medical Sciences - Nontargeted topics", 
  "Tehran - Quantum\nvs \nTehran - Nontargeted topics",
  "Shiraz - Electromagnetic\nvs \nShiraz - Nontargeted topics"
)


# Replace the comparison column values
meta_df$comparison <- new_names

# Then reorder rows 3 and 4
meta_df <- meta_df[c(1, 2, 4, 3), ]
library(dplyr)
library(ggplot2)
library(metafor)
## Loading required package: Matrix
## 
## Attaching package: 'Matrix'
## The following objects are masked from 'package:tidyr':
## 
##     expand, pack, unpack
## Loading required package: metadat
## Loading required package: numDeriv
## 
## Loading the 'metafor' package (version 4.8-0). For an
## introduction to the package please type: help(metafor)
# --- Fit FE model
fit <- rma.uni(yi = standard_est, sei = standard_se, data = meta_df, method = "FE")

# --- Build plotting df
studies <- meta_df %>%
  transmute(
    study = comparison,
    est   = standard_est,
    se    = standard_se,
    lo    = est - 1.96 * se,
    hi    = est + 1.96 * se,
    type  = "Study"
  )

overall <- tibble(
  study = "Meta-analysis estimate (FE Model)",   # <-- rename here
  est   = unname(fit$b[1]),
  se    = fit$se,
  lo    = unname(fit$ci.lb),
  hi    = unname(fit$ci.ub),
  type  = "Overall"
)

plot_df <- bind_rows(studies, overall) %>%
  mutate(ci_label = sprintf("%.2f [%.2f, %.2f]", est, lo, hi))

# FE at bottom; studies above in their original order
level_order <- c("Meta-analysis estimate (FE Model)", rev(studies$study))
plot_df$study <- factor(plot_df$study, levels = level_order)

# Right-side label position and x-range
pad <- diff(range(c(plot_df$lo, plot_df$hi))) * 0.05
x_left  <- min(plot_df$lo) - pad
x_right <- max(plot_df$hi) + pad
x_label_pos <- x_right + pad * 4

# Separator y (between FE row and the first study)
y_sep <- 1.5

# --- Plot (bigger dots/lines/text, no cropping) ------------------------------
p_forest <- ggplot(plot_df, aes(y = study, x = est)) +
  scale_y_discrete(limits = level_order) +
  geom_vline(xintercept = 0, linetype = "dashed", linewidth = 0.9) +

  # Study CIs: thicker black
  geom_segment(
    data = dplyr::filter(plot_df, type == "Study"),
    aes(x = lo, xend = hi, y = study, yend = study),
    color = "black", linewidth = 1.2
  ) +
  # Meta-analysis CI: thicker red
  geom_segment(
    data = dplyr::filter(plot_df, type == "Overall"),
    aes(x = lo, xend = hi, y = study, yend = study),
    color = "#d62728", linewidth = 1.4
  ) +
  # Points: larger
  geom_point(
    data = dplyr::filter(plot_df, type == "Study"),
    shape = 21, size = 5.2, stroke = 1.1, fill = "black", color = "black"
  ) +
  geom_point(
    data = dplyr::filter(plot_df, type == "Overall"),
    shape = 23, size = 5.2, stroke = 1.1, fill = "#d62728", color = "#d62728"
  ) +
geom_segment(
  data = data.frame(y_sep = y_sep),
  aes(y = y_sep, yend = y_sep,
      x = x_left - 0.5,     # extend 0.5 units more to the left
      xend = x_right + 0.5  # extend 0.5 units more to the right
  ),
  inherit.aes = FALSE,
  color = "grey40", linewidth = 0.6
  ) +
  geom_text(
  data = plot_df,
  aes(label = ci_label),
  x = x_label_pos, 
  hjust = 1,
  family = "mono", # <<< monospaced
  color = "grey20", size = 8
)+
  labs(x = "Standardized Effect (95% CI)", y = NULL) +
  # more space on the right for labels; keep panel unclipped
  coord_cartesian(xlim = c(x_left, x_right + 3*pad), clip = "off") +
  theme_minimal(base_size = 22) +   # larger text overall
  theme(
    legend.position = "none",
    panel.grid.major.y = element_blank(),
    panel.grid.minor = element_blank(),
    plot.title = element_text(face = "bold", hjust = 0.5, size = 25),
    axis.text.y = element_text(size = 22),
    axis.text.x = element_text(size = 22),
    plot.margin = margin(t = 10, r = 40, b = 10, l = 10)  # extra right margin
  )

p_plot <- p_forest + theme(aspect.ratio = 1, axis.text.y = element_text(family = "mono", hjust = .5))

# Save WITHOUT changing your existing size; no cropping now due to clip='off' + margin
ggsave(
  file.path("/standard/nsdpi_storage/people/czj9zj/plots/forest_plot.png"),
  p_plot,
  width = 26, height = 10, dpi = 300
)

p_plot

Final DiD Analysis

## Setup and Libraries
library(marginaleffects)
library(cowplot)
library(sandwich)
library(lmtest)
library(metafor)

# Colors
col_core  <- "#57C4E5"
col_other <- "#212738"

# Paths for each university
sbu_path <- "/standard/nsdpi_storage/people/czj9zj/DiD_data_3topic/extra_data/shahid_beheshti_university_cleanedLONG.rds"
tehran_path <- "/standard/nsdpi_storage/people/czj9zj/DiD_data_3topic/extra_data/universityOfTehran_cleanedLONG.rds"
shiraz_path <- "/standard/nsdpi_storage/people/czj9zj/extra_data/shiraz_university_cleanedLONG.rds"
out_dir <- "/standard/nsdpi_storage/people/czj9zj/plots"

Pilot Study Plots

SBU

# Load data
shahid_beheshti_university_cleanedLONG <- readRDS(sbu_path)

sbu_long <- shahid_beheshti_university_cleanedLONG %>%
  filter(institution == "Shahid Beheshti University") %>%
  mutate(publication_month = floor_date(as.Date(publication_date), "month"))

# Define core topics
core_topics <- intersect(unique(majid_works_long$topic), unique(abbasi_works_long$topic))

# Create SBU panel
topic_month_counts <- sbu_long %>%
  count(topic, publication_month, name = "n_pubs")

all_topics <- unique(topic_month_counts$topic)
month_seq <- seq.Date(as.Date("2000-01-01"), as.Date("2025-06-01"), by = "month")

panel_sbu <- tidyr::crossing(
  topic = all_topics,
  publication_month = month_seq
) %>%
  left_join(topic_month_counts, by = c("topic","publication_month")) %>%
  mutate(
    n_pubs = tidyr::replace_na(n_pubs, 0),
    area = if_else(topic %in% core_topics, "Core nuclear physics areas", "All other areas"),
    area = factor(area, levels = c("Core nuclear physics areas","All other areas")),
    time_period = if_else(publication_month < as.Date("2010-11-29"),
                          "Before Assassination", "After Assassination"),
    time_period = factor(time_period, levels = c("Before Assassination","After Assassination")),
    tr = ifelse(area == "Core nuclear physics areas" & time_period == "After Assassination", 1, 0)
  ) %>%
  filter(publication_month >= as.Date("2005-11-29"),
         publication_month <= as.Date("2015-11-29"))

# Fit SBU model
sbu_fit <- glm(n_pubs ~ area * time_period, data = panel_sbu, family = poisson())

# Create SBU plots
pred_df_sbu <- marginaleffects::avg_predictions(
  sbu_fit,
  variables = c("area","time_period"),
  vcov = ~ topic
)

p_dot_sbu <- ggplot(pred_df_sbu,
                aes(x = time_period, y = estimate,
                    ymin = conf.low, ymax = conf.high,
                    color = area)) +
  geom_pointrange(position = position_dodge(width = 0.35), linewidth = 1) +
  scale_color_manual(values = c("Core nuclear physics areas" = col_core,
                                "All other areas" = col_other)) +
  labs(
    title = "(B) Differences in academic productivity by area",
    y = "Predicted Publications per Topic·Month",
    x = NULL, color = NULL
  ) +
  coord_cartesian(ylim = c(0, max(pred_df_sbu$conf.high) * 1.05)) +
  theme_minimal(base_size = 13) +
  theme(legend.position = "none")

monthly_publication_rate_sbu <- sbu_long %>%
  mutate(area = if_else(topic %in% core_topics, "Core nuclear physics areas", "All other areas")) %>%
  count(area, publication_month, name = "n") %>%
  filter(publication_month > as.Date("2000-01-01"),
         publication_month < as.Date("2020-01-01"))

p_ts_sbu <- ggplot(
  transform(monthly_publication_rate_sbu,
            area = factor(area, levels = c("Core nuclear physics areas","All other areas"))),
  aes(x = publication_month, y = n, color = area)) +
  annotate("rect",
           xmin = as.Date("2005-11-29"),
           xmax = as.Date("2015-11-29"),
           ymin = -Inf, ymax = Inf,
           fill = "#F97068", alpha = 0.10, color = NA) +
  geom_smooth(method = "loess", span = 0.3, se = FALSE, linewidth = 1.25) +
  scale_color_manual(values = c("Core nuclear physics areas" = col_core,
                                "All other areas" = col_other)) +
  facet_grid(rows = vars(area), scales = "free") +
  theme_classic(base_size = 13) +
  theme(
    strip.background = element_rect(color = "white", linewidth = 0),
    legend.position = "none",
    axis.text.x = element_text(angle = 60, hjust = 1)
  ) +
  labs(
    title = "Publication Rate at Shahid Beheshti University",
    y = "Monthly Publication Count", x = NULL
  ) +
  scale_x_date(date_breaks = "2 year", date_labels = "%Y") +
  geom_vline(xintercept=as.numeric(as.Date('2010-11-29')), linetype='solid', color='#F97068') +
  geom_text(x = as.numeric(as.Date('2011-03-12')), y = 120, label = "M. Shahriari assassinated", angle=90, color='#F97068', check_overlap = TRUE, size=2.5)

# Combine SBU plots
p_ts_leg_sbu <- p_ts_sbu + labs(color = "Areas") + theme(legend.position = "bottom")
leg_sbu <- cowplot::get_legend(p_ts_leg_sbu)
## `geom_smooth()` using formula = 'y ~ x'
p_ts_noleg_sbu <- p_ts_sbu + theme(legend.position = "none")
p_dot_noleg_sbu <- p_dot_sbu + theme(legend.position = "none")

top_row_sbu <- cowplot::plot_grid(
  p_ts_noleg_sbu, p_dot_noleg_sbu,
  ncol = 2, rel_widths = c(2, 1), align = "h", axis = "tb"
)
## `geom_smooth()` using formula = 'y ~ x'
combined_sbu <- cowplot::plot_grid(top_row_sbu, leg_sbu, ncol = 1, rel_heights = c(1, 0.10))

ggsave(file.path(out_dir, "sbu_combo.png"), combined_sbu, width = 21, height = 14, units = "in", dpi = 300, bg = "white")
combined_sbu

SBU vs SBMU

# Create SBU vs SBMU panel
core_only <- shahid_beheshti_university_cleanedLONG %>%
  filter(topic %in% core_topics) %>%
  mutate(publication_month = floor_date(as.Date(publication_date), "month"))

topic_month_counts_inst <- core_only %>%
  count(institution, topic, publication_month, name = "n_pubs")

inst_levels <- c("Shahid Beheshti University", "Shahid Beheshti Medical")
core_topics_only <- sort(unique(core_only$topic))  # Fixed variable name
month_seq <- seq(as.Date("2005-11-29"), as.Date("2015-11-29"), by = "month")

panel_sbu_sbmu <- tidyr::crossing(
  institution = factor(inst_levels, levels = inst_levels),
  topic = core_topics_only,  # Fixed variable name
  publication_month = month_seq
) %>%
  left_join(topic_month_counts_inst, by = c("institution","topic","publication_month")) %>%
  mutate(
    n_pubs = replace_na(n_pubs, 0),
    time_period = factor(if_else(publication_month < as.Date("2010-11-29"),
                                 "Before Assassination", "After Assassination"),
                         levels = c("Before Assassination","After Assassination")),
    tr = ifelse(institution == "Shahid Beheshti University" & time_period == "After Assassination", 1, 0)
  )

# Fit SBU vs SBMU model
sbu_sbmu_fit <- glm(n_pubs ~ institution * time_period, data = panel_sbu_sbmu, family = poisson())

# Create SBU vs SBMU plots
pred_df_inst <- marginaleffects::avg_predictions(
  sbu_sbmu_fit,
  variables = c("institution", "time_period"),
  vcov = ~ topic
)

p_dot_sbmu <- ggplot(pred_df_inst,
                aes(x = time_period, y = estimate,
                    ymin = conf.low, ymax = conf.high,
                    color = institution)) +
  geom_pointrange(position = position_dodge(width = 0.35), linewidth = 1) +
  scale_color_manual(values = c("Shahid Beheshti University" = "#57C4E5",
                                "Shahid Beheshti Medical" = "#8AEA92")) +
  labs(
    title = "(B) Differences in academic productivity by institution",
    y = "Predicted Publications per Topic·Month",
    x = NULL, color = NULL
  ) +
  coord_cartesian(ylim = c(0, max(pred_df_inst$conf.high) * 1.05)) +
  theme_minimal(base_size = 13) +
  theme(legend.position = "none")

monthly_publication_rate_inst <- shahid_beheshti_university_cleanedLONG %>%
  mutate(publication_month = floor_date(as.Date(publication_date), "month")) %>%
  filter(topic %in% core_topics) %>%
  distinct(id, publication_month, institution) %>%
  filter(publication_month > as.Date("2000-11-29"),
         publication_month < as.Date("2020-11-29")) %>%
  count(institution, publication_month, name = "n")

p_ts_sbmu <- ggplot(
  transform(
    monthly_publication_rate_inst,
    institution = factor(institution, levels = c("Shahid Beheshti University", "Shahid Beheshti Medical"))
  ),
  aes(x = publication_month, y = n, color = institution)
) +
  annotate("rect",
           xmin = as.Date("2005-11-29"),
           xmax = as.Date("2015-11-29"),
           ymin = -Inf, ymax = Inf,
           fill = "#F97068", alpha = 0.10, color = NA) +
  geom_smooth(method = "loess", span = 0.3, se = FALSE, linewidth = 1.25) +
  scale_color_manual(values = c(
    "Shahid Beheshti University" = "#57C4E5",
    "Shahid Beheshti Medical" = "#8AEA92"
  )) +
  theme_classic(base_size = 13) +
  theme(
    legend.position = "bottom",
    legend.title = element_blank(),
    axis.text.x = element_text(angle = 60, hjust = 1)
  ) +
  labs(
    title = "(A) Total Publication Count over Time",
    y = "Monthly Publication Count", x = NULL
  ) +
  scale_x_date(date_breaks = "2 year", date_labels = "%Y") +
  geom_vline(xintercept=as.numeric(as.Date('2010-11-29')), linetype='solid', color='#F97068') +
  geom_text(x = as.numeric(as.Date('2011-03-12')), y = 6.5, label = "M. Shahriari assassinated", angle=90, color='#F97068', check_overlap = TRUE, size=3)

# Combine SBU vs SBMU plots
p_ts_leg_sbmu <- p_ts_sbmu + labs(color = "Areas") + theme(legend.position = "bottom")
leg_sbmu <- cowplot::get_legend(p_ts_leg_sbmu)
## `geom_smooth()` using formula = 'y ~ x'
pad_plot <- function(p, bottom_extra = 10){
  p +
    theme(
      legend.position = "none",
      plot.background = element_rect(fill = "white", color = NA),
      panel.background = element_rect(fill = "white", color = NA),
      plot.margin = margin(10, 12, bottom_extra, 12)
    )
}

p_ts_noleg_sbmu <- pad_plot(p_ts_sbmu, 10)
p_dot_noleg_sbmu <- pad_plot(p_dot_sbmu, 24)

top_row_sbmu <- cowplot::plot_grid(p_ts_noleg_sbmu, p_dot_noleg_sbmu,
                               ncol = 2, rel_widths = c(2, 1),
                               align = "h", axis = "tb")
## `geom_smooth()` using formula = 'y ~ x'
combined_sbu_sbmu <- cowplot::plot_grid(top_row_sbmu, leg_sbmu, ncol = 1, rel_heights = c(1, 0.10))

ggsave(file.path(out_dir, "sbu_sbmu_combo.png"), combined_sbu_sbmu, width = 21, height = 14, units = "in", dpi = 300, bg = "white")
combined_sbu_sbmu

UT

# Load Tehran data
ut_long <- readRDS(tehran_path) %>%
  filter(institution == "University of Tehran") %>%
  mutate(publication_month = floor_date(as.Date(publication_date), "month"))

# Define Masoud topics
masoud_topics <- unique(masoud_works_long$topic)

# Create Tehran panel
topic_month_counts <- ut_long %>%
  count(topic, publication_month, name = "n_pubs")

all_topics <- unique(topic_month_counts$topic)
month_seq <- seq.Date(as.Date("2000-01-01"), as.Date("2025-06-01"), by = "month")

panel_utehran <- tidyr::crossing(
  topic = all_topics,
  publication_month = month_seq
) %>%
  left_join(topic_month_counts, by = c("topic","publication_month")) %>%
  mutate(
    n_pubs = tidyr::replace_na(n_pubs, 0),
    area = if_else(topic %in% masoud_topics, "Quantum physics areas", "All other areas"),
    area = factor(area, levels = c("Quantum physics areas","All other areas")),
    time_period = if_else(publication_month < as.Date("2010-01-12"),
                          "Before Assassination", "After Assassination"),
    time_period = factor(time_period, levels = c("Before Assassination","After Assassination")),
    tr = ifelse(area == "Quantum physics areas" & time_period == "After Assassination", 1, 0)
  ) %>%
  filter(publication_month >= as.Date("2005-01-12"),
         publication_month <= as.Date("2015-01-12"))

# Fit Tehran model
utehran_fit <- glm(n_pubs ~ area * time_period, data = panel_utehran, family = poisson())

# Create Tehran plots
pred_df_tehran <- marginaleffects::avg_predictions(
  utehran_fit,
  variables = c("area","time_period"),
  vcov = ~ topic
)

p_dot_tehran <- ggplot(pred_df_tehran,
                aes(x = time_period, y = estimate,
                    ymin = conf.low, ymax = conf.high,
                    color = area)) +
  geom_pointrange(position = position_dodge(width = 0.35), linewidth = 1) +
  scale_color_manual(values = c("Quantum physics areas" = col_core,
                                "All other areas" = col_other)) +
  labs(
    title = "(B) Differences in academic productivity by area",
    y = "Predicted Publications per Topic·Month",
    x = NULL, color = NULL
  ) +
  coord_cartesian(ylim = c(0, max(pred_df_tehran$conf.high) * 1.05)) +
  theme_minimal(base_size = 13) +
  theme(legend.position = "none")

monthly_publication_rate_tehran <- ut_long %>%
  mutate(area = if_else(topic %in% masoud_topics, "Quantum physics areas", "All other areas")) %>%
  count(area, publication_month, name = "n") %>%
  filter(publication_month > as.Date("2000-01-12"),
         publication_month < as.Date("2020-01-12"))

p_ts_tehran <- ggplot(
  transform(monthly_publication_rate_tehran,
            area = factor(area, levels = c("Quantum physics areas","All other areas"))),
  aes(x = publication_month, y = n, color = area)) +
  annotate("rect",
           xmin = as.Date("2005-01-12"),
           xmax = as.Date("2015-01-12"),
           ymin = -Inf, ymax = Inf,
           fill = "#F97068", alpha = 0.10, color = NA) +
  geom_smooth(method = "loess", span = 0.3, se = FALSE, linewidth = 1.25) +
  scale_color_manual(values = c("Quantum physics areas" = col_core,
                                "All other areas" = col_other)) +
  facet_grid(rows = vars(area), scales = "free") +
  theme_classic(base_size = 13) +
  theme(
    strip.background = element_rect(color = "white", linewidth = 0),
    legend.position = "none",
    axis.text.x = element_text(angle = 60, hjust = 1)
  ) +
  labs(
    title = "Publication Rate at University of Tehran",
    y = "Monthly Publication Count", x = NULL
  ) +
  scale_x_date(date_breaks = "2 year", date_labels = "%Y") +
  geom_vline(xintercept = as.numeric(as.Date("2010-01-12")),
             linetype = "solid", color = "#F97068") +
  geom_text(x = as.numeric(as.Date("2010-04-12")), y = 300,
            label = "M. Alimohammadi assassinated",
            angle = 90, color = "#F97068",
            check_overlap = TRUE, size = 2.5)

# Combine Tehran plots
p_ts_leg_tehran <- p_ts_tehran + labs(color = "Areas") + theme(legend.position = "bottom")
leg_tehran <- cowplot::get_legend(p_ts_leg_tehran)
## `geom_smooth()` using formula = 'y ~ x'
p_ts_noleg_tehran <- p_ts_tehran + theme(legend.position = "none")
p_dot_noleg_tehran <- p_dot_tehran + theme(legend.position = "none")

top_row_tehran <- cowplot::plot_grid(
  p_ts_noleg_tehran, p_dot_noleg_tehran,
  ncol = 2, rel_widths = c(2, 1), align = "h", axis = "tb"
)
## `geom_smooth()` using formula = 'y ~ x'
combined_utehran <- cowplot::plot_grid(top_row_tehran, leg_tehran, ncol = 1, rel_heights = c(1, 0.10))

ggsave(file.path(out_dir, "tehran_combo.png"), combined_utehran, width = 21, height = 14, units = "in", dpi = 300, bg = "white")
combined_utehran

US

# Setup
event_date <- as.Date("2007-01-15")

# Load Shiraz data
shiraz_university_long <- readRDS(file.path(data_path, "shiraz_university_cleanedLONG.rds")) %>%
  mutate(publication_month = floor_date(as.Date(publication_date), "month"))

# Define Hosseinpour topics
hosseinpour_topics <- unique(hosseinpour_works_long$topic)

# Create Shiraz panel
topic_month_counts <- shiraz_university_long %>%
  count(topic, publication_month, name = "n_pubs")

month_seq <- seq.Date(as.Date("2000-01-01"), as.Date("2025-06-01"), by = "month")

panel_ushiraz <- tidyr::crossing(
  topic = unique(topic_month_counts$topic),
  publication_month = month_seq
) %>%
  left_join(topic_month_counts, by = c("topic","publication_month")) %>%
  mutate(
    n_pubs = tidyr::replace_na(n_pubs, 0),
    area = if_else(topic %in% hosseinpour_topics,
                   "Electromagnetism physics areas", "All other areas"),
    area = factor(area, levels = c("Electromagnetism physics areas","All other areas")),
    time_period = if_else(publication_month < event_date,
                          "Before Assassination", "After Assassination"),
    time_period = factor(time_period, levels = c("Before Assassination","After Assassination")),
    tr = ifelse(area == "Electromagnetism physics areas" & time_period == "After Assassination", 1, 0)
  ) %>%
  filter(publication_month >= as.Date("2002-01-15"),
         publication_month <= as.Date("2012-01-15"))

# Fit Shiraz model
ushiraz_fit <- glm(n_pubs ~ area * time_period, data = panel_ushiraz, family = poisson())

# Create Shiraz plots
pred_df_shiraz <- marginaleffects::avg_predictions(
  ushiraz_fit,
  variables = c("area","time_period"),
  vcov = ~ topic
)

p_dot_shiraz <- ggplot(
  pred_df_shiraz,
  aes(time_period, estimate, ymin = conf.low, ymax = conf.high, color = area)
) +
  geom_pointrange(position = position_dodge(width = 0.35), linewidth = 1) +
  scale_color_manual(values = c("Electromagnetism physics areas" = col_core,
                                "All other areas" = col_other)) +
  labs(
    title = "(B) Differences in academic productivity by area",
    y = "Predicted Publications per Topic·Month", x = NULL, color = NULL
  ) +
  coord_cartesian(ylim = c(0, max(pred_df_shiraz$conf.high) * 1.05)) +
  theme_minimal(base_size = 13) +
  theme(legend.position = "none")

monthly_publication_rate_shiraz <- shiraz_university_long %>%
  mutate(area = if_else(topic %in% hosseinpour_topics,
                        "Electromagnetism physics areas", "All other areas")) %>%
  count(area, publication_month, name = "n") %>%
  filter(publication_month > as.Date("2000-01-01"),
         publication_month < as.Date("2020-01-01"))

p_ts_shiraz <- ggplot(
  transform(monthly_publication_rate_shiraz,
            area = factor(area, levels = c("Electromagnetism physics areas","All other areas"))),
  aes(publication_month, n, color = area)
) +
  annotate("rect",
           xmin = as.Date("2002-01-15"),
           xmax = as.Date("2012-01-15"),
           ymin = -Inf, ymax = Inf,
           fill = "#F97068", alpha = 0.10, color = NA) +
  geom_smooth(method = "loess", span = 0.3, se = FALSE, linewidth = 1.25) +
  scale_color_manual(values = c("Electromagnetism physics areas" = col_core,
                                "All other areas" = col_other)) +
  facet_grid(rows = vars(area), scales = "free") +
  theme_classic(base_size = 13) +
  theme(
    strip.background = element_rect(color = "white", linewidth = 0),
    legend.position = "none",
    axis.text.x = element_text(angle = 60, hjust = 1)
  ) +
  labs(
    title = "Publication Rate at Shiraz University",
    y = "Monthly Publication Count", x = NULL
  ) +
  scale_x_date(date_breaks = "2 year", date_labels = "%Y") +
  geom_vline(xintercept = as.numeric(event_date), linetype = "solid", color = "#F97068") +
  geom_text(x = as.Date("2007-04-15"), y = 250,
            label = "A. Hosseinpour assassinated",
            angle = 90, color = "#F97068", check_overlap = TRUE, size = 2.5)

# Combine Shiraz plots
p_ts_leg_shiraz <- p_ts_shiraz + labs(color = "Areas") + theme(legend.position = "bottom")
leg_shiraz <- cowplot::get_legend(
  p_ts_leg_shiraz + guides(color = guide_legend(override.aes = list(linetype = 0, shape = 15, size = 6)))
)
## `geom_smooth()` using formula = 'y ~ x'
p_ts_noleg_shiraz <- p_ts_shiraz + theme(legend.position = "none")
p_dot_noleg_shiraz <- p_dot_shiraz + theme(legend.position = "none")

top_row_shiraz <- cowplot::plot_grid(
  p_ts_noleg_shiraz, p_dot_noleg_shiraz,
  ncol = 2, rel_widths = c(2, 1), align = "h", axis = "tb"
)
## `geom_smooth()` using formula = 'y ~ x'
combined_ushiraz <- cowplot::plot_grid(top_row_shiraz, leg_shiraz, ncol = 1, rel_heights = c(1, 0.10))

ggsave(file.path(out_dir, "shiraz_combo.png"), combined_ushiraz, width = 21, height = 14, units = "in", dpi = 300, bg = "white")
combined_ushiraz

Meta-Analysis

# Get clustered standard errors
coef_sbu <- coeftest(sbu_fit, vcov = vcovCL, cluster = ~topic)
coef_sbu_sbmu <- coeftest(sbu_sbmu_fit, vcov = vcovCL, cluster = ~topic)
coef_utehran <- coeftest(utehran_fit, vcov = vcovCL, cluster = ~topic)
coef_ushiraz <- coeftest(ushiraz_fit, vcov = vcovCL, cluster = ~topic)

# Create standardization ratios
stand_sbu <- sd(panel_sbu$tr)/sd(panel_sbu$n_pubs)
stand_sbu_sbmu <- sd(panel_sbu_sbmu$tr)/sd(panel_sbu_sbmu$n_pubs)
stand_utehran <- sd(panel_utehran$tr)/sd(panel_utehran$n_pubs)
stand_ushiraz <- sd(panel_ushiraz$tr)/sd(panel_ushiraz$n_pubs)

# Create meta-analysis data frame with final comparison names
meta_df <- data.frame(
  standard_est = c(
    coef_sbu[4,1] * stand_sbu,
    coef_sbu_sbmu[4,1] * stand_sbu_sbmu, 
    coef_utehran[4,1] * stand_utehran,
    coef_ushiraz[4,1] * stand_ushiraz
  ),
  standard_se = c(
    coef_sbu[4,2] * stand_sbu,
    coef_sbu_sbmu[4,2] * stand_sbu_sbmu,
    coef_utehran[4,2] * stand_utehran,
    coef_ushiraz[4,2] * stand_ushiraz
  ),
  comparison = c(
    "Case 1: Nuclear Physics (SBU)",
    "Case 2: Nuclear Physics (SBU v SBUMS)", 
    "Case 3: Quantum Physics (UT)",
    "Case 4: Electromagnetism Physics (SU)"
  )
)

# Save all meta-analysis objects
saveRDS(meta_df, file.path(out_dir, "meta_df.rds"))
meta_df <- readRDS(file.path(out_dir, "meta_df.rds"))


print("Meta-analysis data frame:")
## [1] "Meta-analysis data frame:"
print(meta_df)
##   standard_est standard_se                            comparison
## 1  -0.03093854  0.02482095         Case 1: Nuclear Physics (SBU)
## 2   0.19354136  1.69019773 Case 2: Nuclear Physics (SBU v SBUMS)
## 3   0.03169131  0.01353190          Case 3: Quantum Physics (UT)
## 4  -0.03865605  0.02392722 Case 4: Electromagnetism Physics (SU)
# Conduct meta-analysis
meta_fit <- rma(data = meta_df, yi = standard_est, sei = standard_se, method = "FE")
print(meta_fit)
## 
## Fixed-Effects Model (k = 4)
## 
## I^2 (total heterogeneity / total variability):   67.79%
## H^2 (total variability / sampling variability):  3.10
## 
## Test for Heterogeneity:
## Q(df = 3) = 9.3142, p-val = 0.0254
## 
## Model Results:
## 
## estimate      se    zval    pval    ci.lb   ci.ub    
##   0.0063  0.0106  0.5895  0.5555  -0.0146  0.0271    
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
saveRDS(meta_fit, file.path(out_dir, "meta_fit.rds"))
meta_fit <- readRDS(file.path(out_dir, "meta_fit.rds"))

Forest Plot

# Fit FE model
fit <- rma.uni(yi = standard_est, sei = standard_se, data = meta_df, method = "FE")

# Build plotting data frame efficiently
studies <- meta_df %>%
  mutate(
    lo = standard_est - 1.96 * standard_se,
    hi = standard_est + 1.96 * standard_se,
    type = "Study"
  ) %>%
  select(study = comparison, est = standard_est, se = standard_se, lo, hi, type)

overall <- data.frame(
  study = "Meta-analysis estimate (FE Model)",
  est = as.numeric(fit$b[1]),
  se = fit$se,
  lo = as.numeric(fit$ci.lb),
  hi = as.numeric(fit$ci.ub),
  type = "Overall"
)

plot_df <- rbind(studies, overall) %>%
  mutate(
    ci_label = sprintf("%.2f [%.2f, %.2f]", est, lo, hi),
    study = factor(study, levels = c("Meta-analysis estimate (FE Model)", rev(studies$study)))
  )

# Create forest plot
p_forest <- ggplot(plot_df, aes(y = study, x = est)) +
  geom_vline(xintercept = 0, linetype = "dashed", color = "black", linewidth = 0.5) +
  geom_segment(aes(x = lo, xend = hi, y = study, yend = study, color = type), linewidth = 0.8) +
  geom_point(aes(shape = type, color = type, size = type)) +
  geom_text(aes(label = ci_label, x = 0.25), hjust = 0, size = 3.5, color = "black") +
  geom_hline(yintercept = 1.5, color = "grey60", linewidth = 0.5) +
  scale_color_manual(values = c("Study" = "black", "Overall" = "red")) +
  scale_shape_manual(values = c("Study" = 16, "Overall" = 18)) +
  scale_size_manual(values = c("Study" = 3, "Overall" = 4)) +
  labs(x = "Standardized Effect (95% CI)", y = NULL) +
  scale_x_continuous(limits = c(-1.6, 0.4), breaks = seq(-1.5, 0, 0.5)) +
  theme_classic() +
  theme(
    legend.position = "none",
    axis.text.y = element_text(size = 10, color = "black", hjust = 0),
    axis.text.x = element_text(size = 10, color = "black"),
    axis.title.x = element_text(size = 12, color = "black"),
    axis.line.y = element_blank(),
    axis.ticks.y = element_blank(),
    panel.grid.major = element_blank(),
    panel.grid.minor = element_blank(),
    plot.margin = margin(t = 10, r = 60, b = 10, l = 10)
  )

# Save plot
ggsave(file.path(out_dir, "forest_plotNEW.png"), p_forest, width = 15, height = 6, dpi = 300, bg = "white")
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_segment()`).
p_forest
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_segment()`).