Linear regression (NMSA407)

Arnošt Komárek


Home (CZ) | Teaching (CZ) |

Teaching winter

NMSA407 | NSTP021 |

Teaching summer

NMSA230 | NMST440 |

Teaching, software

Rko (CZ) |


Diploma theses (CZ) | Bachelor theses (CZ) |

Linear regression (NMSA407)

Winter semester 2013–14


Lectures: Wednesday 15:40 in K1   
Thursday 15:40 in K1   
Exercises (MP): Wednesday 14:00 in K10A    (RNDr. Michal Pešta, Ph.D.)
Exercises (KZ): Wednesday 17:20 in K10A    (doc. RNDr. Karel Zvára, CSc.)
Exercises (AK): Wednesday 17:20 in K10B   
  • Lectures and exercises AK & MP will be taught in English, exercises KZ will be taught in Czech.


  • Exam Dates (We 15/01, Th 23/01, Th 30/01, We 05/02, We 12/02 as already earlier announced) are open for enrollment in SIS. Capacity of each term is 20 students. When planning other activities, please, be aware of the fact that the oral part of the exam may take place the day following the announced exam date.

    To be admitted to the written part of the exam, student must be in possession of the course credit (zápočet) recorded at least in SIS. It is also requested to carry an index at all parts of the exam.

    Everybody who actively exploits at least one of the first four terms (15/01 – 05/02) and fails will be allowed to attend the last term on 12/02 even if its SIS capacity will be full. The term on 12/02 is the last one in this academic year.

  • Assignments of Exam Projects were sent to all students via e-mail (to the e-mail address recorded in SIS) on December 19. Anybody who has not received an e-mail with the project assignment is advised to contact the lecturer.

  • Lectures will combine a slide presentation with a blackboard writing. The PDF version of the slides suitable for printing will gradually become available for download in the ``LECTURE MATERIALS'' section of this page. Students are advised to bring the printed slides to the lectures and supplement them (either directly or on separate sheets of paper) by additional derivations, notes etc. that will be shown only on the blackboard.


Summary of Exam Requirements is available here (PDF).
Assignments of the Written Exam from 20140115 including (hand-written) solutions (as detailed as expected to be granted the maximal number of points) are available here (PDF).

  • Exam grade will be based on three parts:
    1. Take home project (practical analysis), results delivered in a form of a written report three working days prior to the exam date. Assignments will be published latest on December 23, 2013.
    2. Written part composed of theoretical and semi-practical assignments (no computer analysis).
    3. Oral part composed of the project defense and additional questions.
  • To be admitted for the written part of the exam, the project must be delivered on time and in a sufficient minimal quality (to be defined together with the publication of the project assignments). Non-admission to the written part of the exam results in a grade ``Fail'' (4).
  • To be admitted for the oral part of the exam, the written part must result in a minimal number of points (to be defined with the assignment). Non-admission to the oral part of the exam results in a grade ``Fail'' (4).
  • The oral part of the exam takes place either in the afternoon of the same day as the written part or the day after the written part.
  • The exam dates for the written part will be communicated in due time via SIS. All exam dates will be in a period January 6 – February 14, 2014. There will be no exam dates during the summer term or later!


NMSA407-4on1.pdf     ALL SLIDES     (published 20131219)
NMSA407-4web-00.pdf     Practical Issues     (published 20130913)
NMSA407-4web-01.pdf I. Linear Model (published 20130913)
NMSA407-4web-02.pdf II. Least Squares Estimation (published 20130913)
NMSA407-4web-03.pdf III. Normal Linear Model (published 20130926)
NMSA407-4web-04.pdf IV. Basic Interpretation of Estimated Linear Model (published 20130926)
NMSA407-4web-05.pdf V. Submodel (published 20131003)
NMSA407-4web-06.pdf VI. Generalized Least Squares (published 20131003)
NMSA407-4web-07.pdf VII. Maximum-likelihood Estimation in a Full-Rank Normal Linear Model (updated 20131113)
NMSA407-4web-08.pdf VIII. Less-Than-Full-Rank Linear Model (published 20131017)
NMSA407-4web-09.pdf IX. Multiple Comparison Procedures in a Linear Model (published 20131017)
NMSA407-4web-10.pdf X. Regression Diagnostics (published 20131113)
NMSA407-4web-11.pdf XI. Model Building (updated 20131215 – typo corrections)
NMSA407-4web-12.pdf XII. Asymptotic Properties of LSE and Sandwich (updated 20131219)
NMSA407-4web-appA.pdf Appendix: Matrices (updated 20131209 by Section XV.3)
NMSA407-4web-appB.pdf Appendix: Distributions (published 20130926)


Those who are not too familiar with the R software are adviced that they already before the first exercises session go through R-related materials available on the webpage of the NMSA230: Software for Mathematics and Stochastics course.

Most datasets we will be working on during the exercices sessions plus few smaller R functions are available in a form of extension R package mffSM which can be installed ``from a local repository'' upon its download from the appropriate link below. Windows binary file is intended for the MS Windows users (as the title suggests), the source code is intended for those users who are used to compile their software from the source (mostly Linux, Mac etc. users). The mffSM package depends on few extention packages which are available in a standard way from CRAN. All those dependency packages will be automatically installed if the installation of the mffSM package is performed directly from the R console on an Internet-connected computer using the command (its appropriately modified analogy):
install.packages("C:/WHERE_DOWNLOADED/", repos = NULL)

The mffSM package might be updated during the semester. If this happens, the version number (like 0.2) will be increased and new files will be available.

Windows binary:    (published 20131201)
Source code:    mffSM_0.2.tar.gz    (published 20131201)
Code of LSest and plotLM functions:    LSest_plotLM.R    (published 20131203)

R scripts and assignments for exercises

Exercises 1 (02/10)    nmsa407-E01.R    (published 20130923)
Exercises 2 (09/10)    nmsa407-E02.R    (published 20130923)
Exercises 3 (16/10)    nmsa407-E03.R    (published 20130923)
Exercises 4–5 (30/10–06/11)    nmsa407-E04.R    (published 20131017)
   Data for Exercises 4:    peat.csv   
Exercises 5–6 (06/11–13/11)    nmsa407-E05.R    (updated 20131113)
Exercises 6, 8 (13/11, 27/11)    nmsa407-E06.R    (published 20131024)
Exercises 7 (20/11)    Maximum-likelihood estimation in a normal linear model.
Complete and sufficient statistics in a normal linear model.
Optimality of LSE in a normal linear model.
Exercises 9 (04/12)    nmsa407-E07.R    (published 20131201)
Exercises 10, 11 (11/12, 18/12)    nmsa407-E08.R    (published 20131209)
   Data for Exercises 10:    chicago.csv   
Exercises 12 (08/01)    nmsa407-E09.R    (published 20131218)

Homeworks assignments

Homework 1 (09/10 – 24/10)    nmsa407-E02.R    (published 20130923)
Homework 2 (06/11 – 20/11)    nmsa407-HW02.R    (published 20131106)
Homework 3 (04/12 – 25/12)    nmsa407-HW03.R    (published 20131204)


