Homework 1

Dennis Espejo
STAT 5200 Applied Econometrics 1
Yisroel Cahn
September 15, 2026

Q1 (Basic R questions)

A <- cbind(c(5,2),c(2,1))
B <- cbind(c(5,2),c(2,5))

inv_A <- solve(A)
C=inv_A %*% B 

t(C)
##      [,1] [,2]
## [1,]    1    0
## [2,]   -8   21

Multiplying the inverse of A by B with the standard multiplication symbol * would perform 1 to 1 multiplications of the numbers with the same row x column identifications across matrices which isn’t standard procedure when multyplying matrices. To multiply using matrix multiplication we use %(*)%. Since both matrices are 2x2 the inner values match, meaning we can use matrix multiplication, and the outer values create 2x2 which will be the shape of the matrix multiplications’ product,as seen in the matrix C’s output.

D<-cbind(c(0,0),c(0,0))

for (k in 1:100){
   
    D_k<-matrix(c(k, k+1,
                    k^2, k/2),
                nrow=2, ncol =2, byrow=TRUE)

    D <- D + D_k

}

print(D)
##        [,1] [,2]
## [1,]   5050 5150
## [2,] 338350 2525

Q2 (Simulation Questions)

Re-running document code here

generate_data = function(N = 20){
  # model parameters
  beta0 = 1;
  beta1 = 1;
  beta2 = 0.2;
  # simulating data
  mat_data = matrix(NA, N, 2); # N by 2 matrix to store (y,x) by row
  for (i in 1:N){
    e = rt(1, df=10); # e ~ t distribution with degrees of freedom 10
    x = rnorm(1, mean=1, sd = sqrt(4)); # x~N(1,4)
    y = beta0 + beta1*x + beta2*x^2 + e; # this is our population model
    mat_data[i,] = c(y,x);
  }
  colnames(mat_data) = c("y", "x"); # put column names
  return(mat_data);
}

N = 20; # length of the data
data1 = generate_data(N); #


theta_hat = mean(data1[,1])


simulation_sample_mean = function(N=20, M=1000){
  # A function that generates M data sets (length of N), computes sample mean of each data set
  # N: the length of each data set
  # M: the number of simulations (that is, the number of data sets)
  mat_theta_hat = matrix(NA, M, 1); # a placeholder to collect M sample means
  for (m in 1:M){
    dataset = generate_data(N); # generate a data set (y,x) of length N
    theta_hat = mean(dataset[,1]); # compute sample mean of y
    mat_theta_hat[m,] = theta_hat; # store m-th sample mean
  }
  return(mat_theta_hat);
}



N = 20; # the length of each data set
M = 1000; # the number of simulations (that is, the number of data sets)
mat_theta_hat = simulation_sample_mean(N, M);
print(var(mat_theta_hat)); # print out variance of sample mean
##           [,1]
## [1,] 0.5206348
mat_theta_hat_20 = simulation_sample_mean(N=20, M);
mat_theta_hat_100 = simulation_sample_mean(N=100, M);
mat_theta_hat_500 = simulation_sample_mean(N=500, M);



print(var(mat_theta_hat_20));
##           [,1]
## [1,] 0.5244655
print(var(mat_theta_hat_100));
##            [,1]
## [1,] 0.09481051
print(var(mat_theta_hat_500));
##            [,1]
## [1,] 0.01978281
print(var(sqrt(20)*mat_theta_hat_20)); 
##          [,1]
## [1,] 10.48931
print(var(sqrt(100)*mat_theta_hat_100));
##          [,1]
## [1,] 9.481051
print(var(sqrt(500)*mat_theta_hat_500));
##          [,1]
## [1,] 9.891406

My code for chi-square version starts here

generate_data_chi_sq = function(N = 20){
  # model parameters
  beta0 = 1;
  beta1 = 1;
  beta2 = 0.2;
  # simulating data
  mat_data = matrix(NA, N, 2); # N by 2 matrix to store (y,x) by row
  for (i in 1:N){
    e = rchisq(1, df=20) - 20; # e ~ t distribution with degrees of freedom 10
    x = rnorm(1, mean=1, sd = sqrt(4)); # x~N(1,4)
    y = beta0 + beta1*x + beta2*x^2 + e; # this is our population model
    mat_data[i,] = c(y,x);
  }
  colnames(mat_data) = c("y", "x"); # put column names
  return(mat_data);
}

N = 20; # length of the data
data1 = generate_data_chi_sq(N); #


theta_hat = mean(data1[,1])


simulation_sample_mean_chi_sq = function(N=20, M=1000){
  # A function that generates M data sets (length of N), computes sample mean of each data set
  # N: the length of each data set
  # M: the number of simulations (that is, the number of data sets)
  mat_theta_hat = matrix(NA, M, 1); # a placeholder to collect M sample means
  for (m in 1:M){
    dataset = generate_data_chi_sq(N); # generate a data set (y,x) of length N
    theta_hat = mean(dataset[,1]); # compute sample mean of y
    mat_theta_hat[m,] = theta_hat; # store m-th sample mean
  }
  return(mat_theta_hat);
}



N = 20; # the length of each data set
M = 1000; # the number of simulations (that is, the number of data sets)
mat_theta_hat_chi_sq = simulation_sample_mean_chi_sq(N, M);
print(var(mat_theta_hat_chi_sq)); # print out variance of sample mean
##          [,1]
## [1,] 2.639954
mat_theta_hat_20_chi_sq= simulation_sample_mean_chi_sq(N=20, M);
mat_theta_hat_100_chi_sq = simulation_sample_mean_chi_sq(N=100, M);
mat_theta_hat_500_chi_sq = simulation_sample_mean_chi_sq(N=500, M);



print(var(mat_theta_hat_20_chi_sq));
##          [,1]
## [1,] 2.460155
print(var(mat_theta_hat_100_chi_sq));
##           [,1]
## [1,] 0.5114481
print(var(mat_theta_hat_500_chi_sq));
##            [,1]
## [1,] 0.09864651
print(var(sqrt(20)*mat_theta_hat_20_chi_sq)); 
##         [,1]
## [1,] 49.2031
print(var(sqrt(100)*mat_theta_hat_100_chi_sq));
##          [,1]
## [1,] 51.14481
print(var(sqrt(500)*mat_theta_hat_500_chi_sq));
##          [,1]
## [1,] 49.32325
hist1=sqrt(500)*mat_theta_hat_500
  
hist2=sqrt(500)*mat_theta_hat_500_chi_sq

hist1centered=sqrt(500)*(mat_theta_hat_500 - mean(mat_theta_hat_500))

hist2centered=sqrt(500)*(mat_theta_hat_500_chi_sq- mean(mat_theta_hat_500_chi_sq))

Histograms

(Sticking with the lab notes, unsure if I had to center them)

hist(hist1, 
     main = "Distribution of Means T", 
     xlab = "Means",                 
     ylab = "Frequency",            
     col = "orange",                
     border = "white",          
     breaks = 20)                   

hist(hist2, 
     main = "Distribution of Means Chi-square", 
     xlab = "Means",               
     ylab = "Frequency",            
     col = "orange",               
     border = "white",               
     breaks = 20)     

hist(hist1centered, 
     main = "Distribution of Means T", 
     xlab = "Means",                 
     ylab = "Frequency",            
     col = "orange",                
     border = "white",          
     breaks = 20)       

hist(hist2centered, 
     main = "Distribution of Means Chi-square", 
     xlab = "Means",                 
     ylab = "Frequency",            
     col = "orange",                
     border = "white",          
     breaks = 20)       

Answers

Do you arrive at the same conclusion with a new population model?

  1. Yes. I arrive at the same general conclusion with the new population model. As (N) gets larger, the variance of the sample mean gets smaller. Equivalently, the standard deviation of the sample mean gets smaller at a rate of (1/√N). Multiplying the sample mean by (√N) counteracts that shrinking, so the spread of √N * ˆθ stays roughly constant across different sample sizes.

Plot the histogram of √N ˆθ when N = 500 and compare it to the one based on the original population model. Do they look similar?

  1. Yes, they look broadly similar. Both histograms of the square root of N times theta-hat when N = 500 are centered around roughly the same value and have a similar bell-shaped pattern. The chi-square version looks slightly less symmetric, which makes sense because the chi-square error term is skewed, but the overall conclusion is still similar to the original population model.

Q3 (Paper questions)

  1. My field of interest is Higher Education.

  2. American Education Research Journal, Educational Evaluation and Policy Analysis, The Journal of Higher Education, Education Economics, Educational Journal of Sociology.

  3. Reducing Income Inequality in Educational Attainment: Experimental Evidence on the Impact of Financial Aid on College Completion.

  4. Goldrick-Rab, S., Kelchen, R., Harris, D. N., & Benson, J. (2016). Reducing income inequality in educational attainment: Experimental evidence on the impact of financial aid on college completion. American Journal of Sociology, 121(6), 1762-1817.

  5. This paper uses data from one of the nation’s first experimental analyses of need-based financial grant aid.The study analyzed three cohorts of low-income students attending 13 public universities across Wisconsin, including 1,635 students randomly assigned to be offered a need-based grant. The paper addresses an important methodological gap in the literature by using a randomized controlled experiment to provide “rigorous” empirical evidence on the relationship between need-based financial aid and bachelor’s degree completion among low-income students. In doing so, the study contributes to the relatively limited body of rigorous research examining the effects of need-based financial aid on college completion. The authors ultimately find evidence that receiving an offer of need-based grant aid influenced students’ educational outcomes.

  6. Series of seperate OLS regressions with logistic regression for some effect-size calculations of binary outcomes.(OLS/Logistic regression for some binary outcomes mrovides most of the main findings, additional models and supplementary analysis were provided in later tables)

  7. The study did report standard errors. They indicated in the table description that units in parenthesis represented the coefficients standard error.

  8. I’m assuming that this link explains what the standard error could potentially mean here https://support.minitab.com/en-us/minitab/help-and-how-to/statistical-modeling/regression/supporting-topics/regression-models/what-is-the-standard-error-of-the-coefficient/ If im interpreting correct, its just how precise the model was at estimating each coefficient. Basically, the estimated amount the beta would vary across repeated samples.