Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Let Z(s) be a stationary randonn function, and let Z(so) = 0.5Z(81), +0.2Z(9) +0

ID: 3351011 • Letter: L

Question

Let Z(s) be a stationary randonn function, and let Z(so) = 0.5Z(81), +0.2Z(9) +0.2Z(ss) + 0.1Z(84) be a weighted average of the four values Z(81), Z(82), Z(83), Z(84) as shown on the 2m × 2m square below. $4 s2 Answer the following questions: a. Use R to compute the distance matrix b. Assume that the spatial covariance is given by C(h) = 2.5e-7, Use R to compute the 4 × 4 variance covariance Z(si) Z(s2) Z(s3) Z(s4) matrix of the vector 0.5 0.2 0.2 |. Then use 0.1 c. Use matrix and vector notation to compute var(Z(so)). Note: Z(so) - a'Z, where a -

Explanation / Answer

The R code for the generation of random stationary processes for the points of the given square in the range (-m,+m) and the analysis for computation of distance matrix, variance-covariance matrix, and estimated variance of s0.

# Define m
m=10

# Random Stationary Processes for x,y and length of square
x = rnorm(20,mean=0,sd = m)
y= rnorm(20,mean=0,sd=m)
l = rnorm(20,mean=0,sd=m)

# Define the coordinates of points of square
s1_x = x
s1_y = y
s2_x = x
s2_y = y+l
s3_x = x+l
s3_y = y+l
s4_x = x+l
s4_y = y

# Defining S0 as the weighted average of points
s0_x = 0.5 * s1_x+0.2*s2_x+02*s3_x+0.1*s4_x
s0_y = 0.5 * s1_y+0.2*s2_y+02*s3_y+0.1*s4_y

# converting to coordinates and dataframes
s1 = data.frame(x=s1_x,y=s1_y)
s2 = data.frame(x=s2_x,y=s2_y)
s3 = data.frame(x=s3_x,y=s3_y)
s4 = data.frame(x=s4_x,y=s4_y)
s0 = data.frame(x=s0_x,y=s0_y)

# 1. distance matrix
require(distances)
as.matrix(dist(s1))
as.matrix(dist(s2))
as.matrix(dist(s3))
as.matrix(dist(s4))
as.matrix(dist(s0))

#2. variance covariance matrix of vector z
z <- (c(s1[,1]+s1[,2],s2[,1]+s2[,2],s3[1,1]+s3[1,2],s4[1,1]+s4[1,2]))
cov_matrix = cov(as.matrix(z%*%t(z)))
cov_matrix

# Define a
a <- c(0.5,0.2,0.2,0.1)

# 3. Compute var(S0)
var_z = t(a)%*%cov_matrix%*%a