Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

QRM Instructors: A.

Hadji
4 March 2022 TAs: N.Maccarini & M.W.Moynan

Lab Assignment 4

Please before you start rename the file as “LastName FirstName Assignment4.R”
Make sure that you put your name in the first line in the file as a comment before your solutions.
Also report the outcomes of the problems and interpret the obtained numbers whenever this is
stated in the problem formulation.
Import the file “MDG dataset 2010.csv” from Brightspace
> data=read . csv ( f i l e . choose ( ’MDG d a t a s e t 2 0 1 0 . c s v ’ ) )
> attach ( data )
> names( data )

1. Perform a linear regression for the variables Internet users (per 100 people) (expla-
natory variable) and GNI per capita, Atlas method (current US $) (response varia-
ble). Are the coefficients of the regression line significantly different from zero?

2. Make a scatter plot of the variables and include the regression line and a legend (for the
line).

3. We want to plot the residuals of the linear regression in terms of the variable Internet
users (per 100 people). The function lm() atomatically deletes all observations with
missing values. Therefore, we have to do the same with the data. To this end, create a
data frame consisting of the two variables and use the command na.omit(). Then perform
a linear regression for the new data and compare with the outcome in Question 1. Make
a scatter plot of the residuals in terms of Internet users (per 100 people). (without
the missing values). Are the assumptions for linear regression satisfied?

4. Make a multiple linear regression for Adolescent fertility rate (births per 1,000
women ages 15-19) against Employment to population ratio, ages 15 24, female
(%) and Fertility rate, total (births per woman). Can you observe significant re-
lations?

You might also like