0% found this document useful (0 votes)
3 views2 pages

Sec Assignment

The document contains R code snippets demonstrating the use of the exponential distribution and time series analysis. It includes calculations for the cumulative distribution function of the exponential distribution, creation and plotting of a time series for natural rubber production, and a time series of Nile river data. Additionally, it shows the application of a moving average on the natural rubber production time series.

Uploaded by

Snehal Jha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Sec Assignment

The document contains R code snippets demonstrating the use of the exponential distribution and time series analysis. It includes calculations for the cumulative distribution function of the exponential distribution, creation and plotting of a time series for natural rubber production, and a time series of Nile river data. Additionally, it shows the application of a moving average on the natural rubber production time series.

Uploaded by

Snehal Jha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Q.1.

> pexp(1,2,lower.tail = F)
[1] 0.1353353
> pexp(1,1,lower.tail = F)
[1] 0.3678794

Q.2.

> x = c(5.2,5.8,5.9,6.5,7.1,7.5,7.8,7.5,7.3)
> ts1 = ts(x, start = 2001, end = 2009, frequency = 1)
> ts1
Time Series:
Start = 2001
End = 2009
Frequency = 1
[1] 5.2 5.8 5.9 6.5 7.1 7.5 7.8 7.5 7.3
> plot(ts1, ylab = "Production of natural rubber(in lakh tonnes)", xlab = "Year")

> library(forecast)
> ma(ts1, 3)
Time Series:
Start = 2001
End = 2009
Frequency = 1
[1] NA 5.633333 6.066667 6.500000 7.033333 7.466667 7.600000 7.533333
[9] NA
Q.3.

> Nile
Time Series:
Start = 1871
End = 1970
Frequency = 1
[1] 1120 1160 963 1210 1160 1160 813 1230 1370 1140 995 935 1110 994
[15] 1020 960 1180 799 958 1140 1100 1210 1150 1250 1260 1220 1030
1100
[29] 774 840 874 694 940 833 701 916 692 1020 1050 969 831 726
[43] 456 824 702 1120 1100 832 764 821 768 845 864 862 698 845
[57] 744 796 1040 759 781 865 845 944 984 897 822 1010 771 676
[71] 649 846 812 742 801 1040 860 874 848 890 744 749 838 1050
[85] 918 986 797 923 975 815 1020 906 901 1170 912 746 919 718
[99] 714 740
> plot(Nile)

You might also like