0% found this document useful (0 votes)
2 views2 pages

STA302H1S Lecture2 Problem Set

The document outlines a problem set for STA302H1 Methods of Data Analysis I, focusing on multiple linear regression and data analysis techniques. It includes various problems requiring calculations of matrix dimensions, least squares estimates, and regression modeling using specific datasets. Additionally, it encourages the use of R for data analysis and justifications for model appropriateness.

Uploaded by

prashant sir
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

STA302H1S Lecture2 Problem Set

The document outlines a problem set for STA302H1 Methods of Data Analysis I, focusing on multiple linear regression and data analysis techniques. It includes various problems requiring calculations of matrix dimensions, least squares estimates, and regression modeling using specific datasets. Additionally, it encourages the use of R for data analysis and justifications for model appropriateness.

Uploaded by

prashant sir
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

STA302H1 LEC5101 - Methods of Data Analysis I

Lecture 2: Problem set

Basis Learning objective practice


Problem 1.
Write out the dimension (i.e. number of rows and columns) of the matrix X for a multiple
linear model that includes 7 predictors from a sample of 45 observations.

Problem 2.
Use the data below to answer the following questions.

y x1 x2
−0.2 0.5 0.5
−1.1 0.8 0.7
−0.8 0.6 −0.5
−0.7 −0.2 −0.5

1. Compute X⊤ X without using R.

2. Compute X⊤ y without using R.

3. Use  
0.7 −1.2 0.5
(X⊤ X)−1 = −1.2 2.9 −1.2
0.5 −1.2 1.3
to compute the least squares estimates without using R.

1
Problem 3.
Rencher & Schaalje: Chapter 7, Problems 7.1 & 7.3, page 178.

Problem 4.
(Similar to Rencher & Schaalje: Chapter 7, Problem 7.54 (a), pages 182-183.)

Use the “[Link]” dataset. Use this dataset to compute β̂ and σ̂ 2 .

Problem 5.
Pardoe: Chapter 3, Problem 3.1 (a)-(c), page 132. Use the “[Link]” dataset.

Advanced learning objective practice


Problem 6.
We want to develop a regression equation to model the relationship between Y , salary (in
thousands of dollars) and x, the number of years of experience. The professional salary data
can be found on the course textbook (Sheather) web site in the file [Link]. The
data is also available on Quercus under the Week 2 materials. Load this data in R by using
the following R command:

df=[Link](“[Link]”, header=T)

(a) Consider the simple linear regression model Y = β0 + β1 x + ϵ where Y = salary and
x = years of experience. Fit the model in R. Is the simple linear regression model
appropriate for the professional data? Justify your answer.

(b) (Polynomial regression) Now, add a quadratic term in x to the simple linear regres-
sion model and consider the following polynomial regression model:

Y = β 0 + β 1 x + β 2 x2 + ϵ

where Y = salary and x = years of experience. Perform the least squares fitting for
the polynomial regression model. Is this model appropriate for the professional salary
data? Justify your answer.

Common questions

Powered by AI

Manually performing matrix calculations deepens understanding of underlying regression mechanics, fostering critical thinking about data structure and estimator derivation, which is crucial for mastering statistical concepts beyond software reliance. This practice enhances comprehension of error sources, linear algebra's role in statistics, and intuition for model adjustments, making it pedagogically valuable despite its time-intensive nature and potential for computation errors .

The least squares estimates can be calculated using the formula (X⊤X)−1X⊤y by first obtaining the inverse of X⊤X, then computing the product of (X⊤X)−1 and X⊤, and finally multiplying the result by vector y. This process requires the matrix X's dimensions for transposition, and values in X, X⊤X, and y vector to perform precise calculations .

Adding a quadratic term to a regression model introduces non-linearity, allowing the model to fit data that has a curvilinear relationship between variables. For professional salary data, this might capture nuances like faster salary increase at specific experience levels. Interpreting the results involves assessing the significance of the quadratic term's coefficient and noting changes in R-squared values. A significant positive coefficient for the quadratic term suggests a convex upward curve, indicating accelerating salary growth with experience .

Computing X⊤y without software involves manually multiplying the transpose of matrix X with vector y, which requires precise handling of numerical operations to avoid errors, particularly with large datasets. Interpreting this product is challenging without visualization, as it involves understanding how each predictor contributes to the response, implicitly capturing the data's structure and relationship context .

Polynomial regression fitting requires adding a quadratic or higher-order term to capture non-linear relationships, therefore expanding input variables. Steps include transforming the dataset to include the polynomial term(s), fitting the regression model using least squares, visualizing fit with residuals, and comparing model performance metrics like R-squared with simple linear regression to determine improved fit. It differs from simple linear regression by allowing fit flexibility at the cost of increased complexity and risk of overfitting .

To evaluate whether a simple linear regression model is appropriate, one should examine the residuals for normality, patterns, and homoscedasticity using residual plots. Additionally, the goodness of fit can be assessed through R-squared and Adjusted R-squared values considering the professional salary data context. Analyzing the F-statistic and p-values of the model coefficients is also essential to determine statistical significance .

Using datasets like 'GasVapor.csv' allows for robust calculation of β̂ and σ̂2 through real data applications, enhancing understanding of variable interactions. However, risks include data quality issues such as missing values, multicollinearity, or heteroscedasticity, which could bias estimates, and the potential difficulty of ensuring dataset relevance and accuracy for the specific regression model under study .

Matrix inversion of (X⊤X) is crucial for estimating the least squares but can lead to instability if (X⊤X) is ill-conditioned, often due to multicollinearity among predictors. Manual computations amplify the risk of numerical errors and misinterpretations of negative or infinite estimates, especially when determinant values are near zero, reflecting a potential singular matrix .

The matrix X for a multiple linear model with 7 predictors from a sample of 45 observations has the dimension 45x8. This includes one intercept term, hence 7 predictors plus 1 for the intercept total to 8 columns, with 45 rows corresponding to each observation .

To compute X⊤X manually, take the transpose of matrix X and perform matrix multiplication with the original matrix X. The transpose involves swapping rows and columns, so if X is of dimension 45x8, X⊤ will be of dimension 8x45. When performing multiplication, each element in the resulting X⊤X matrix is computed as the sum of the products of corresponding entries from the rows of X⊤ and the columns of X .

You might also like