Linear Regression with One Regressor
General Information
Exercise covers linear regression with one regressor.
Data is available in the corresponding folder on Ilias.
Task 1: Linear Regression with One Regressor
Objective: Examine the linear relationship between the number of rooms and monthly rent.
Data from rental apartments in Lucerne:
Example values:
Price: 1,538 (2.5 rooms), 3,651 (6.0 rooms), etc.
Compute coefficients:
(slope) and (intercept).
Predict rental prices for:
5.5-room and 3.5-room apartments.
Task 2: Linear Regression Analysis
Utilize a larger dataset for analysis in R.
Steps:
Set up the R environment using
tidyversepackage.Import dataset:
rental_data_lucerne.csv.Examine data structure and summary statistics, and check for missing values.
Use histograms to explore variable distributions.
Perform linear regression analysis:
Interpret the coefficient of determination.
Create a scatterplot with a fitted linear regression line overlay.