To get a course credit (zápočet), student must satisfy to both of the following requirements:

  1. Attendance to the exercises sessions in a group according to the SIS enrollment.
    • Attendance to one exercises session means a self-possessed presence during at least 80 minutes of a particular session.
    • It is possible to miss three sessions (no apology is required).
    • Exceptionally, a planned absence to a particular session can be compensated by attending the exercises session with another group in the same week providing both lecturers (of the student's and the other group) agree. In case student wishes to attend the exercises session with the other group, he/she has to notify his/her lecturer personally at the end of the session in the week before the planned absence and personally or via e-mail the lecturer of the other group during the week which precedes the week he/she wishes to attend the exercises session with the other group.
  2. Getting at least 21 points for a timely delivery of assigned homeworks worked out in a reasonable quality.
    • During the semester, three homeworks will be assigned with indicated deadline of delivery (usually 2 weeks after the assignment). Maximum 10 points can be obtained for each homework.
    • The homework assignments will be worked out in a group of 1 – 3 students (different groups can be formed for different homeworks).
    • For each homework, the following evaluation will be used:
      • (A) reasonably well worked out homework, 10 points;
      • (B) not sufficiently well worked out homework but it is possible to improve it. Students get a chance to deliver improved document in an indicated amount of time (usually one week). If it will be possible to evaluate the improved document as ``reasonably worked out'', 7 points will be granted. Otherwise, 0 points will be given;
      • (C) not sufficiently well worked out homework and it is not possible to improve it, 0 points.
    • For each homework a report prepared using a suitable software for document preparation (LaTeX, OpenOffice Writer, MS Word, ...) must be deliverd in a paper form (one document per group with the names of the group members clearly stated on top of the title page). Any e-mails sent to the lecturers containing the homework reports will be deleted without being read and the homework will be evaluated as (C) (if not delivered on time in a paper form).
    • The language of the homework reports might be either English or Czech/Slovak (irrespective of the language in which a particular exercises session is taught). Nevertheless, only one language must be used inside a single document (this includes also labels in tables or plots). For purpose of this rule, Czech and Slovak are considered as one language (i.e., it is allowed to mix them in a reasonable way within one document). Absence of diacritics in plots will be tolerated.
    • The general evaluation rules will be the following:
      • (A) reasonably well formatted document with a negligible number of typos and grammatical errors showing a seriously meant attempt to solve all assigned problems with the solution being without gross errors. Less serious errors, certain awkwardness etc. will be tolerated;
      • (B) document being either not reasonably well formatted or with an excessive number of typos or grammatical errors or with some problems being solved with more serious or gross errors. To be granted by evaluation (B), it must still be clear from the delivered document that a serious attempt was taken to solve all assigned problems (it is a right of the lecturer to decide whether the attempt was ``seriously meant'');
      • (C) the following events will mostly lead to evaluation (C):
        • late or no delivery of the report;
        • solution to some problems is considered as ``not being seriously meant'';
        • plagiarism which means that two or more versions of the same document will be delivered to any of the lecturers (it is not excluded that all reports of one homework will be graded by a single lecturer). In this case authors of all multiple reports will be evaluated by (C). The following actions (among others) usually lead to the documents being considered as identical: translation from one language to another, word order changes (and otherwise practically identical sentences structure), font or other formatting changes. Due to a richness of any human language, probability of delivering a unique report is practically one if before delivery the report is seen only by authors.


  • Exceptions out of the above rules are possible only in cases worthy of consideration where it is an eminent domain of each lecturer to decide what a ``case worthy of consideration'' means. It is also a right of each lecturer to ask for appropriate proofs. Student who thinks that he/she should be treated as a ``case worthy of consideration'' must contact the lecturer (personally or via e-mail) latest 7 days after the reasons for such treatment come into being (exception out of this rule are conditions which objectively do not allow to contact the lecturer, e.g., a ship wreck, unconsciousness, detention, ...). When notified, the lecturer informs student which parts of the above requirements can be avoided or how they can be compensated.
  • The following events will usually be considered as ``cases worthy of consideration'':
    • a long-lasting or chronic disease or injury requiring permanent or long-lasting (more than two weeks) therapy not allowing to attend the lectures,
    • detention or imprisonment.
  • The following events will never be considered as ``cases worthy of consideration'':
    • long-lasting study stay at other institution (Erasmus, ...). In cases student completes during his/her stay at other institution a course similar to NMSA407, he/she can apply for a recognition of the NMSA407 course at a study branch guarantee (doc. D. Hlubinka for ``PMSE'' branch, doc. J. Hurt for ``FPM'' field);
    • out-of-school activities (including jobs). This lecture is taught in the framework of a full-time study programme so there are no reasons to consider any out-of-school activities being superior to school activities.
    • transport irregularities, sudden qualm, common short-lasting diseases (flu, ...). The number of allowed absences (3) means 1/4 of all exercises sessions (there will be 12 exercises sessions). This should be more than enough (unless student is really, really unlucky person) to cover unexpected absences due to mentioned (and similar) reasons. Briefly, the allowed absences should only be used to cover unexpected events and not to take a holiday during the semester.


View My Stats