Question

In: Statistics and Probability

Using the "mammals" dataset from the "MASS" library in R: body brain Arctic fox 3.385 44.50...

Using the "mammals" dataset from the "MASS" library in R:

body brain
Arctic fox 3.385 44.50
Owl monkey 0.480 15.50
Mountain beaver 1.350 8.10
Cow 465.000 423.00
Grey wolf 36.330 119.50
Goat 27.660 115.00
Roe deer 14.830 98.20
Guinea pig 1.040 5.50
Verbet 4.190 58.00
Chinchilla 0.425 6.40
Ground squirrel 0.101 4.00
Arctic ground squirrel 0.920 5.70
African giant pouched rat 1.000 6.60
Lesser short-tailed shrew 0.005 0.14
Star-nosed mole 0.060 1.00
Nine-banded armadillo 3.500 10.80
Tree hyrax 2.000 12.30
N.A. opossum 1.700 6.30
Asian elephant 2547.000 4603.00
Big brown bat 0.023 0.30
Donkey 187.100 419.00
Horse 521.000 655.00
European hedgehog 0.785 3.50
Patas monkey 10.000 115.00
Cat 3.300 25.60
Galago 0.200 5.00
Genet 1.410 17.50
Giraffe 529.000 680.00
Gorilla 207.000 406.00
Grey seal 85.000 325.00
Rock hyrax-a 0.750 12.30
Human 62.000 1320.00
African elephant 6654.000 5712.00
Water opossum 3.500 3.90
Rhesus monkey 6.800 179.00
Kangaroo 35.000 56.00
Yellow-bellied marmot 4.050 17.00
Golden hamster 0.120 1.00
Mouse 0.023 0.40
Little brown bat 0.010 0.25
Slow loris 1.400 12.50
Okapi 250.000 490.00
Rabbit 2.500 12.10
Sheep 55.500 175.00
Jaguar 100.000 157.00
Chimpanzee 52.160 440.00
Baboon 10.550 179.50
Desert hedgehog 0.550 2.40
Giant armadillo 60.000 81.00
Rock hyrax-b 3.600 21.00
Raccoon 4.288 39.20
Rat 0.280 1.90
E. American mole 0.075 1.20
Mole rat 0.122 3.00
Musk shrew 0.048 0.33
Pig 192.000 180.00
Echidna 3.000 25.00
Brazilian tapir 160.000 169.00
Tenrec 0.900 2.60
Phalanger 1.620 11.40
Tree shrew 0.104 2.50
Red fox 4.235 50.40

The dataset needs to be log transformed to meet regression assumptions. Use predict() to calculate the confidence interval and regression line for this regression and graph it on both the log/log plot and on the un-transformed data (this will require that you back-transform the coordinates for the line and confidence intervals).

Solutions

Expert Solution

Here I attach the R code :

library("MASS")
data("mammals")
head(mammals)
m=lm(body~brain,data = mammals)
summary(m)
plot(m)
y=log(mammals$body,base = exp(1))
x=log(mammals$brain,base = exp(1))
m1=lm(y~x)
summary(m1)
r=residuals(m1)
shapiro.test(r)
Box.test(r,type="Ljung-Box")
plot(m1)

predict(m1, interval = "confidence")

fit lwr upr
1 2.14024328 1.9070219 2.3734646712
2 0.84834232 0.6201570 1.0765276865
3 0.05337401 -0.1918944 0.2986423892
4 4.89870541 4.5473461 5.2500647249
5 3.35029011 3.0783753 3.6222049320

retranformed form:

exp(predict(m1, interval = "confidence"))

fit lwr upr
1 8.501506e+00 6.733007e+00 1.073452e+01
2 2.335772e+00 1.859220e+00 2.934472e+00
3 1.054824e+00 8.253941e-01 1.348027e+00
4 1.341160e+02 9.438160e+01 1.905786e+02
5 2.851100e+01 2.172308e+01 3.741999e+01

The regression line is: Y= -2.509+1.225*X

The graph of log transformed data is:

plots of un transformed data is:

just run the R code to get each output.


Related Solutions

