Question

In: Math

Use the R script to answer the following questions: (write down your answers in the R...

Use the R script to answer the following questions: (write down your answers in the R script with ##)

(1). Import FarmSize.csv to Rstudio. Use the correct function to build a linear regression model predicting the average size of a farm by the number of farms; Give the model a name (e.g. FarmSize_Model). Call the model name to inspect the intercept and slope of the regression model. Verify the answers in your manual calculation.

(2). Use the correct function to generate the residuals for the 12 examples in the dataset from the model. Create a residual plot, with x axis as independent variable and y axis as residual.

(3). Use the correct function to inspect SSE, Se and r². Write down the values for these measures. Verify the answers in your manual calculation.

(4). Use the correct function to inspect slope statistic testing result. What is the t value for the slope statistic testing? What is the p value? What is the statistical decision?

Year NumberofFarms AverageSize
1950 5.65 213
1955 4.65 258
1960 3.96 297
1965 3.36 340
1970 2.95 374
1975 2.52 420
1980 2.44 426
1985 2.29 441
1990 2.15 460
1995 2.07 469
2000 2.17 434
2005 2.1 444

Solutions

Expert Solution

Ans :

1) R-code :

d=read.csv("C:/Users/Dell/Desktop/FarmSize.csv",header=TRUE);d
FarmSize_Model=lm(AverageSize~., data =d)
summary(FarmSize_Model)

Output:

Coefficients:
(Intercept) NumberofFarms  
600.19 -72.33

AverageSize =   600.19 -72.33 *NumberofFarms

2) Residuals for the 12 examples R -code

FarmSize_Model$residuals[12]

Output:

-4.297088

Residual plot where, x axis as independent variable and y axis as residual.

R-plot :

For image 1)

FarmSize_Model1=lm(NumberofFarms~., data =d)
summary(FarmSize_Model1)
plot(FarmSize_Model1)

For image 2)

plot(FarmSize_Model)

3) R-code :

summary(FarmSize_Model)

Output :

Coefficients:

Estimate Std. Error t value Pr(>|t|)   

(Intercept) 600.186 11.711 51.25 1.93e-13 ***

NumberofFarms -72.328 3.631 -19.92 2.24e-09 ***

---

Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 14.03 on 10 degrees of freedom

Multiple R-squared: 0.9754, Adjusted R-squared: 0.973

F-statistic: 396.7 on 1 and 10 DF, p-value: 2.235e-09

4) R- code :

summary(FarmSize_Model)

Ans :Hypothesis

Ho: Β1 = 0

Ha: Β1 ≠ 0

t-value for the slope statistic testing = -19.92

p value = 4.48e-09

statistical decision : p-value is less than significance level so we reject the null hypothesis. i.e. slope of the equation is not equal to zero.


Related Solutions

Use the R script to answer the following questions: (write down your answers in the R...
Use the R script to answer the following questions: (write down your answers in the R script with ##) (1). Import FarmSize.csv to Rstudio. Use the correct function to build a linear regression model predicting the average size of a farm by the number of farms; Give the model a name (e.g. FarmSize_Model). Call the model name to inspect the intercept and slope of the regression model. Verify the answers in your manual calculation. (2). Use the correct function to...
Write down your answers to the following question and upload a scanned copy of your answer...
Write down your answers to the following question and upload a scanned copy of your answer on blackboard (e.g. using the Adobe Scan App on your phone). Only PDF documents will be accepted. Suppose the long-run production function of Curry’s brewing company is given by: Q = 3K0.25L0.75. K is the total operating hours of all brewing machines and L is the total working hours of all workers. Q is the number of beers produced per day. The current rental...
Answer the following three questions. You can use any reference to write your answers (e.g., textbook,...
Answer the following three questions. You can use any reference to write your answers (e.g., textbook, articles, internet web pages, etc.). However, you have to use your own words. No Cheating. No plagiarism. 1. Your boss told you that he wants to put you on charge of the opening ceremony for company new plant in Jeddah. He gives you the authority to choose your team members and to make all necessary decisions. The ceremony will be held on October 30th....
Prepare a skills audit for yourself. Ask yourself the following questions and write down your answers....
Prepare a skills audit for yourself. Ask yourself the following questions and write down your answers. What are the skills you wish to develop? How are you going to develop them? What action needs to be taken? What time frame is required? Select one of the development skills which you have identified and develop a professional development program that will provide the necessary training. Document your plan (220–250 words) and provide reasons for the professional development strategies you have chosen.
R studio questions Write up your answers and paste the R code Copy and paste all...
R studio questions Write up your answers and paste the R code Copy and paste all plots generated. First create a sample drawn from a normal random variable. R has many distributions for which you can get probabilities and draw random numbers. We are going to use the normal. Go to help in R and type in rnorm. You will see a write up for functions associated with the normal distribution. dnorm is the density; pnorm is the probability distribution...
Write an R Script that does the following for "sampleData1.dta"
Write an R Script that does the following for "sampleData1.dta" a) Regress "earn," "adcc," and "tinc" on a constant. b) Regress earnings on "higrade," "age," and "agesq." Display TSS, RSS, ESS and R Squared Value c) Reestimate the regression from pt. b, this time omitting the constant term.  
answer the following questions and use the financial statement ratios to support your answers where appropriate:...
answer the following questions and use the financial statement ratios to support your answers where appropriate: Do you feel that the company is able to meet its current and long term obligations as they become due? Comment on the profitability of the company with respect to the various profitability ratios that you computed. Would you lend money to this company for the long term? Comment on the ability of the company to collect its receivables and mange inventory. Ratios before...
Use the Dynamic Exhibit to answer the following questions. Round your answers to two decimal places,...
Use the Dynamic Exhibit to answer the following questions. Round your answers to two decimal places, if necessary. 1. When the number of units produced is 50,000, the total fixed cost is $ 500,000 and the cost per unit is $ . 2. When the number of units produced is 100,000, the total fixed cost is $ and the cost per unit is $ . 3. When the number of units produced is 150,000, the total fixed cost is $...
Using the R script, answer the following questions. Please show all works for full credit. 1....
Using the R script, answer the following questions. Please show all works for full credit. 1. Suppose you invest $150,000 into your mutual fund account on January 1st, 2019. a) [5 points] What would the account balance be at the end of June, 2019 if the account carries a rate of return of 2% every month? b) [5 points] If you earn a 4% return in July and a 5% return in August, 2019, what would the account balance be...
Write a R-script to (and show the outputs of your code) (a) Create a sequence of...
Write a R-script to (and show the outputs of your code) (a) Create a sequence of numbers starting at 3.5 and ending at 10.7 with increments of 0.79. Find the variance and mean of those numbers. And finally sort the vector in a decreasing manner (b) Create a 3 different 3 by 3 matrices such that each of the numbers 1,2,...,9 appear exactly once (Sudoku style) in each of the matrices.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT