QuestionQuestion

Transcribed TextTranscribed Text

1. Write codes to check on the property of the following vsriance estimators 1/ var(fr) E 1 - Iti y7 + EE Tij - Hirt yiy; = IT; 2 i=1 i=1 ji JiToj Tij y V 1 1 I 1 = E 2 y² +2 2 E yiy; IT Iti i=1 i=1j>i TITI Tij And The alternative variance estimator is N - 11 57 2 var(fr) = t (6.8) N V Use data trees when trees$Hight is variable of interest and trees$Girth is the vaiable used for size. Write done your comments on the results.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

var_fun_alt <- function(y, x){
# Calculating probabilities ie. p
p = x/sum(x)

# Finding unique values from x
v = length(unique(x))

# Finding total number of observations
N = length(y)

# Taking v samples from the overall data
sa = sample(1:N, v, replace = TRUE, prob =p )

# Taking pi only of samples
p_sa = p[sa]

# Taking y values of samples
y_sa = y[sa]

# Calculating pi ie. pi = 1 - (1-p)^n
pii = 1 - (1 - p_sa)^v

# Unbiased estimator of tau
tauh = sum(y[sa]/p[sa])

# Calculating t = v*y/pi
t = v * y_sa/pii

# Finding st^2 using the formula i.e. [1/(v-1)]* sum((t-pi)^2)
s_t2 = (1/(v-1)) * sum((t-pii)^2)

# The alternative variance estimator is
vhat = ((N-v)/N) * s_t2/v

# Returning results
res=c(est=tauh,varh=vhat)
res
}

var_fun <- function(y, x) {

# Calculating probabilities ie. pi
p = x/sum(x)

# Finding unique values from x
v = length(unique(x))

# Finding total number of observations
N = length(y)

# Taking v samples from the overall data
sa = sample(1:N, v, replace = TRUE, prob =p )

# Taking pi only of samples
p_sa = p[sa]

# Taking y values of samples
y_sa = y[sa]

# Calculating pi ie. pi = 1 - (1-p)^n
pii = 1 - (1 - p_sa...

By purchasing this solution you'll be able to access the following files:
solution.R.

$13.00
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Statistics-R Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats