R语言代写|Chapter 18 Exercises

这是一篇英国的R语言限时测试代写

 

18.1 The basics

1. Plot the sine and cosine functions from 0 to 2π.

2. Write a function to plot an ellipse:

x = a cos(a) cos(B) – bsin(a) sin(B)

ly = a sin(a) cos(β) + bcos(a) sin(β)  where–2π≤βS2π

and a is the rotation angle of the ellipse.

3. Write a function that takes two numbers as input and tells the user whether these are multiples of each other or not.

4. Write a function to print the following number triangle:

1
22
333
4444
55555
.
.
.

down to any value n

18.2 Plotting data

1. Using geostats’ countQuakes function (section 17.1.13), plot the declustered earthquakes of magnitude 4.5 and greater from 2000 to 2016 as a bar plot, and as a histogram.

2. Generate two samples (A and B, say) of 100 random numbers between 0 and 1; calculate the ratios A/B and B/A; and create a 2 x 2 figure with KDEs and rug plots of A/B, B/A,In(A/B) and ln(B/A).

3. Create a bivariate (x, y) dataset of 1000 random uniform numbers where -1≤x≤+1 and 2< y≤22. Construct a 2-dimensional KDE for these data.

4. Plot the ECDFs of the x and y values of the previous exercise. What fraction of the x-values is less than 0? What fraction of the y-values is less than 7? And less than 17?

18.3 Summary statistics

1. Calculate the means and variances of the Anscombe quartet, and store them in a 2 X 4 matrix.

2. Generate n = 10 random numbers between 0 and 1. Calculate their mean. Repeat 100 times and store the mean values in a 100-element vector. Compute the mean and standard deviation of this vector. Repeat for n = 100, 1000 and 10000.

3. Generate 1000 random numbers between 0 and 200. Count the number of values that are less than 1. Repeat 500 times to fill a vector of counts. Compute the mean and variance of this vector.

4. Generate two samples (A and B) of 100 random numbers between 0 and 1, and calculate their logratio ln(A/ B). Repeat 10 times and visualise the results as a box plot.

18.4 Probability

1. The International Geo Sample Number (IGSN) is an alphanumeric code that is used to identify geological rock specimens in the scientific literature. It consists of up to five letters to identify the owner of the sample, followed by four characters (letters or numbers) to identify the sample itself. Examples are PVERM1234 and UCL001B. How many sampes can each owner register? How many possible IGSNs are there in total?

2.20 students are taking part in a mapping exercise. How many ways are there to divide them into 4 distinct groups of 5?

3. A thoroughly mixed conglomerate contains 30% andesite clasts, 20% basalt clasts, and 50% carbonate clasts. How many randomly selected clasts do we need to pick to be 95% certain that we have collected at least one clast of each lithology?

4.95% of iron ore deposits are characterised by magnetic anomalies, and so are 98% of chromium deposits, and 1% of other rocks. 0.1% of all rocks contain iron ore, and 0.05% of rocks contain chromium ore. Suppose that we have found a magnetic anomaly. What is the probability that this is caused by an ore deposit?

18.5The binomial distribution

1. In palynology, the ratio of arboreal to non- arboreal pollen is widely used as an index of landscape openness. This ratio is estimated by counting a representative number of randomly selected pollen from a soil sample. Suppose that we have counted 20 pollen and counted the number of arboreal or non -arboreal species among them. Further suppose that the true arboreal/ non-arboreal pollen ratio in the soil is 4. What is probability that the arboreal/ non arboreal ratio of the 20 counts is 9 or greater?

2. We believe that 50% of all dinosaur fossils are female (and 50% are male). A bone bed contains 50 dinosaur fossils among which 32 are female (and 18 are male). Do we have enough evidence to prove that the proportion of males and females is different? Do our data support the notion that females are more common than males?

3. Draw 50 random numbers from a binomial distribution with p = 0.2 and n = 100. For each of these values, perform a two-sided test against the null hypothesis that p= 0.2. Do all the values pass the test?

4. Given A= 12 arboreal pollen and N = 8 non- arboreal pollen, compute a 95% confidence interval for the A/N-ratio of the soil.

18.6 The Poisson distribution

1. On average a magnitude≥9 earthquake occurs once every 13.5 years. What is the probability that two such earthquakes will happen next year? What is the probability that none will happen in the next century?

2. The fission track method is a geochronological technique that is based on the spontaneous fission of 238∪in accessory minerals such as apatite. Spontaneous fssion occurs with a probability of 8.46×10- 17 per atom of 238∪per year. This is known as the decay constant.Suppose that a 1 million year old apatite crystal contains 1 prnol of 238∪(= 6.022 x 1011 atoms). What is the probability that it contains 50 or fewer fission tracks? What is the probability that it contains 41 to 60 tracks?

3. The Orange River in South Africa is famous for its alluvial diamonds. In order for mining operations to be profitable, placer deposits must contain at least 2 diamnonds per tonne. A diamond mining company has sieved 10 tonnes of sand and found 12 diamonds. Assum-ing that the diamonds are randomly distributed in the sand, should the company cease operations? Or would it be premature to do so and should they acquire some more data first?

4. At another site, a preliminary mining survey has yielded 30 diamonds in 10 tonnes. Con-struct a 95% confidence interval for the diamond yield in this deposit.


程序代写代做C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail: itcsdx@outlook.com  微信:itcsdx


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。

blank

发表评论