Question

In: Statistics and Probability

The built-in data “trees” provide the measurements of diameter (Girth), height and volume of trees. These...

  1. The built-in data “trees” provide the measurements of diameter (Girth), height and volume of trees. These are in inches for Girth, feet for Height and cubic feet for Volume. We will focus on Girth and Height. Write a function convert() that converts the values into the metric system (meters). Your function should take as arguments the value to convert and the unit it was expressed in (inches or feet) (use the following: x inches = x*0.0254 meters, x feet = x*0.3048 meters). If the first argument is not numeric or if the second argument is not “inch” or “feet”, use stop() function with an error message. Here is how it should work:

> convert(8.3,"inches")

[1] 0.21082

> convert(8.3,"feet")

[1] 2.52984

> convert(8.3,"foot")

Error in convert(8.3, "foot") : the unit was not "inches" or "feet"

Use your function to convert the values of Girth and Height to meters. Using cor.test() function, calculate the correlation (and the corresponding p-value) between Girth and Height in meters.

Solutions

Expert Solution

The R code is

convert=function(x,unit){
if(unit=="inches") x*0.0254 else if(unit=="feet") x*0.3048
else stop('the unit was not in "inches" or "feet"')
}
convert(8.3,"inches")
convert(8.3,"feet")
convert(8.3,"foot")
d=trees
attach(d)
Girth=convert(Girth,"inches")
Height=convert(Height,"feet")
cor.test(Girth,Height)

The Output is

#Here Value of Correlation coefficient is 0.5192801

#From P-Value =0.002758<=0.05 There is enough evidence to claim the population correlation coefficient is not zero.The Regression coefficient is significant


Related Solutions

7.20 Body measurements, Part III. Exercise 7.13 introduces data on shoulder girth and height of a...
7.20 Body measurements, Part III. Exercise 7.13 introduces data on shoulder girth and height of a group of individuals. The mean shoulder girth is 107.30 cm with a standard deviation of 10.34 cm. The mean height is 171.14 cm with a standard deviation of 9.41 cm. The correlation between height and shoulder girth is 0.69. 1. (a) Write the equation of the regression line for predicting height. 2. (b) Interpret the slope and the intercept in this context. 3. (c)...
Researchers studying anthropometry collected body girth measurements and skeletal diameter measurements, as well as age, weight,...
Researchers studying anthropometry collected body girth measurements and skeletal diameter measurements, as well as age, weight, height and gender, for 507 physically active individuals. The histogram below shows the sample distribution of heights in centimeters. (a) What is the point estimate for the average height of active individuals? What about the median? (b) What is the point estimate for the standard deviation of the heights of active individuals? What about the IQR? (c) Is a person who is 1m 80cm...
For a sample of 12 trees, the volume of lumber (in m3) and the diameter (...
For a sample of 12 trees, the volume of lumber (in m3) and the diameter ( in cm ) at a fixed height above the ground level was measured. The results were as follows. Use Excel sheet Diameter Volumes 35.1 0.81 48.4 1.39 47.9 1.31 35.3 0.67 47.3 1.46 26.4 0.47 33.8 0.8 45.3 1.69 25.2 0.3 28.5 0.19 30.1 0.63 30 0.64 a)Construct a scatterplot of volume ( y ) versus diameter ( x ). using Excel b)Compute the...
Suppose the diameter at breast height (in.) of trees of a certain type is normally distributed...
Suppose the diameter at breast height (in.) of trees of a certain type is normally distributed with mean 8.8 inch and standard deviation 2.8 inch, as suggested in the article “Simulating a Harvester-Forwarder Softwood Thinning” (ForestProducts J., May 1997: 36–41). f. What is the probability of exactly 2 out of 4 trees have diameter exceeding 10 in? g. What is the probability of at least 3 out of 4 have diameter exceeding 10 in? Note: the answer to a, b...
The data set cherry.csv, from Hand et al. (1994), contains measurements of diameter (inches), height (feet),...
The data set cherry.csv, from Hand et al. (1994), contains measurements of diameter (inches), height (feet), and timber volume (cubic feet) for a sample of 31 black cherry trees. Diameter and height of trees are easily measured, but volume is more difficult to measure. (i) Suppose that these trees are a SRS from a forest of N = 2967 trees and that the sum of the diameters for all trees in the forest is tx = 41835 inches. Use ratio...
A sample of 10 employee’s height is taken to design the height of doorway. The measurements...
A sample of 10 employee’s height is taken to design the height of doorway. The measurements (in cm) are in the following table 167.87 153.24 150.39 173.38 177.91 155.88 171.06 155.57 171.43 178.62 What should be the height of the doorway if you want that just a 0.1% of the employees have troubles passing through it? You think that the initial 10-employee sample is too small and you want to ensure a confidence level of 97% with an error in...
How would volume measurements change (pulmonary volume and capacity) if data were collected during vigorous exercise...
How would volume measurements change (pulmonary volume and capacity) if data were collected during vigorous exercise (TV, IRV, ERV, VC, RV) in comparison to collecting data at when at rest? Please provide reasonable quantitative estimates, rather than just a qualitative description.
How do I calculate the volume of a cylinder if the surface of the cylinder is 4239 cm². And the height is equal to the diameter of the base.
How do I calculate the volume of a cylinder if the surface of the cylinder is 4239 cm². And the height is equal to the diameter of the base.
The height of maple trees are distributed normally with a mean of 31 meters and a...
The height of maple trees are distributed normally with a mean of 31 meters and a standard deviation of 4 meters. a) What is the probability of a tree being taller than 33 meters? Represent this graphically as well as numerically. b) A group of 20 trees is selected at random. What is the probability that the average height of these 20 trees is more than 33 meters? Represent this graphically as well as numerically. c) A group of 20...
A toroid with inner diameter of 3 cm, outer diameter of 5 cm, and height of...
A toroid with inner diameter of 3 cm, outer diameter of 5 cm, and height of 0.1 cm is made of a body-centered-cubic (bcc) paramagnetic material with lattice parameter equal to 0.5 nm. The toroid is wrapped by a copper wire in 20 turns. If each atom of the magnetic material has a magnetic moment of 1.5µB (Bohr Magneton), (a) (1.5 pt) What is the saturation magnetization (in A/m) of the material? (b) (1.5 pt) If a current of 2...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT