Publications by Enkhbayasgalan Munkhbaatar

Enkhbayasgalan_112035145

09.01.2025

CHAPTER 7 Question 1. library(wooldridge) # Load the dataset data <- as.data.frame(sleep75) # View the first few rows head(data) ## age black case clerical construc educ earns74 gdhlth inlf leis1 leis2 leis3 ## 1 32 0 1 0 0 12 0 0 1 3529 3479 3479 ## 2 31 0 2 0 0 14 9500 1...

5159 sym R (55651 sym/189 pcs) 1 img

Enkhbayasgalan_112035145

12.12.2024

library(wooldridge) library(lmtest) ## Loading required package: zoo ## ## Attaching package: 'zoo' ## The following objects are masked from 'package:base': ## ## as.Date, as.Date.numeric data <- wooldridge::minwage # Part (i): Find the first-order autocorrelation in gwage232 first_order_autocorr <- cor(data$gwage232[-1], data$gwage232[-nrow...

31 sym R (4759 sym/28 pcs)

Enkhbayasgalan_112035145

28.11.2024

library(wooldridge) library(lmtest) ## Loading required package: zoo ## ## Attaching package: 'zoo' ## The following objects are masked from 'package:base': ## ## as.Date, as.Date.numeric library(sandwich) # Load and Subset Data for the Year 1988 data("jtrain", package = "wooldridge") jtrain_1988 <- subset(jtrain, year == 1988) # Check for ...

31 sym R (4423 sym/28 pcs)

Enkhbayasgalan_112035145

21.11.2024

library(lmtest) ## Loading required package: zoo ## ## Attaching package: 'zoo' ## The following objects are masked from 'package:base': ## ## as.Date, as.Date.numeric library(sandwich) library(ggplot2) set.seed(123) # Simulate a dataset if MEAP00 is unavailable MEAP00 <- data.frame( math4 = rnorm(100, mean = 70, sd = 10), lunch = r...

29 sym R (4403 sym/26 pcs)

Enkhbayasgalan_112035145

14.11.2024

library(wooldridge) library(car) ## Loading required package: carData # Load the data data("wage2") # Part (i) # Estimate the model model_1 <- lm(log(wage) ~ educ + exper + tenure + married + black + south + urban, data = wage2) # Summary of the model to get coefficient estimates and significance levels summary(model_1) ## ## Call: ## lm(formula...

15 sym R (6253 sym/12 pcs)

Enkhbayasgalan_112035145

07.11.2024

# Load necessary package library(wooldridge) # Load the VOTE1 dataset data("vote1") # Part (i): Define and estimate the model with an interaction term model <- lm(voteA ~ prtystrA + expendA + expendB + I(expendA * expendB), data = vote1) summary(model) ## ## Call: ## lm(formula = voteA ~ prtystrA + expendA + expendB + I(expendA * ## expendB...

17 sym R (3668 sym/14 pcs)

Enkhbayasgalan_112035145

01.11.2024

CHAPTER 2 i. How many counties had zero murders in 1996? How many counties had at least one execution? What is the largest number of executions? library(wooldridge) data(countymurders) county_murders_1996 <- subset(countymurders, year == 1996) # Count counties with zero murders zero_murders <- sum(county_murders_1996$murders == 0) # Count counties...

3242 sym R (26248 sym/109 pcs) 3 img

Enkhbayasgalan_112035145

24.10.2024

library(discrim) ## Loading required package: parsnip library(wooldridge) library(tidyverse) ## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ── ## ✔ dplyr 1.1.4 ✔ readr 2.1.5 ## ✔ forcats 1.0.0 ✔ stringr 1.5.1 ## ✔ ggplot2 3.5.1 ...

24 sym R (5470 sym/17 pcs)

Enkhbayasgalan_112035145

25.09.2024

# Question 1 library(wooldridge) data("bwght") # (i) Total women and women who smoked during pregnancy total_women <- nrow(bwght) women_smoked <- sum(bwght$smoke == 1) total_women ## [1] 1388 women_smoked ## [1] 0 # (ii) Average number of cigarettes smoked per day avg_cigarettes <- mean(bwght$cigs, na.rm = TRUE) avg_cigarettes ## [1] 2.087176 # (...

43 sym R (2371 sym/40 pcs)

Final exam_20240613

13.06.2024

library(MASS) library(caret) ## Loading required package: ggplot2 ## Loading required package: lattice library(ISLR) library(e1071) library(class) library(glmnet) ## Loading required package: Matrix ## Loaded glmnet 4.1-8 library(pls) ## ## Attaching package: 'pls' ## The following object is masked from 'package:caret': ## ## R2 ## The follow...

599 sym R (17752 sym/86 pcs) 2 img