a).
library(alr4)
data(wblake)
head(wblake)
To fit this model,
Our response varaible (y) is "Length" and predictor variable (x) is "Age"
M1=lm(Length~1+Age,data=wblake)
summary(M1)
Output:
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 65.5272 3.1974 20.49 <2e-16 ***
Age 30.3239 0.6877 44.09 <2e-16 ***
---------------------------------------------------------------------------------------------------------------------
b).
90% confidence interval for slope (i.e. ) is
is the critical t value for n-2 degree of freedom.
Degree od freedom = n-2 = 439-2 = 437 (Total no. of observation in wblake data is 439)
Therefore, critical t value at () for 437 degree of freedom is calculated in R as:
qt(1-0.10/2,437)
1.65
From (1), we have
------------------------------------------------------------------------------------------------------------------------
3. R programming 3. This problem uses the wblake data set in the alr4 package. This...
3. This problem uses the wblake data set in the alr4 package. This data set includes samples of small mouth bass collected in West Bearskin Lake, Minnesota, in 1991. Interest is in predicting length with age. Complete this problem without using Im) in R. (a) Do the regression of length on age, and report the estimates, their standard errors and the estimate of variance. Interpret Bo and B. (b) Obtain a 90% confidence interval for A from the data. Interpret...
R programming question. Please use #comments too ! 1. The data set UN11 in the alr4 package contains several variables, including ppgdp, per capita gross domestic product in US dollars, and fertility, number of children per woman, from the year 2009-2011. The data are for 199 localities, and we will study the regression of ppgdp on fertility (a) Draw the scatterplot of ppgdp against fertility and describe the relationship between these two variables. Is the trend linear? nD the simple...
2. R programming 2·The data set prostate in the faraway package is froma study on 97 men with prostate cancer who were due to receive a radical prostatectomy We are interest is in predicting lpsa (log prostate specific antigen) with Icavol (log cancer volume). (a) Draw a scatterplot -does a simple linear regression model seem reasonable? (b) Without using the R function Im), compute the values T,Y, Sxx, Syy and Sxy. Com- pute the ordinary least squares estimates of the...
1. The data set UN11 in the alr4 package contains several variables, including ppgdp, per capita gross domestic product in US dollars, and fertility, number of children per woman, from the year 2009-2011. The data are for 199 localities, and we will study the regression of ppgdp on fertility. (a) Draw the scatterplot of ppgdp against fertility and describe the relationship between these two variables. Is the trend linear? (b) Replace both variables by their natural logarithms and draw another...
2. The data set prostate in the faraway package is from a study on 97 men with prostate cancer who were due to receive a radical prostatectomy. We are interest is in predicting lpsa (log prostate specific antigen) with lcavol (log cancer volume). (a) Draw a scatterplot - does a simple linear regression model seem reasonable? (b) Without using the R function Im(0, compute the values , Y,Sxx, Syy and Sxy. Com pute the ordinary least squares estimates of the...
Exercise 2. [Data analysis, requires R] For this questions use the bac data set from the openintro library. To access this data set first install the package using install.packages ("openintro") (this only needs to be done once). Then load the pack- age into R with the command library(openintro). You can read about this data set in the help menu by entering the command ?openintro or help(openintro). Many people believe that gender, weight, drinking habits, and many other factors are much...
R Programming Language This question uses the lattice package. Show the code you used to generate the graphs. Use the state.region and state.x77 data set (recall typing ?state.x77 into the console will provide a discription of this data set). Question 1a Investigate the population density of USA states within the four regions: Northeast, South, North Central and West. Observe the graph of State Population as a Function of Area. Create Figure 1. Question 1b There is one state in the...
3. (40 points) Use the graph, an output of the least squares prediction equation for the starting salary data (in thousands of dollars) given a graduated student's cumulative GPA, and the table of sampled data below to do the following Student ID GPA(x) 3.26 Starting Salary (y) 33.8 2.60 29.8 3.35 33.5 2.86 30.4 3.82 36.4 2.21 27.6 3.47 35.3 Regression Plot Y= 14.8156 + 5.70657x R-Sq 0.977 寸 853 4.0 2.0 2.5 3.0 3.5 GPA (a) Identify and interpret...
Please use RStudio, thanks! 3. This problem uses the prostate data set in the faraway package. (a) Plot lpsa against lcavol. Use the R function lm() to fit the regressions of lpsa on lcavol and lcavol on lpsa. (b) Display both regression lines on the plot. At what point do the two lines intersetct? Give a brief explanation.
Using R code: A researcher collects data on the relationship between the amount of daily exercise a person gets and their percent of body fat. She is trying to see if exercise (X) can predict percentage of body fat (Y). The following data were recorded: Individual 1 2 3 4 5 Daily Exercise (min) (X) 10 18 26 33 44 % Fat (Y) 30 25 18 17 14 a. Draw a scatterplot that represents this data set with linear and lowess...