Work these in R. Using library(resampledata) and the dataset Spruce to conduct a test to see...
Work these in R. Using library(resampledata) and the dataset Spruce to conduct a test to see if the mean difference in how much the seedling grew (in height) over the course of the study under these two treatments are significantly different from each other. Answer the following: a) Set up a hypothesis using appropriate notation. b)Find the value of the observed test statistic using R. c)Compute the P-value of the observed test statistic using a permutation distribution with N= 10^5-1....
In R: Consider dataset “juul” from library “ISwR”. (juul is a built in data set) Are...
In R: Consider dataset “juul” from library “ISwR”. (juul is a built in data set) Are the means of igf1 equal among tanner groups at 5% level? Please use the six step process to test statistical hypotheses for this research problem. Note: You need to convert tanner from numeric to factor type and ignore all the NAs.
Solve using R. You will need library(resampledata) and the dataset FlightDelays. Conduct a hypothesis test to...
Solve using R. You will need library(resampledata) and the dataset FlightDelays. Conduct a hypothesis test to see whether there is a difference in the variances of flight delay length between the two airlines. 1) Set a hypothesis for this test using appropriate notation 2) Using R, find the value of the observed test statistic 3) Using R, compute the P-value of the observed test statistic using a permutation distribution with N=10^5-1 resamples. If possible use comments so that it is...
ANSWER USING R CODE Using the dataset 'LakeHuron' which is a built in R dataset describing...
ANSWER USING R CODE Using the dataset 'LakeHuron' which is a built in R dataset describing the level in feet of Lake Huron from 1872- 1972. To assign the values into an ordinary vector,x, we can do the following 'x <- as.vector(LakeHuron)'. From there, we can access the data easily. Assume the values in X are a random sample from a normal population with distribution X. Also assume the X has an unknown mean and unknown standard deviation. With this...
Fitting a linear model using R a. Read the Toluca.txt dataset into R (this dataset can...
Fitting a linear model using R a. Read the Toluca.txt dataset into R (this dataset can be found on Canvas). Now fit a simple linear regression model with X = lotSize and Y = workHrs. Summarize the output from the model: the least square estimators, their standard errors, and corresponding p-values. b. Draw the scatterplot of Y versus X and add the least squares line to the scatterplot. c. Obtain the fitted values ˆyi and residuals ei . Print the...
The R library faraway contains the pima dataset. We will fit a model with test as...
The R library faraway contains the pima dataset. We will fit a model with test as a response and bmi (only) as a predictor to see the relationship between the odds of a patient showing signs of diabetes and his/her bmi. The odds o and probability p are related by: o = p/(1-p), p = o(1+o) Using the GLM function: a. Please estimate the amount of increase in the log(odds) when the bmi increases by 10. b. Give a 95%...
load the MASS library in R. A. Package ‘MASS’ which provides a description of the datasets...
load the MASS library in R. A. Package ‘MASS’ which provides a description of the datasets available in the MASS package. Then, answer each of the following questions using the appropriate test statistic and following formal steps of hypothesis testing. A:Test of equal or given proportions: Use the “bacteria” data set to answer the question, “did the drug treatment have a significant effect of the presence of the bacteria compared with the placebo?” B: F-test: Use the “cats” data set...
Analyze used car inventory dataset using Python's pandas library - using DataFrame data structure¶ Dataset: UsedCarInventory_Assignment1.txt...
Analyze used car inventory dataset using Python's pandas library - using DataFrame data structure¶ Dataset: UsedCarInventory_Assignment1.txt (available on Canvas) This dataset shows used cars available for sale at a dealership. Each row represents a car record and columns tell information about each car. The first row in the dataset contains column headers. You must use Pandas to complete all 10 tasks.
For mammals, basic metabolic rate (m) scales with body mass (Mb) as follows, m = 0.676...
For mammals, basic metabolic rate (m) scales with body mass (Mb) as follows, m = 0.676 * Mb^0.75 with units of the coefficient being liter O2/hr/kg. Calculate the mass-specific metabolic rate of a Shrew weighing 3.0 grams. a. 0.0087 liter O2/hr b. 2.888 liter O2/hr/kg c. 1.541 liter O2/hr d. 0.514 liter O2/hr/kg e. 0.0087 kCal/hr
The dataset ’anorexia’ in the MASS package in R-Studio contains data for an anorexia study. In...
The dataset ’anorexia’ in the MASS package in R-Studio contains data for an anorexia study. In the study, three treatments (Treat) were applied to groups of young female anorexia patients, and their weights before (Prewt) and after (Postwt) treatment were recorded. The three treatments adminstered were no treatment (Cont), Cognitive Behavioural treatment (CBT), and family treatment (FT). Determine at the 5% significance level if there is a difference in mean weight gain between those receiving no treatment and those receiving...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT