Question

In: Math

Please answer using R code! install.packages("wooldridge") require("wooldridge") d1 <- data("attend") View(attend) Q) Draw as scatter plot...

Please answer using R code!

install.packages("wooldridge")
require("wooldridge")
d1 <- data("attend")
View(attend)

Q) Draw as scatter plot of stndfnl against priGPA. Customize your plot, such as give it a title, x-axis and y-axis labels, and you may put nice color to make it pretty. Run a simple regression of stndfnl on priGPA and save regression model as reg1. Are these variables related in the direction you expected? Interpret your estimated slope and intercept coefficient? Now run a multiple regression of stndfnl on priGPA and dummy variable frosh and soph. Interpret the coefficient of soph.

Solutions

Expert Solution

R-code:

library("wooldridge")
d1=data("attend")
View(attend)
attend$stndfnl
attend$priGPA

#scatterplot of stndfnl and priceGPA
plot(attend$stndfnl,attend$priGPA)

#simple regression of stndfnl on priGPA
reg1=lm(attend$stndfnl~attend$priGPA)
reg1

#multiple regression of stndfnl on priGPA and dummy variable frosh and soph.
lm(attend$stndfnl~attend$priGPA+attend$frosh+attend$soph)

R-output:

> library("wooldridge")
> d1=data("attend")
> #scatterplot of stndfnl and priceGPA
> plot(attend$stndfnl,attend$priGPA)


> #simple regression of stndfnl on priGPA
> reg1=lm(attend$stndfnl~attend$priGPA)
> reg1

Call:
lm(formula = attend$stndfnl ~ attend$priGPA)

Coefficients:
(Intercept) attend$priGPA  
-1.6898 0.6647  

> #a multiple regression of stndfnl on priGPA and dummy variable frosh and soph.
> lm(attend$stndfnl~attend$priGPA+attend$frosh+attend$soph)

Call:
lm(formula = attend$stndfnl ~ attend$priGPA + attend$frosh +
attend$soph)

Coefficients:
(Intercept) attend$priGPA attend$frosh attend$soph  
-1.64466 0.68642 -0.05111 -0.15513

#slop and intercept of reg1 are 0.6647 and -1.6898 respectively

#coefficient of soph -0.15513


Related Solutions

Does anyone know the code to use in R programming to create a scatter plot?
Does anyone know the code to use in R programming to create a scatter plot?
The Book of R (Question 20.2) Please answer using R code. Continue using the survey data...
The Book of R (Question 20.2) Please answer using R code. Continue using the survey data frame from the package MASS for the next few exercises. The survey data set has a variable named Exer , a factor with k = 3 levels describing the amount of physical exercise time each student gets: none, some, or frequent. Obtain a count of the number of students in each category and produce side-by-side boxplots of student height split by exercise. Assuming independence...
Use the following data to: draw a scatter plot, find the coefficient correlation, find the regression...
Use the following data to: draw a scatter plot, find the coefficient correlation, find the regression line, predict y' for x =90. First Test - X Final test Y 73 70 86 80 93 96 92 85 72 68 65 68 58 62 75 78
Answer IN R CODE please. Using the data below, Create a scatterplot of y vs x...
Answer IN R CODE please. Using the data below, Create a scatterplot of y vs x (show this) and fit it a simple linear regression model using y as the response and plot the regression line (with the data). Show this as well. Test whether x is a significant predictor and create a 95% CI around the slope coefficient. What does the coefficient of determinations represent? For x=20, create a CI for E(Y|X=20). Show this. For x=150, can you use...
Generate a scatter plot of this data, and include a smoothed function using smooth.spline function in...
Generate a scatter plot of this data, and include a smoothed function using smooth.spline function in R. Use predict function in R to calculate the 95% bounds (confidence band) for the mean, and plot them on the same scatterplot (use lty=2, and col=3). How would I go about writing this code in R?
There are four numeric columns in R programming language's iris data set. Create a scatter plot...
There are four numeric columns in R programming language's iris data set. Create a scatter plot between the four numeric columns using R programming language and give answers to the following parts. Calculate the correlation between each pair of the four numeric columns in iris. Which pair of variables has the strongest linear relationship? Interpret their ??. Which pair of variables has the weakest linear relationship? Interpret their ??. Which pair(s) of variables can you conclude have a population correlation...
Go into R and view all of the data sets preloaded in R by using the...
Go into R and view all of the data sets preloaded in R by using the data() command. As you see there are quite a few data sets loaded into R. Now retrieve the dataset women using data(women). This data is from a random sample of 15 women, recording the height and weight of each woman in the sample. I want you to create a 95% confidence interval for the population mean using this data and R. First find the...
Answer IN R CODE to get the following. Using the data below, Create a scatterplot of...
Answer IN R CODE to get the following. Using the data below, Create a scatterplot of y vs x Fit a simple linear regression model using y as the response and plot the regression line (with the data) Test whether x is a significant predictor and create a 95% CI around the slope coefficient. Report and interpret the coefficient of determination. For x=20, create a CI for E(Y|X=20). For x=150, can you use the model to estimate E(Y|X=150)? Discuss. Does...
I'm working on a scatter-plot program in Python using Pandas, Matplotlib, Numpy, etc. I'm pulling data...
I'm working on a scatter-plot program in Python using Pandas, Matplotlib, Numpy, etc. I'm pulling data from a CSV file, which has no names, just numbers. All I did was to read a .csv file. How do I pull data from three columns which contains about 1500 rows with just numbers and make a scatter plot with two in the x-axis and the third in the y-axis?
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT