Question

# Download the dataset Nile rm(list=ls()) library(help = "datasets") data("Nile") View(Nile) # Fi...

# Download the dataset Nile

rm(list=ls())

library(help = "datasets")

data("Nile")

View(Nile)

# Find the mean and sd of the data. It has only one variable.

# Find out the 90% confidence interval for the population mean mu for the dataset Nile, assuming that the

# population sd is known and is same as the sample sd. (50 points)

# Repeat the same exercise assuming that the population sd is not known. (50 points).

# Show all the necessary steps in each of the questions.

please submit solution in R format

0 0
Add a comment Improve this question Transcribed image text
Answer #1

//import dataset Nile
  
#give details of Nile dataset
library (datasets)
data("Nile")
View(Nile)
#display attributes of Nile dataset
names(Nile)
#display dimensions of dataset
dim(Nile)
#view the contents of dataset
View(Nile)
#internal strucutre of dataset
str(Nile)
#minimum value
# symbol "$" is used to choose attribute of dataset
min(Nile$x)
min(Nile$time)
#max value
max(Nile$time)
max(Nile$Nile)
#mean value
mean(Nile$time)
# range of attribute value
range(Nile$Nile)
#standard deviation
sd(Nile$time)
#variance

# with 50\% interval
ts.plot(Nile, pred$pred,
pred$pred + 0.67*pred$se, pred$pred -0.67*pred$se)

var(Nile$x)require(stats); require(graphics)
par(mfrow = c(2,2))
plot(Nile)
acf(Nile)
pacf(Nile)
ar(Nile)
cpgram(ar(Nile)$resid)
par(mfrow = c(1,1))
arima(Nile, c(2, 0, 0))
  
  
NileN <- Nile
NileN[c(20:40, 51:80)] <- NA
arima(NileN, c(2, 0, 0))
plot(NileN)
pred <-
predict(arima(window(NileN, 1861, 1889), c(2,0,0)), n.ahead = 20)
lines(pred$pred, lty = 3, col = "red")
lines(pred$pred + 2*pred$se, lty=2, col="blue")
lines(pred$pred - 2*pred$se, lty=2, col="red")
pred <-
predict(arima(window(NileN, 1861, 1935), c(2,0,0)), n.ahead = 20)
lines(pred$pred, lty = 3, col = "red")
lines(pred$pred + 2*pred$se, lty=2, col="green")
lines(pred$pred - 2*pred$se, lty=2, col="red")
  
## time series models
par(mfrow = c(3, 1))
plot(Nile)
#l model
(fit <- StructTS(Nile, type = "level"))
lines(fitted(fit), lty = 2)
lines(tsSmooth(fit), lty = 2, col = 3)   
plot(residuals(fit)); abline(h = 0, lty = 4)
# local model
(fit2 <- StructTS(Nile, type = "trend"))
pred <- predict(fit, n.ahead = 30)
# 50% interval
ts.plot(Nile, pred$pred,
pred$pred + 0.68*pred$se, pred$pred -0.68*pred$se)
  
  
plot(NileN)
(fit3 <- StructTS(NileN, type = "level"))
lines(fitted(fit3), lty = 2)
lines(tsSmooth(fit3), lty = 3)
plot(residuals(fit3)); abline(h = 0, lty = 3)

Add a comment
Know the answer?
Add Answer to:
# Download the dataset Nile rm(list=ls()) library(help = "datasets") data("Nile") View(Nile) # Fi...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • mathematical statistics use RStudio program to write a code # Download the datas et Nile rm(list-1s))...

    mathematical statistics use RStudio program to write a code # Download the datas et Nile rm(list-1s)) 1ibrary(help "datasets") data("Nile" view (Nile) # Find the mean and sd of the data. It has only one variable. # Problem 1 # Design a one-tailed test with a null hypothesis HO: mu>1000 , assuming that the population sd is known and # is same as the sample sd and probability of error (alpha) 10%, can you reject the null? (50 points) # Problem...

  • PO2508 Understanding Statistics EXERCISE SHEET - l. Classify each of the following as nominal, ordinal, interval...

    PO2508 Understanding Statistics EXERCISE SHEET - l. Classify each of the following as nominal, ordinal, interval or ratio level data: a. The telephone area code of interviewees n b. The weight of fish landed at Fraserburgh c. Survey responses that scale attitudes towards a business from 1 to 5 dL d. The time required to sell a house e. Football players shirt numbers Inver f. The Richter scale used to measure earthquake strength g. Job satisfaction ratings of a sample...

  • Project Number 9 Statistical analysis of radiation data recorded by an ionization chamber Project Number 9...

    Project Number 9 Statistical analysis of radiation data recorded by an ionization chamber Project Number 9 Statistical analysis of radiation data recorded by an ionization chamber In this project, you are required to statistically analyze the data of radiation dose recorded by an ionization chamber experimentally in the research lab. Background of the problem: For measuring the radiation dose delivered to a body by a given radiation beam, an ionization chamber (detector) is used. An ionization chamber is made up...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT