Publications by Leo Tzang
Munkhzul
##Part1 # Load the wooldridge package and data library(wooldridge) data("vote1") # Estimate the model with 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), data = vote1) ## ## Res...
15 sym R (4264 sym/12 pcs)
Document
# ---------------------- # Setup and Data Loading # ---------------------- # Install and load required packages if (!require("wooldridge")) install.packages("wooldridge") ## Loading required package: wooldridge if (!require("dplyr")) install.packages("dplyr") ## Loading required package: dplyr ## ## Attaching package: 'dplyr' ## The following obje...
199 sym R (4918 sym/38 pcs)
Midterm
Chapter 2 : C9 Use the data in COUNTYMURDERS to answer this questions. Use only the data for 1996. ## ## Attaching package: 'dplyr' ## The following objects are masked from 'package:stats': ## ## filter, lag ## The following objects are masked from 'package:base': ## ## intersect, setdiff, setequal, union ## arrests countyid density...
8224 sym Python (16456 sym/83 pcs) 5 img
Document
Chapter2 library(wooldridge) data <- wooldridge::countymurders data_1996 <- data[data$year == 1996, ] #Part (i) # Number of counties with zero murders zero_murders <- sum(data_1996$murders == 0) # Number of counties with at least one execution one_or_more_executions <- sum(data_1996$execs > 0) # Maximum number of executions max_executions <- max(...
1201 sym R (24594 sym/111 pcs) 4 img
Document
library(wooldridge) library(car) ## Loading required package: carData library(lmtest) ## Loading required package: zoo ## ## Attaching package: 'zoo' ## The following objects are masked from 'package:base': ## ## as.Date, as.Date.numeric data("discrim") (i) OLS estimation of the initial model model1 <- lm(log(psoda) ~ prpblck ...
208 sym R (4955 sym/40 pcs)
HW01
# Load necessary package and data if (!require(wooldridge)) { install.packages("wooldridge") } ## Loading required package: wooldridge library(wooldridge) data("discrim") # Part (i): Calculate means and standard deviations mean_prpblck <- mean(discrim$prpblck, na.rm = TRUE) sd_prpblck <- sd(discrim$prpblck, na.rm = TRUE) mean_income <- mean(disc...
19 sym R (4327 sym/16 pcs)
Document
install.packages("wooldridge") ## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4' ## (as 'lib' is unspecified) library(wooldridge) data("discrim") #(i) Find the average values and standard deviations of prpblck and income. # Mean and standard deviation of prpblck and income mean_prpblck <- mean(discrim$prpblck, na.rm = TRUE) sd...
521 sym R (5729 sym/28 pcs)
Publish Document
install.packages("wooldridge") ## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4' ## (as 'lib' is unspecified) library(wooldridge) data("wage2") ##(i) Simple Regression of IQ on educ: model_educ_iq <- lm(IQ ~ educ, data = wage2) summary(model_educ_iq)$coefficients ## Estimate Std. Error t value ...
171 sym R (1516 sym/11 pcs)
Exercise 1
# 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)
Document
BWGHT Dataset install.packages("wooldridge") ## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4' ## (as 'lib' is unspecified) library(wooldridge) How many women are in the sample, and how many report smoking during pregnancy? num_women <- nrow(bwght) num_smokers <- sum(bwght$smoke == 1, na.rm = TRUE) num_women ## [1] 1388 num_...
855 sym R (1823 sym/47 pcs)