M7777 Applied Functional Data Analysis 9. Functional Response with Scalar Covariate Jan Koláček (kolacek@math.muni.cz) Dept. of Mathematics and Statistics, Faculty of Science, Masaryk University, Brno Jan Koláček (SCI MUNI) M7777 Applied FDA Fall 2019 1/31 Functional Response Models Functional ANOVA Just as in the standard ANOVA, let be K (K > 3) groups and K Xij(t)... /-th curve in j-th group, / = 1,..., ny, n — nj 7=1 An over-all mean m = , K nj *(0 = -EEx /5/(t) depends on b. Let t = (ti,..., t/v), y; = (y/(ti), • • • ,yi(ti\i))f, generally, we minimize penalized least squares and get the estimate b = y2cMapy. Estimate the covariance matrix 1 " Z = _ 22 where ^' = y' ~~ z'^(*)- n - K ;=i Thus (formally) Var&(t) = 0/(t)y2cMapiy2cMap'0/(t)/. Jan Koláček (SCI MUNI) M7777 Applied FDA Fall 2019 7 / 31 Functional Response Models Estimates of ßj{t) 20 10 CD CD -10 -20 20 10 Canada ■ ^ — 4 - \\ A T 1/ l/l V ---- 1 11 l/l l/l Ml-- (1 1 — ---- s V — '/' '/>' \\ < / / / / \\ ✓ Atlantic "■■*-■ . — - ✓ : - - - -«. _ ^ ^ ~" N» > — Continental - ^ - — N - ✓ \ S -10 -20 Pacific 1 — " x \ \ *^X N S N ✓ N X x X > X ^ X x **" — Arctic s — ~ " ™ X X ✓ X X - X > ^ , ✓ / ✓ ■««. x X. X ""* *«. ✓ X ^ — X ^ ^ 100 200 300 100 200 300 100 200 Days 300 Jan Koláček (SCI MUNI) M7777 Applied FDA Fall 2019 8/31 Functional Response Models Jan Koláček (SCI MUNI) M7777 Applied FDA Fall 2019 9 / 31 Functional Response Models Assessing the fit of the fANOVA Residuals 15 10 CO "O s. 0 -10 place — Arvida - Quebec - Bagottville - Regina — Calgary - Resolute — Dawson - — Sherbrooke — Edmonton - Scheffervll - Fredericton - - St. Johns - Halifax - Sydney - Charlottvl - The Pas - Churchill — Thunder Bay — Inuvik — Toronto - Iqaluit - Uranium City - Kamloops Vancouver — London - - Victoria — Montreal - — Whitehorse - Ottawa — Winnipeg - Pr. Albert — Yarmouth - Pr. George - — Yellowknife - Pr. Rupert 100 200 Days Jan Koláček (SCI MUNI) M7777 Applied FDA Fall 2019 10 / 31 Functional Response Models Jan Koláček (SCI MUNI) M7777 Applied FDA Fall 2019 11 / 31 Functional Response Models F-statistic To test significance, we can define a pointwise F-statistic Var(y(t)) F(t) = — i=l indicates where there is a large amount of signal relative to variance. Test over-all regression significance based on F* = maxF(t). Jan Koláček (SCI MUNI) M7777 Applied FDA Fall 2019 12 / 31 Functional Response Models Permutation Test We would like to test the null hypothesis H0:Ey(t) = 0 Vte[tutN] Do b times O Permute indexes 1,..., n to get /'i,..., in, leaving the design unchanged. © Define yf{t) = y/,(t). © Estimate the model using yb(t) as the response. O Measure FT and set if F* > F if F* < F Then p-value for the test b=l Jan Koláček (SCI MUNI) Functional Response Models Canadian Weather b = 200, pb = 0 ■H2 w as I 100 200 300 Observed statistic pointwise 0.05 critical value maximum 0.05 critical value Days Jan Koláček (SCI MUNI) M7777 Applied FDA Fall 2019 14 / 31 Functional Response Models Canadian Weather detailed test results Observed statistic pointwise 0.05 critical value Sample statistic (B=200) Days Jan Koláček (SCI MUNI) M7777 Applied FDA Fall 2019 15 / 31 Functional Response Models Canadian Weather F* = 3.41, F0*95 = 0.747 Ll_ 2 X '--—11 J M________ I I i 11 Ii 1 Wll m Al • Observed maximum F* maximum 0.05 critical value Sample maximum F* 1 1 0 50 100 150 Sample 200 Jan Koláček (SCI MUNI) M7777 Applied FDA Fall 2019 16 / 31 Functional Response Models Functional ř-test Just 2 groups of curves (x,y(t), x/2(0) significant? Is the difference statistically Example. Berkeley Growth Study (39 boys, 54 girls) 200 150 CD X 100 — boys — girls 5 10 Age [years] 15 Jan Koláček (SCI MUNI) M7777 Applied FDA Fall 2019 17 / 31 Functional Response Models Functional t-statistic To test significance, we can define a pointwise ř-statistic T(t) = xi(t)-x2(t)| ^£Var[xi(t)] + ^Var[x2(t)] indicates where there is a large mean difference relative to variance Test over-all significance based on 7* = max T(t). Jan Koláček (SCI MUNI) M7777 Applied FDA Fall 2019 18 / 31 Functional Response Models Permutation Test We would like to test the null hypothesis H0 : Exi(t) = Ex2(t) Vt G [ti, t/v] Do 6 times O Randomly shuffle the labels of the curves. © Calculate the ^-statistic Tf,(£) with the new labels. 1 0 Measure T£ and set 1^ = Then p-value for the test 0 if T* > T* if T* < T* Pb = Jan Koláček (SCI MUNI) M7777 Applied FDA Fall 2019 19 / 31 Functional Response Models Berkeley Growth Study b = 200, pb = 0 Functional Response Models Berkeley Growth Study detailed test results Observed statistic pointwise 0.05 critical value Sample statistic (B=200) Jan Koláček (SCI MUNI) M7777 Applied FDA Fall 2019 21 / 31 Functional Response Models Berkeley Growth Study 7* = 10.3, T0*95 = 2.61 10.0 7.5 'x 5.0 2.5 0.0 Observed maximum T* maximum 0.05 critical value Sample maximum T* 0 50 100 150 Sample 200 Jan Koláček (SCI MUNI) M7777 Applied FDA Fall 2019 22 / 31 Problems to solve O Sound Intensity Data Load the variable rat3 from the rat3.RData file. The variable rat3 contains observations of a rat neural activity evoked by sound intensity. The evoked potential (EPI) was measured in dependence on 19 sound intensities for 5 days. The dataset contains 79 repetitions for each day. • Smooth the data by B-spline bases with second-derivative penalties and plot the result with color-day specification (see Figure 1). • Conduct a study of the effect of the day on the shape of the EPI curves. Consider the fANOVA model with days as covariates. Plot estimated parameters with its pointwise confidence bands (see Figure 2). • Plot predictions for each day with its pointwise confidence bands (see Figure 3). • Plot functional R2 of the model (see Figure 4) and interpret it. • Asses the model by the permutation test for F-statistic and plot the result (see Figure 5). Jan Koláček (SCI MUNI) M7777 Applied FDA Fall 2019 23 / 31 Problems to solve © Sound Intensity Data • Consider just days SS4 and SS5 and plot the EPI estimates with color-day specification (see Figure 6). • Is the difference between days statistically significant? Conduct the functional t-test. • Asses the model by the permutation test for t-statistic, plot the result (see Figure 7) and interpret it. Jan Koláček (SCI MUNI) M7777 Applied FDA Fall 2019 24 / 31 Problems to solve Problems to solve Figure 2. Jan Koláček (SCI MUNI) M7777 Applied FDA Fall 2019 26 / 31 Problems to solve Jan Koláček (SCI MUNI) M7777 Applied FDA Fall 2019 27 / 31 Problems to solve 0.6 0.4 0.2 0.0 -------- 1 ) 25 5 Intensity Figure 4. Jan Koláček (SCI MUNI) M7777 Applied FDA Fall 2019 28 / 31 Problems to solve Observed statistic pointwise 0.05 critical value maximum 0.05 critical value 1 0 25 50 Intensity Figure 5. i 75 Jan Koláček (SCI MUNI) M7777 Applied FDA Fall 2019 29 / 31 Problems to solve 10(H u-1- 0 25 Intensity Figure 6. 50 75 Jan Koläcek (SCI MUNI) M7777 Applied FDA Fall 2019 30 / 31 Problems to solve Observed statistic pointwise 0.05 critical value maximum 0.05 critical value 1 0 25 50 Intensity Figure 7. i 75 Jan Koláček (SCI MUNI) M7777 Applied FDA Fall 2019 31 / 31