This is an ‘R’ Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

setwd("~/Descargas/datos_funcionales/2015/Carpeta sin título")
library("lubridate")
library("dplyr")
## 
## Attaching package: 'dplyr'
## 
## The following objects are masked from 'package:lubridate':
## 
##     intersect, setdiff, union
## 
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## 
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library("data.table")
## 
## Attaching package: 'data.table'
## 
## The following objects are masked from 'package:dplyr':
## 
##     between, last
## 
## The following objects are masked from 'package:lubridate':
## 
##     hour, mday, month, quarter, wday, week, yday, year
library("data.table")
library("fda.usc")
## Loading required package: fda
## Loading required package: splines
## Loading required package: Matrix
## 
## Attaching package: 'fda'
## 
## The following object is masked from 'package:graphics':
## 
##     matplot
## 
## Loading required package: MASS
## 
## Attaching package: 'MASS'
## 
## The following object is masked from 'package:dplyr':
## 
##     select
## 
## Loading required package: mgcv
## Loading required package: nlme
## 
## Attaching package: 'nlme'
## 
## The following object is masked from 'package:dplyr':
## 
##     collapse
## 
## This is mgcv 1.8-7. For overview type 'help("mgcv-package")'.
## Loading required package: rpart
library("Funclustering")
library("ff")
## Loading required package: bit
## Attaching package bit
## package:bit (c) 2008-2012 Jens Oehlschlaegel (GPL-2)
## creators: bit bitwhich
## coercion: as.logical as.integer as.bit as.bitwhich which
## operator: ! & | xor != ==
## querying: print length any all min max range sum summary
## bit access: length<- [ [<- [[ [[<-
## for more help type ?bit
## 
## Attaching package: 'bit'
## 
## The following object is masked from 'package:data.table':
## 
##     setattr
## 
## The following object is masked from 'package:base':
## 
##     xor
## 
## Attaching package ff
## - getOption("fftempdir")=="/tmp/Rtmpo24LNn"
## 
## - getOption("ffextension")=="ff"
## 
## - getOption("ffdrop")==TRUE
## 
## - getOption("fffinonexit")==TRUE
## 
## - getOption("ffpagesize")==65536
## 
## - getOption("ffcaching")=="mmnoflush"  -- consider "ffeachflush" if your system stalls on large writes
## 
## - getOption("ffbatchbytes")==16777216 -- consider a different value for tuning your system
## 
## - getOption("ffmaxbytes")==536870912 -- consider a different value for tuning your system
## 
## 
## Attaching package: 'ff'
## 
## The following objects are masked from 'package:bit':
## 
##     clone, clone.default, clone.list
## 
## The following objects are masked from 'package:utils':
## 
##     write.csv, write.csv2
## 
## The following objects are masked from 'package:base':
## 
##     is.factor, is.ordered
library(PerformanceAnalytics)
## Loading required package: xts
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## 
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
## 
## 
## Attaching package: 'xts'
## 
## The following object is masked from 'package:data.table':
## 
##     last
## 
## The following objects are masked from 'package:dplyr':
## 
##     first, last
## 
## 
## Attaching package: 'PerformanceAnalytics'
## 
## The following object is masked from 'package:graphics':
## 
##     legend
library(ppcor)
library(dplyr)

datos= read.csv("gr2.csv",sep=";")
attach(datos)


gr=split(datos,list(DIA,ANO))
#write.csv(gr[[1]],"result.csv")

#var1t= gr[[1]]$BEN

nombres= names(datos)[4:12]



datos2= group_by(datos,MES)
meses=unique(MES) 

MESES=split(datos,MES)
for(i in meses){
  aux= i
  D= as.data.frame(MESES[i])
  A=D[,4:12]
  B=A[,sapply(A,is.numeric)]
  print(cor(B))
  pairs(B)
  
}
##               enero.BEN     enero.CO    enero.NO  enero.NO2  enero.NOX
## enero.BEN   1.000000000  0.003564786  0.14817511  0.2175585  0.2048618
## enero.CO    0.003564786  1.000000000 -0.01145604  0.2437868  0.1515270
## enero.NO    0.148175106 -0.011456036  1.00000000  0.6755519  0.8766904
## enero.NO2   0.217558505  0.243786817  0.67555188  1.0000000  0.9458731
## enero.NOX   0.204861847  0.151527049  0.87669040  0.9458731  1.0000000
## enero.O3   -0.130206604 -0.244453502 -0.49690208 -0.7703506 -0.7207622
## enero.PM10  0.105888138  0.056252755  0.11226119  0.1613924  0.1547436
## enero.SO2  -0.109678512  0.084590138  0.13422916  0.1308873  0.1447532
##               enero.O3  enero.PM10   enero.SO2
## enero.BEN  -0.13020660  0.10588814 -0.10967851
## enero.CO   -0.24445350  0.05625276  0.08459014
## enero.NO   -0.49690208  0.11226119  0.13422916
## enero.NO2  -0.77035058  0.16139239  0.13088731
## enero.NOX  -0.72076224  0.15474358  0.14475321
## enero.O3    1.00000000 -0.16120787 -0.08248539
## enero.PM10 -0.16120787  1.00000000  0.07237464
## enero.SO2  -0.08248539  0.07237464  1.00000000

##              febrero.BEN   febrero.CO  febrero.NO febrero.NO2 febrero.NOX
## febrero.BEN   1.00000000  0.035171358 -0.08558170  -0.2161152 -0.16691589
## febrero.CO    0.03517136  1.000000000  0.01641083   0.0401187  0.03191026
## febrero.NO   -0.08558170  0.016410825  1.00000000   0.5146123  0.88091518
## febrero.NO2  -0.21611521  0.040118698  0.51461225   1.0000000  0.85804455
## febrero.NOX  -0.16691589  0.031910256  0.88091518   0.8580445  1.00000000
## febrero.O3    0.31704908 -0.040304705 -0.47083247  -0.7816303 -0.71295705
## febrero.PM10 -0.06835295 -0.019541749  0.44241531   0.3705409  0.46861924
## febrero.SO2  -0.10724983  0.001622946  0.53839941   0.2760433  0.47227377
##               febrero.O3 febrero.PM10  febrero.SO2
## febrero.BEN   0.31704908  -0.06835295 -0.107249828
## febrero.CO   -0.04030471  -0.01954175  0.001622946
## febrero.NO   -0.47083247   0.44241531  0.538399415
## febrero.NO2  -0.78163029   0.37054090  0.276043284
## febrero.NOX  -0.71295705   0.46861924  0.472273767
## febrero.O3    1.00000000  -0.35919138 -0.328679489
## febrero.PM10 -0.35919138   1.00000000  0.432005302
## febrero.SO2  -0.32867949   0.43200530  1.000000000

##              marzo.BEN    marzo.CO   marzo.NO  marzo.NO2   marzo.NOX
## marzo.BEN   1.00000000 -0.62479090 -0.0179300 -0.1359128 -0.07341856
## marzo.CO   -0.62479090  1.00000000  0.2074151  0.4297425  0.33425700
## marzo.NO   -0.01793000  0.20741512  1.0000000  0.5653780  0.90267172
## marzo.NO2  -0.13591279  0.42974247  0.5653780  1.0000000  0.86406631
## marzo.NOX  -0.07341856  0.33425700  0.9026717  0.8640663  1.00000000
## marzo.O3    0.11263899 -0.22061640 -0.5168328 -0.6288240 -0.64499158
## marzo.PM10  0.07646485  0.09125953  0.3460231  0.4314426  0.43409630
## marzo.SO2   0.01144181  0.11875198  0.5080204  0.3975965  0.51606647
##              marzo.O3  marzo.PM10   marzo.SO2
## marzo.BEN   0.1126390  0.07646485  0.01144181
## marzo.CO   -0.2206164  0.09125953  0.11875198
## marzo.NO   -0.5168328  0.34602311  0.50802041
## marzo.NO2  -0.6288240  0.43144261  0.39759650
## marzo.NOX  -0.6449916  0.43409630  0.51606647
## marzo.O3    1.0000000 -0.15425471 -0.24975023
## marzo.PM10 -0.1542547  1.00000000  0.22963077
## marzo.SO2  -0.2497502  0.22963077  1.00000000

##               abril.BEN    abril.CO    abril.NO   abril.NO2    abril.NOX
## abril.BEN   1.000000000  0.07254874 -0.01795525  0.02516962 -0.008173364
## abril.CO    0.072548736  1.00000000  0.28429243  0.55171589  0.460454197
## abril.NO   -0.017955254  0.28429243  1.00000000  0.48364965  0.874545239
## abril.NO2   0.025169620  0.55171589  0.48364965  1.00000000  0.845480852
## abril.NOX  -0.008173364  0.46045420  0.87454524  0.84548085  1.000000000
## abril.O3    0.174729182 -0.22276575 -0.51253880 -0.59690072 -0.648096250
## abril.PM10 -0.091965322  0.08731386  0.10288812  0.11706513  0.128315673
## abril.SO2  -0.222505125  0.15782742  0.51324281  0.27617481  0.467372177
##              abril.O3  abril.PM10   abril.SO2
## abril.BEN   0.1747292 -0.09196532 -0.22250513
## abril.CO   -0.2227658  0.08731386  0.15782742
## abril.NO   -0.5125388  0.10288812  0.51324281
## abril.NO2  -0.5969007  0.11706513  0.27617481
## abril.NOX  -0.6480962  0.12831567  0.46737218
## abril.O3    1.0000000 -0.17996465 -0.28830433
## abril.PM10 -0.1799646  1.00000000  0.04789049
## abril.SO2  -0.2883043  0.04789049  1.00000000

##               mayo.BEN     mayo.CO     mayo.NO     mayo.NO2   mayo.NOX
## mayo.BEN   1.000000000 -0.83276298  0.01383344 -0.005598342 -0.0184532
## mayo.CO   -0.832762978  1.00000000  0.06074169  0.217347754  0.1762886
## mayo.NO    0.013833445  0.06074169  1.00000000  0.461695909  0.8606020
## mayo.NO2  -0.005598342  0.21734775  0.46169591  1.000000000  0.8461667
## mayo.NOX  -0.018453198  0.17628861  0.86060196  0.846166728  1.0000000
## mayo.O3    0.168504613 -0.13285390 -0.35187888 -0.403151849 -0.4461447
## mayo.PM10 -0.147261304  0.13815059  0.18827094  0.268450295  0.2735849
## mayo.SO2  -0.044689283  0.13640799  0.40113654  0.439242467  0.4927534
##              mayo.O3  mayo.PM10    mayo.SO2
## mayo.BEN   0.1685046 -0.1472613 -0.04468928
## mayo.CO   -0.1328539  0.1381506  0.13640799
## mayo.NO   -0.3518789  0.1882709  0.40113654
## mayo.NO2  -0.4031518  0.2684503  0.43924247
## mayo.NOX  -0.4461447  0.2735849  0.49275344
## mayo.O3    1.0000000  0.1810593 -0.18257472
## mayo.PM10  0.1810593  1.0000000  0.31680914
## mayo.SO2  -0.1825747  0.3168091  1.00000000

##               junio.BEN   junio.CO    junio.NO   junio.NO2    junio.NOX
## junio.BEN   1.000000000 -0.4043345  0.02021857  0.03780410  0.007257126
## junio.CO   -0.404334470  1.0000000  0.17821645  0.36732111  0.303350693
## junio.NO    0.020218574  0.1782164  1.00000000  0.62197302  0.902601986
## junio.NO2   0.037804098  0.3673211  0.62197302  1.00000000  0.894396112
## junio.NOX   0.007257126  0.3033507  0.90260199  0.89439611  1.000000000
## junio.O3    0.282035639  0.1286955 -0.21405375 -0.07354955 -0.184899706
## junio.PM10 -0.015512539  0.1644439  0.08244267  0.15906465  0.127543963
## junio.SO2  -0.198830195  0.3393280  0.38099724  0.36051838  0.411394426
##                junio.O3  junio.PM10    junio.SO2
## junio.BEN   0.282035639 -0.01551254 -0.198830195
## junio.CO    0.128695475  0.16444385  0.339328010
## junio.NO   -0.214053747  0.08244267  0.380997244
## junio.NO2  -0.073549550  0.15906465  0.360518380
## junio.NOX  -0.184899706  0.12754396  0.411394426
## junio.O3    1.000000000  0.08163913  0.005677349
## junio.PM10  0.081639130  1.00000000  0.106358952
## junio.SO2   0.005677349  0.10635895  1.000000000

##            julio.BEN      julio.CO    julio.NO  julio.NO2  julio.NOX
## julio.BEN          1            NA          NA         NA         NA
## julio.CO          NA  1.0000000000  0.06186285  0.2082866  0.1272137
## julio.NO          NA  0.0618628471  1.00000000  0.4781413  0.9343078
## julio.NO2         NA  0.2082866288  0.47814134  1.0000000  0.7533301
## julio.NOX         NA  0.1272137137  0.93430781  0.7533301  1.0000000
## julio.O3          NA -0.0356742156 -0.26456043 -0.2926332 -0.3114290
## julio.PM10        NA -0.0009847099  0.17488151  0.3229123  0.2479385
## julio.SO2         NA  0.0245437210  0.47439380  0.2606128  0.4698783
##               julio.O3    julio.PM10  julio.SO2
## julio.BEN           NA            NA         NA
## julio.CO   -0.03567422 -0.0009847099 0.02454372
## julio.NO   -0.26456043  0.1748815115 0.47439380
## julio.NO2  -0.29263321  0.3229123285 0.26061275
## julio.NOX  -0.31142902  0.2479385096 0.46987834
## julio.O3    1.00000000  0.2869778435 0.01277999
## julio.PM10  0.28697784  1.0000000000 0.04740928
## julio.SO2   0.01277999  0.0474092810 1.00000000

##             agosto.BEN   agosto.CO   agosto.NO  agosto.NO2  agosto.NOX
## agosto.BEN           1          NA          NA          NA          NA
## agosto.CO           NA  1.00000000  0.04695599  0.26932110  0.13312865
## agosto.NO           NA  0.04695599  1.00000000  0.59618433  0.92306420
## agosto.NO2          NA  0.26932110  0.59618433  1.00000000  0.85282130
## agosto.NOX          NA  0.13312865  0.92306420  0.85282130  1.00000000
## agosto.O3           NA -0.01375621 -0.28874399 -0.39423868 -0.37554644
## agosto.PM10         NA  0.11627844  0.03570739  0.08964097  0.06337994
## agosto.SO2          NA -0.31717603  0.30758951  0.14824307  0.28831639
##               agosto.O3 agosto.PM10  agosto.SO2
## agosto.BEN           NA          NA          NA
## agosto.CO   -0.01375621  0.11627844 -0.31717603
## agosto.NO   -0.28874399  0.03570739  0.30758951
## agosto.NO2  -0.39423868  0.08964097  0.14824307
## agosto.NOX  -0.37554644  0.06337994  0.28831639
## agosto.O3    1.00000000  0.05516677 -0.01527351
## agosto.PM10  0.05516677  1.00000000 -0.02005492
## agosto.SO2  -0.01527351 -0.02005492  1.00000000

##                 septiembre.BEN septiembre.CO septiembre.NO septiembre.NO2
## septiembre.BEN      1.00000000  2.898775e-01    0.07298541     0.09905835
## septiembre.CO       0.28987745  1.000000e+00    0.16617304     0.28319022
## septiembre.NO       0.07298541  1.661730e-01    1.00000000     0.53548061
## septiembre.NO2      0.09905835  2.831902e-01    0.53548061     1.00000000
## septiembre.NOX      0.09217343  2.240235e-01    0.93492339     0.79145995
## septiembre.O3      -0.03646090 -7.014371e-05   -0.42657311    -0.53445356
## septiembre.PM10     0.11261086  2.552928e-01    0.35417230     0.45895007
## septiembre.SO2     -0.04450792  2.911481e-02    0.57793245     0.41426434
##                 septiembre.NOX septiembre.O3 septiembre.PM10
## septiembre.BEN      0.09217343 -3.646090e-02       0.1126109
## septiembre.CO       0.22402354 -7.014371e-05       0.2552928
## septiembre.NO       0.93492339 -4.265731e-01       0.3541723
## septiembre.NO2      0.79145995 -5.344536e-01       0.4589501
## septiembre.NOX      1.00000000 -5.282350e-01       0.4382387
## septiembre.O3      -0.52823502  1.000000e+00      -0.0888225
## septiembre.PM10     0.43823870 -8.882250e-02       1.0000000
## septiembre.SO2      0.58561354 -2.565390e-01       0.1871523
##                 septiembre.SO2
## septiembre.BEN     -0.04450792
## septiembre.CO       0.02911481
## septiembre.NO       0.57793245
## septiembre.NO2      0.41426434
## septiembre.NOX      0.58561354
## septiembre.O3      -0.25653905
## septiembre.PM10     0.18715225
## septiembre.SO2      1.00000000

##              octubre.BEN  octubre.CO octubre.NO octubre.NO2 octubre.NOX
## octubre.BEN   1.00000000 -0.34669401 -0.1482721  -0.1391773  -0.1545025
## octubre.CO   -0.34669401  1.00000000  0.3737684   0.3304701   0.3834230
## octubre.NO   -0.14827214  0.37376838  1.0000000   0.6246271   0.9594488
## octubre.NO2  -0.13917730  0.33047012  0.6246271   1.0000000   0.8186374
## octubre.NOX  -0.15450255  0.38342301  0.9594488   0.8186374   1.0000000
## octubre.O3    0.26527885 -0.33488440 -0.5792386  -0.6498744  -0.6594232
## octubre.PM10  0.02003915 -0.07237582  0.1432681   0.1946252   0.1780313
## octubre.SO2  -0.22097253  0.43838260  0.3731990   0.2885364   0.3738489
##               octubre.O3 octubre.PM10 octubre.SO2
## octubre.BEN   0.26527885   0.02003915 -0.22097253
## octubre.CO   -0.33488440  -0.07237582  0.43838260
## octubre.NO   -0.57923857   0.14326806  0.37319896
## octubre.NO2  -0.64987439   0.19462518  0.28853644
## octubre.NOX  -0.65942322   0.17803134  0.37384893
## octubre.O3    1.00000000  -0.07555244 -0.31928873
## octubre.PM10 -0.07555244   1.00000000  0.05006079
## octubre.SO2  -0.31928873   0.05006079  1.00000000

##                noviembre.BEN noviembre.CO noviembre.NO noviembre.NO2
## noviembre.BEN     1.00000000  -0.62554443   0.27301030    0.35687418
## noviembre.CO     -0.62554443   1.00000000  -0.04937098   -0.02051894
## noviembre.NO      0.27301030  -0.04937098   1.00000000    0.68536423
## noviembre.NO2     0.35687418  -0.02051894   0.68536423    1.00000000
## noviembre.NOX     0.33823781  -0.05075140   0.95408932    0.87098476
## noviembre.O3     -0.01413069   0.24130226  -0.40329833   -0.33445377
## noviembre.PM10    0.61416678  -0.07369578   0.35595305    0.48335865
## noviembre.SO2    -0.09533213   0.05178661   0.05769359    0.14261704
##                noviembre.NOX noviembre.O3 noviembre.PM10 noviembre.SO2
## noviembre.BEN     0.33823781  -0.01413069     0.61416678   -0.09533213
## noviembre.CO     -0.05075140   0.24130226    -0.07369578    0.05178661
## noviembre.NO      0.95408932  -0.40329833     0.35595305    0.05769359
## noviembre.NO2     0.87098476  -0.33445377     0.48335865    0.14261704
## noviembre.NOX     1.00000000  -0.41565523     0.43901211    0.09212373
## noviembre.O3     -0.41565523   1.00000000     0.01564140    0.22122201
## noviembre.PM10    0.43901211   0.01564140     1.00000000   -0.01786316
## noviembre.SO2     0.09212373   0.22122201    -0.01786316    1.00000000

##                diciembre.BEN diciembre.CO diciembre.NO diciembre.NO2
## diciembre.BEN     1.00000000   -0.8058006  -0.08955084   -0.17759289
## diciembre.CO     -0.80580056    1.0000000   0.29933606    0.36113105
## diciembre.NO     -0.08955084    0.2993361   1.00000000    0.67630538
## diciembre.NO2    -0.17759289    0.3611310   0.67630538    1.00000000
## diciembre.NOX    -0.11774332    0.3360714   0.96673765    0.84148602
## diciembre.O3      0.23092578   -0.2650876  -0.57303653   -0.76829920
## diciembre.PM10    0.38890850   -0.1811584   0.27642871    0.26995300
## diciembre.SO2     0.37730987   -0.2888514   0.03532505   -0.02405469
##                diciembre.NOX diciembre.O3 diciembre.PM10 diciembre.SO2
## diciembre.BEN    -0.11774332   0.23092578      0.3889085    0.37730987
## diciembre.CO      0.33607140  -0.26508761     -0.1811584   -0.28885136
## diciembre.NO      0.96673765  -0.57303653      0.2764287    0.03532505
## diciembre.NO2     0.84148602  -0.76829920      0.2699530   -0.02405469
## diciembre.NOX     1.00000000  -0.68588725      0.3003533    0.02171755
## diciembre.O3     -0.68588725   1.00000000     -0.2145425    0.05128073
## diciembre.PM10    0.30035327  -0.21454254      1.0000000    0.14562769
## diciembre.SO2     0.02171755   0.05128073      0.1456277    1.00000000

datos2=summarize(group_by(datos,DIA,ANO),mean(NO),mean(NO2),mean(O3))
datos3=summarize(group_by(datos,DIA,ANO),median(NO),median(NO2),median(O3))
datos4= summarize(group_by(datos,DIA,ANO),max(NO),max(NO2),max(O3))
datos5= summarize(group_by(datos,DIA,ANO),quantile(NO,probs=0.85),quantile(NO2,probs=0.85),quantile(O3,probs=0.85))
datos6= summarize(group_by(datos,DIA,ANO),min(NO),min(NO2),min(O3))
datos7= summarize(group_by(datos,DIA,ANO),sum(NO),sum(NO2),sum(O3))
datos8= summarize(group_by(datos,DIA,ANO),max(NO)+min(NO),min(NO2)+max(NO2),min(O3)+max(O3))


meanNO= (datos2[,3])[[1]]
meanNO2= datos2[,4][[1]]
meanO3= datos2[,5][[1]]

medianNO= datos3[,3][[1]]
medianNO2= datos3[,4][[1]]
medianO3= datos3[,5][[1]]

maxNO= datos4[,3][[1]]
maxNO2= datos4[,4][[1]]
maxO3= datos4[,5][[1]]
minNO= datos6[,3][[1]]
minNO2= datos6[,4][[1]]
minO3= datos6[,5][[1]]

cuantilNO= datos5[,3][[1]]
cuantilNO2= datos5[,4][[1]]
cuantilO3= datos5[,5][[1]]

sumaNO=datos7[,3][[1]]
sumaNO2=datos7[,4][[1]]
sumaO3=datos7[,5][[1]]
maxminNO= datos8[,3][[1]]
maxminNO2= datos8[,4][[1]]
maxminO3= datos8[,5][[1]]

var1= as.data.frame(gr[1])[,4]
var2= as.data.frame(gr[1])[,4]
var3= as.data.frame(gr[1])[,5]
var4= as.data.frame(gr[1])[,6]
var5= as.data.frame(gr[1])[,7]
var6= as.data.frame(gr[1])[,8]
var7= as.data.frame(gr[1])[,9]
var8= as.data.frame(gr[1])[,10]
var9= as.data.frame(gr[1])[,11]




for(i in 2:730){
  aux=as.data.frame(gr[i])
  var1= rbind.data.frame(var1,aux[,4])
  var2= rbind.data.frame(var2,aux[,5])
  var3= rbind.data.frame(var3,aux[,6])
  var4= rbind.data.frame(var4,aux[,7])
  var5= rbind.data.frame(var5,aux[,8])
  var6= rbind.data.frame(var6,aux[,9])
  var7= rbind.data.frame(var7,aux[,10])
  var8= rbind.data.frame(var8,aux[,11])
  var9= rbind.data.frame(var9,aux[,12])
}



varf1= fdata(var1)
varf2= fdata(var2)
varf3= fdata(var3)
varf4= fdata(var4)
varf5= fdata(var5)
varf6= fdata(var6)
varf7= fdata(var7)
varf8= fdata(var8)
varf9= fdata(var9)


NO2f= varf4
NOf= varf3
O3f=  varf6
NOx= varf5



regbasis1=fregre.basis(NO2f,meanNO2)
regbasis2=fregre.basis(NOf,meanNO)
regbasis3=fregre.basis(O3f,meanO3)
summary(regbasis1)
##  *** Summary Functional Data Regression with representation in Basis *** 
## 
## Call:
## fregre.basis(fdataobj = NO2f, y = meanNO2)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -21.480  -6.725  -2.352   5.293  38.962 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  18.502959   0.370759  49.906   <2e-16 ***
## NO2f.bspl4.1 -0.009219   0.026991  -0.342    0.733    
## NO2f.bspl4.2  0.011902   0.035141   0.339    0.735    
## NO2f.bspl4.3 -0.015804   0.050145  -0.315    0.753    
## NO2f.bspl4.4 -0.024296   0.036379  -0.668    0.504    
## NO2f.bspl4.5  0.008487   0.027205   0.312    0.755    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 10.02 on 724 degrees of freedom
## Multiple R-squared:  0.0297, Adjusted R-squared:  0.023 
## F-statistic: 4.432 on 5 and 724 DF,  p-value: 0.0005535
## 
## -Names of possible atypical curves: 84 132 210 591 658 670 729 
## -Names of possible influence curves: 22 66 71 74 75 85 105 276 296 299 
##  It prints only the 10 most influence curves

summary(regbasis2)
##  *** Summary Functional Data Regression with representation in Basis *** 
## 
## Call:
## fregre.basis(fdataobj = NOf, y = meanNO)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -6.715 -4.329 -3.223  0.808 63.391 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  6.454381   0.309309  20.867   <2e-16 ***
## NOf.bspl4.1  0.008208   0.029317   0.280    0.780    
## NOf.bspl4.2 -0.010661   0.029824  -0.357    0.721    
## NOf.bspl4.3  0.011690   0.045010   0.260    0.795    
## NOf.bspl4.4 -0.012297   0.037974  -0.324    0.746    
## NOf.bspl4.5  0.019475   0.037502   0.519    0.604    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 8.357 on 724 degrees of freedom
## Multiple R-squared:  0.00116,    Adjusted R-squared:  -0.005738 
## F-statistic: 0.1681 on 5 and 724 DF,  p-value: 0.9743
## 
## -Names of possible atypical curves: 84 100 545 587 589 591 592 593 595 599 
##  It prints only the 10 most atypical curves. 
## -Names of possible influence curves: 22 76 202 270 273 283 293 294 295 296 
##  It prints only the 10 most influence curves

summary(regbasis3)
##  *** Summary Functional Data Regression with representation in Basis *** 
## 
## Call:
## fregre.basis(fdataobj = O3f, y = meanO3)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -53.946  -8.826   1.580  10.617  55.374 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 52.983257   0.630623  84.017   <2e-16 ***
## O3f.bspl4.1  0.036480   0.038659   0.944    0.346    
## O3f.bspl4.2 -0.023155   0.047131  -0.491    0.623    
## O3f.bspl4.3  0.005973   0.065358   0.091    0.927    
## O3f.bspl4.4 -0.001076   0.050727  -0.021    0.983    
## O3f.bspl4.5 -0.003801   0.037916  -0.100    0.920    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 17.04 on 724 degrees of freedom
## Multiple R-squared:  0.002377,   Adjusted R-squared:  -0.004513 
## F-statistic: 0.3449 on 5 and 724 DF,  p-value: 0.8856
## 
## -Names of possible atypical curves: 315 317 319 321 322 637 639 641 643 
## -Names of possible influence curves: 65 66 71 469 497 520 537 545 640 669

regbasis1_2=fregre.basis(NO2f,medianNO2)
regbasis2_2=fregre.basis(NOf,medianNO)
regbasis3_2=fregre.basis(O3f,medianO3)
summary(regbasis1_2)
##  *** Summary Functional Data Regression with representation in Basis *** 
## 
## Call:
## fregre.basis(fdataobj = NO2f, y = medianNO2)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -19.542  -6.762  -2.824   4.696  40.850 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  16.660274   0.382155  43.596   <2e-16 ***
## NO2f.bspl4.1 -0.006236   0.027820  -0.224    0.823    
## NO2f.bspl4.2  0.002046   0.036221   0.056    0.955    
## NO2f.bspl4.3 -0.004849   0.051686  -0.094    0.925    
## NO2f.bspl4.4 -0.030881   0.037497  -0.824    0.410    
## NO2f.bspl4.5  0.018585   0.028041   0.663    0.508    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 10.33 on 724 degrees of freedom
## Multiple R-squared:  0.02522,    Adjusted R-squared:  0.01849 
## F-statistic: 3.746 on 5 and 724 DF,  p-value: 0.002349
## 
## -Names of possible atypical curves: 84 100 132 200 210 591 658 670 687 729 
## -Names of possible influence curves: 22 66 71 74 75 85 105 276 296 299 
##  It prints only the 10 most influence curves

summary(regbasis2_2)
##  *** Summary Functional Data Regression with representation in Basis *** 
## 
## Call:
## fregre.basis(fdataobj = NOf, y = medianNO)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -4.068 -1.725 -1.505 -0.399 56.836 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  3.730822   0.194350  19.196   <2e-16 ***
## NOf.bspl4.1  0.011478   0.018421   0.623    0.533    
## NOf.bspl4.2 -0.014699   0.018739  -0.784    0.433    
## NOf.bspl4.3  0.019391   0.028281   0.686    0.493    
## NOf.bspl4.4 -0.009581   0.023860  -0.402    0.688    
## NOf.bspl4.5  0.012944   0.023564   0.549    0.583    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 5.251 on 724 degrees of freedom
## Multiple R-squared:  0.002832,   Adjusted R-squared:  -0.004055 
## F-statistic: 0.4112 on 5 and 724 DF,  p-value: 0.8412
## 
## -Names of possible atypical curves: 589 591 593 595 597 632 636 658 668 670 
##  It prints only the 10 most atypical curves. 
## -Names of possible influence curves: 22 76 202 270 273 283 293 294 295 296 
##  It prints only the 10 most influence curves

summary(regbasis3_2)
##  *** Summary Functional Data Regression with representation in Basis *** 
## 
## Call:
## fregre.basis(fdataobj = O3f, y = medianO3)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -54.314  -9.140   1.785  11.640  53.155 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 53.740411   0.686518  78.280   <2e-16 ***
## O3f.bspl4.1  0.026407   0.042086   0.627    0.531    
## O3f.bspl4.2 -0.019395   0.051308  -0.378    0.706    
## O3f.bspl4.3  0.001139   0.071151   0.016    0.987    
## O3f.bspl4.4  0.002377   0.055223   0.043    0.966    
## O3f.bspl4.5  0.002248   0.041277   0.054    0.957    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 18.55 on 724 degrees of freedom
## Multiple R-squared:  0.001099,   Adjusted R-squared:  -0.0058 
## F-statistic: 0.1593 on 5 and 724 DF,  p-value: 0.9772
## 
## -Names of possible atypical curves: No atypical curves 
## -Names of possible influence curves: 65 66 71 469 497 520 537 545 640 669

regbasis1_3=fregre.basis(NO2f,maxNO2)
regbasis2_3=fregre.basis(NOf,maxNO)
regbasis3_3=fregre.basis(O3f,maxO3)


summary(regbasis1_3)
##  *** Summary Functional Data Regression with representation in Basis *** 
## 
## Call:
## fregre.basis(fdataobj = NO2f, y = maxNO2)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -48.69 -16.58  -1.71  14.36  74.02 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  42.861644   0.777981  55.093   <2e-16 ***
## NO2f.bspl4.1 -0.035814   0.056636  -0.632    0.527    
## NO2f.bspl4.2  0.062418   0.073738   0.846    0.398    
## NO2f.bspl4.3 -0.064206   0.105222  -0.610    0.542    
## NO2f.bspl4.4 -0.038914   0.076336  -0.510    0.610    
## NO2f.bspl4.5  0.001013   0.057086   0.018    0.986    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 21.02 on 724 degrees of freedom
## Multiple R-squared:  0.03122,    Adjusted R-squared:  0.02453 
## F-statistic: 4.667 on 5 and 724 DF,  p-value: 0.0003356
## 
## -Names of possible atypical curves: 564 605 670 711 
## -Names of possible influence curves: 22 66 71 74 75 85 105 276 296 299 
##  It prints only the 10 most influence curves

summary(regbasis2_3)
##  *** Summary Functional Data Regression with representation in Basis *** 
## 
## Call:
## fregre.basis(fdataobj = NOf, y = maxNO)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -29.361 -23.853 -17.682   8.177 295.838 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 28.50548    1.46247  19.491   <2e-16 ***
## NOf.bspl4.1 -0.04207    0.13862  -0.304    0.762    
## NOf.bspl4.2  0.06849    0.14101   0.486    0.627    
## NOf.bspl4.3 -0.11053    0.21281  -0.519    0.604    
## NOf.bspl4.4  0.01756    0.17955   0.098    0.922    
## NOf.bspl4.5  0.03422    0.17732   0.193    0.847    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 39.51 on 724 degrees of freedom
## Multiple R-squared:  0.001141,   Adjusted R-squared:  -0.005757 
## F-statistic: 0.1654 on 5 and 724 DF,  p-value: 0.9752
## 
## -Names of possible atypical curves: 84 100 141 184 403 545 550 587 592 593 
##  It prints only the 10 most atypical curves. 
## -Names of possible influence curves: 22 76 202 270 273 283 293 294 295 296 
##  It prints only the 10 most influence curves

summary(regbasis3_3)
##  *** Summary Functional Data Regression with representation in Basis *** 
## 
## Call:
## fregre.basis(fdataobj = O3f, y = maxO3)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -78.246 -11.749  -1.223  11.055  96.156 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  7.748e+01  7.836e-01  98.877   <2e-16 ***
## O3f.bspl4.1 -9.603e-05  4.804e-02  -0.002    0.998    
## O3f.bspl4.2  5.983e-03  5.856e-02   0.102    0.919    
## O3f.bspl4.3 -1.748e-02  8.121e-02  -0.215    0.830    
## O3f.bspl4.4  1.962e-02  6.303e-02   0.311    0.756    
## O3f.bspl4.5 -1.550e-03  4.711e-02  -0.033    0.974    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 21.17 on 724 degrees of freedom
## Multiple R-squared:  0.001945,   Adjusted R-squared:  -0.004947 
## F-statistic: 0.2822 on 5 and 724 DF,  p-value: 0.9229
## 
## -Names of possible atypical curves: 264 315 317 319 344 360 380 637 639 641 
##  It prints only the 10 most atypical curves. 
## -Names of possible influence curves: 65 66 71 469 497 520 537 545 640 669

regbasis1_4=fregre.basis(NO2f,minNO2)
regbasis2_4=fregre.basis(NOf,minNO)
regbasis3_4=fregre.basis(O3f,minO3)


summary(regbasis1_4)
##  *** Summary Functional Data Regression with representation in Basis *** 
## 
## Call:
## fregre.basis(fdataobj = NO2f, y = minNO2)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -5.1942 -2.5349 -0.7819  1.2606 29.3336 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   4.697260   0.152309  30.840   <2e-16 ***
## NO2f.bspl4.1  0.002868   0.011088   0.259    0.796    
## NO2f.bspl4.2 -0.005011   0.014436  -0.347    0.729    
## NO2f.bspl4.3  0.008055   0.020600   0.391    0.696    
## NO2f.bspl4.4 -0.013046   0.014945  -0.873    0.383    
## NO2f.bspl4.5  0.008906   0.011176   0.797    0.426    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 4.115 on 724 degrees of freedom
## Multiple R-squared:  0.005952,   Adjusted R-squared:  -0.0009129 
## F-statistic: 0.867 on 5 and 724 DF,  p-value: 0.5028
## 
## -Names of possible atypical curves: 47 48 200 591 593 656 670 690 713 729 
## -Names of possible influence curves: 22 66 71 74 75 85 105 276 296 299 
##  It prints only the 10 most influence curves

summary(regbasis2_4)
##  *** Summary Functional Data Regression with representation in Basis *** 
## 
## Call:
## fregre.basis(fdataobj = NOf, y = minNO)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.1711 -0.1037 -0.0971 -0.0817 12.9031 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1.0917808  0.0286451  38.114   <2e-16 ***
## NOf.bspl4.1 -0.0013582  0.0027150  -0.500    0.617    
## NOf.bspl4.2  0.0001801  0.0027620   0.065    0.948    
## NOf.bspl4.3  0.0010146  0.0041683   0.243    0.808    
## NOf.bspl4.4 -0.0024553  0.0035168  -0.698    0.485    
## NOf.bspl4.5  0.0017179  0.0034731   0.495    0.621    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.7739 on 724 degrees of freedom
## Multiple R-squared:  0.002708,   Adjusted R-squared:  -0.00418 
## F-statistic: 0.3931 on 5 and 724 DF,  p-value: 0.8537
## 
## -Names of possible atypical curves: 591 593 628 632 634 690 
## -Names of possible influence curves: 22 76 202 270 273 283 293 294 295 296 
##  It prints only the 10 most influence curves

summary(regbasis3_4)
##  *** Summary Functional Data Regression with representation in Basis *** 
## 
## Call:
## fregre.basis(fdataobj = O3f, y = minO3)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -29.775 -14.876  -1.486  11.969  50.035 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 24.591781   0.655846  37.496   <2e-16 ***
## O3f.bspl4.1  0.084518   0.040205   2.102   0.0359 *  
## O3f.bspl4.2 -0.056366   0.049016  -1.150   0.2505    
## O3f.bspl4.3  0.051815   0.067972   0.762   0.4461    
## O3f.bspl4.4 -0.048675   0.052756  -0.923   0.3565    
## O3f.bspl4.5  0.007467   0.039433   0.189   0.8499    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 17.72 on 724 degrees of freedom
## Multiple R-squared:  0.02447,    Adjusted R-squared:  0.01773 
## F-statistic: 3.632 on 5 and 724 DF,  p-value: 0.002981
## 
## -Names of possible atypical curves: No atypical curves 
## -Names of possible influence curves: 65 66 71 469 497 520 537 545 640 669

regbasis1_5=fregre.basis(NO2f,cuantilNO2)
regbasis2_5=fregre.basis(NOf,cuantilNO)
regbasis3_5=fregre.basis(O3f,cuantilO3)


summary(regbasis1_5)
##  *** Summary Functional Data Regression with representation in Basis *** 
## 
## Call:
## fregre.basis(fdataobj = NO2f, y = cuantilNO2)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -34.429 -11.634  -3.458  10.325  53.040 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  29.486027   0.590832  49.906   <2e-16 ***
## NO2f.bspl4.1 -0.025280   0.043012  -0.588    0.557    
## NO2f.bspl4.2  0.029178   0.056000   0.521    0.602    
## NO2f.bspl4.3 -0.030305   0.079910  -0.379    0.705    
## NO2f.bspl4.4 -0.038449   0.057973  -0.663    0.507    
## NO2f.bspl4.5  0.007674   0.043354   0.177    0.860    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 15.96 on 724 degrees of freedom
## Multiple R-squared:  0.0333, Adjusted R-squared:  0.02663 
## F-statistic: 4.988 on 5 and 724 DF,  p-value: 0.0001684
## 
## -Names of possible atypical curves: 636 670 675 
## -Names of possible influence curves: 22 66 71 74 75 85 105 276 296 299 
##  It prints only the 10 most influence curves

summary(regbasis2_5)
##  *** Summary Functional Data Regression with representation in Basis *** 
## 
## Call:
## fregre.basis(fdataobj = NOf, y = cuantilNO)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -12.485  -8.706  -6.724   0.197 136.134 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 11.50390    0.64543  17.824   <2e-16 ***
## NOf.bspl4.1  0.03197    0.06118   0.523    0.601    
## NOf.bspl4.2 -0.04146    0.06223  -0.666    0.505    
## NOf.bspl4.3  0.04903    0.09392   0.522    0.602    
## NOf.bspl4.4 -0.04128    0.07924  -0.521    0.603    
## NOf.bspl4.5  0.04949    0.07826   0.632    0.527    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 17.44 on 724 degrees of freedom
## Multiple R-squared:  0.00186,    Adjusted R-squared:  -0.005033 
## F-statistic: 0.2699 on 5 and 724 DF,  p-value: 0.9296
## 
## -Names of possible atypical curves: 84 100 204 585 587 591 592 593 632 636 
##  It prints only the 10 most atypical curves. 
## -Names of possible influence curves: 22 76 202 270 273 283 293 294 295 296 
##  It prints only the 10 most influence curves

summary(regbasis3_5)
##  *** Summary Functional Data Regression with representation in Basis *** 
## 
## Call:
## fregre.basis(fdataobj = O3f, y = cuantilO3)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -70.717 -10.833   0.289  11.964  70.715 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 69.6487671  0.7511076  92.728   <2e-16 ***
## O3f.bspl4.1  0.0135329  0.0460453   0.294    0.769    
## O3f.bspl4.2 -0.0167696  0.0561357  -0.299    0.765    
## O3f.bspl4.3  0.0136243  0.0778451   0.175    0.861    
## O3f.bspl4.4  0.0001273  0.0604187   0.002    0.998    
## O3f.bspl4.5  0.0056464  0.0451606   0.125    0.901    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 20.29 on 724 degrees of freedom
## Multiple R-squared:  0.002073,   Adjusted R-squared:  -0.004819 
## F-statistic: 0.3008 on 5 and 724 DF,  p-value: 0.9124
## 
## -Names of possible atypical curves: 264 315 317 319 321 344 360 637 639 641 
##  It prints only the 10 most atypical curves. 
## -Names of possible influence curves: 65 66 71 469 497 520 537 545 640 669

regbasis1_6=fregre.basis(NO2f,sumaNO2)
regbasis2_6=fregre.basis(NOf,sumaNO)
regbasis3_6=fregre.basis(O3f,sumaO3)


summary(regbasis1_6)
##  *** Summary Functional Data Regression with representation in Basis *** 
## 
## Call:
## fregre.basis(fdataobj = NO2f, y = sumaNO2)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -515.6 -162.3  -56.4  126.9  935.0 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  444.1219     8.9030  49.884   <2e-16 ***
## NO2f.bspl4.1  -0.2198     0.6481  -0.339    0.735    
## NO2f.bspl4.2   0.2837     0.8438   0.336    0.737    
## NO2f.bspl4.3  -0.3741     1.2041  -0.311    0.756    
## NO2f.bspl4.4  -0.5888     0.8736  -0.674    0.501    
## NO2f.bspl4.5   0.2070     0.6533   0.317    0.751    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 240.5 on 724 degrees of freedom
## Multiple R-squared:  0.02974,    Adjusted R-squared:  0.02303 
## F-statistic: 4.438 on 5 and 724 DF,  p-value: 0.000547
## 
## -Names of possible atypical curves: 84 132 210 591 658 670 729 
## -Names of possible influence curves: 22 66 71 74 75 85 105 276 296 299 
##  It prints only the 10 most influence curves

summary(regbasis2_6)
##  *** Summary Functional Data Regression with representation in Basis *** 
## 
## Call:
## fregre.basis(fdataobj = NOf, y = sumaNO)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -161.19 -103.94  -77.38   19.35 1521.38 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 154.9479     7.4283  20.859   <2e-16 ***
## NOf.bspl4.1   0.1968     0.7041   0.279    0.780    
## NOf.bspl4.2  -0.2560     0.7162  -0.357    0.721    
## NOf.bspl4.3   0.2810     1.0809   0.260    0.795    
## NOf.bspl4.4  -0.2957     0.9120  -0.324    0.746    
## NOf.bspl4.5   0.4675     0.9007   0.519    0.604    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 200.7 on 724 degrees of freedom
## Multiple R-squared:  0.001157,   Adjusted R-squared:  -0.005741 
## F-statistic: 0.1677 on 5 and 724 DF,  p-value: 0.9744
## 
## -Names of possible atypical curves: 84 100 545 587 589 591 592 593 595 597 
##  It prints only the 10 most atypical curves. 
## -Names of possible influence curves: 22 76 202 270 273 283 293 294 295 296 
##  It prints only the 10 most influence curves

summary(regbasis3_6)
##  *** Summary Functional Data Regression with representation in Basis *** 
## 
## Call:
## fregre.basis(fdataobj = O3f, y = sumaO3)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1294.29  -211.79    38.26   254.70  1328.86 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 1271.51096   15.12539  84.065   <2e-16 ***
## O3f.bspl4.1    0.87083    0.92724   0.939    0.348    
## O3f.bspl4.2   -0.54937    1.13043  -0.486    0.627    
## O3f.bspl4.3    0.12826    1.56760   0.082    0.935    
## O3f.bspl4.4   -0.01224    1.21668  -0.010    0.992    
## O3f.bspl4.5   -0.09792    0.90942  -0.108    0.914    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 408.7 on 724 degrees of freedom
## Multiple R-squared:  0.002364,   Adjusted R-squared:  -0.004526 
## F-statistic: 0.3431 on 5 and 724 DF,  p-value: 0.8867
## 
## -Names of possible atypical curves: 315 317 319 321 322 637 639 641 643 
## -Names of possible influence curves: 65 66 71 469 497 520 537 545 640 669

regbasis1_7=fregre.basis(NO2f,maxminNO2)
regbasis2_7=fregre.basis(NOf,maxminNO)
regbasis3_7=fregre.basis(O3f,maxminO3)


summary(regbasis1_7)
##  *** Summary Functional Data Regression with representation in Basis *** 
## 
## Call:
## fregre.basis(fdataobj = NO2f, y = maxminNO2)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -53.883 -16.968  -2.412  14.690 102.235 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  47.558904   0.850326  55.930   <2e-16 ***
## NO2f.bspl4.1 -0.032946   0.061903  -0.532    0.595    
## NO2f.bspl4.2  0.057407   0.080595   0.712    0.477    
## NO2f.bspl4.3 -0.056151   0.115006  -0.488    0.626    
## NO2f.bspl4.4 -0.051960   0.083434  -0.623    0.534    
## NO2f.bspl4.5  0.009919   0.062394   0.159    0.874    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 22.97 on 724 degrees of freedom
## Multiple R-squared:  0.03029,    Adjusted R-squared:  0.02359 
## F-statistic: 4.523 on 5 and 724 DF,  p-value: 0.0004559
## 
## -Names of possible atypical curves: 564 670 711 729 
## -Names of possible influence curves: 22 66 71 74 75 85 105 276 296 299 
##  It prints only the 10 most influence curves

summary(regbasis2_7)
##  *** Summary Functional Data Regression with representation in Basis *** 
## 
## Call:
## fregre.basis(fdataobj = NOf, y = maxminNO)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -30.484 -23.983 -17.274   8.238 296.705 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 29.59726    1.47053  20.127   <2e-16 ***
## NOf.bspl4.1 -0.04343    0.13938  -0.312    0.755    
## NOf.bspl4.2  0.06867    0.14179   0.484    0.628    
## NOf.bspl4.3 -0.10952    0.21399  -0.512    0.609    
## NOf.bspl4.4  0.01510    0.18054   0.084    0.933    
## NOf.bspl4.5  0.03593    0.17830   0.202    0.840    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 39.73 on 724 degrees of freedom
## Multiple R-squared:  0.001141,   Adjusted R-squared:  -0.005757 
## F-statistic: 0.1655 on 5 and 724 DF,  p-value: 0.9752
## 
## -Names of possible atypical curves: 84 100 141 184 403 545 550 587 591 592 
##  It prints only the 10 most atypical curves. 
## -Names of possible influence curves: 22 76 202 270 273 283 293 294 295 296 
##  It prints only the 10 most influence curves

summary(regbasis3_7)
##  *** Summary Functional Data Regression with representation in Basis *** 
## 
## Call:
## fregre.basis(fdataobj = O3f, y = maxminO3)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -105.382  -19.240    0.684   19.202  100.316 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 102.071233   1.138476  89.656   <2e-16 ***
## O3f.bspl4.1   0.084422   0.069792   1.210    0.227    
## O3f.bspl4.2  -0.050383   0.085087  -0.592    0.554    
## O3f.bspl4.3   0.034336   0.117992   0.291    0.771    
## O3f.bspl4.4  -0.029056   0.091578  -0.317    0.751    
## O3f.bspl4.5   0.005917   0.068451   0.086    0.931    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 30.76 on 724 degrees of freedom
## Multiple R-squared:  0.005489,   Adjusted R-squared:  -0.001379 
## F-statistic: 0.7992 on 5 and 724 DF,  p-value: 0.5504
## 
## -Names of possible atypical curves: 315 317 319 322 637 639 641 643 
## -Names of possible influence curves: 65 66 71 469 497 520 537 545 640 669

regbasis2_1=fregre.basis(NO2f,medianNO)
regbasis2_2=fregre.basis(NOf,medianNO2)
regbasis2_3=fregre.basis(O3f,medianNO)
summary(regbasis2_1)
##  *** Summary Functional Data Regression with representation in Basis *** 
## 
## Call:
## fregre.basis(fdataobj = NO2f, y = medianNO)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -4.522 -1.783 -1.480 -0.429 56.770 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   3.730822   0.194399  19.192   <2e-16 ***
## NO2f.bspl4.1 -0.004248   0.014152  -0.300    0.764    
## NO2f.bspl4.2  0.009323   0.018425   0.506    0.613    
## NO2f.bspl4.3 -0.016178   0.026292  -0.615    0.539    
## NO2f.bspl4.4  0.006328   0.019075   0.332    0.740    
## NO2f.bspl4.5  0.003646   0.014264   0.256    0.798    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 5.252 on 724 degrees of freedom
## Multiple R-squared:  0.002322,   Adjusted R-squared:  -0.004568 
## F-statistic: 0.337 on 5 and 724 DF,  p-value: 0.8906
## 
## -Names of possible atypical curves: 589 591 593 595 597 632 636 658 668 670 
##  It prints only the 10 most atypical curves. 
## -Names of possible influence curves: 22 66 71 74 75 85 105 276 296 299 
##  It prints only the 10 most influence curves

summary(regbasis2_2)
##  *** Summary Functional Data Regression with representation in Basis *** 
## 
## Call:
## fregre.basis(fdataobj = NOf, y = medianNO2)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -17.402  -7.110  -3.037   5.357  42.207 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 16.6602740  0.3853022  43.240   <2e-16 ***
## NOf.bspl4.1 -0.0227331  0.0365197  -0.622    0.534    
## NOf.bspl4.2 -0.0003154  0.0371510  -0.008    0.993    
## NOf.bspl4.3 -0.0106300  0.0560679  -0.190    0.850    
## NOf.bspl4.4  0.0059913  0.0473038   0.127    0.899    
## NOf.bspl4.5 -0.0121040  0.0467164  -0.259    0.796    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 10.41 on 724 degrees of freedom
## Multiple R-squared:  0.009097,   Adjusted R-squared:  0.002254 
## F-statistic: 1.329 on 5 and 724 DF,  p-value: 0.2496
## 
## -Names of possible atypical curves: 84 100 130 132 200 210 591 658 670 729 
## -Names of possible influence curves: 22 76 202 270 273 283 293 294 295 296 
##  It prints only the 10 most influence curves

summary(regbasis2_3)
##  *** Summary Functional Data Regression with representation in Basis *** 
## 
## Call:
## fregre.basis(fdataobj = O3f, y = medianNO)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -4.689 -1.983 -1.225 -0.169 56.066 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  3.730822   0.193483  19.282   <2e-16 ***
## O3f.bspl4.1  0.002001   0.011861   0.169    0.866    
## O3f.bspl4.2 -0.006489   0.014460  -0.449    0.654    
## O3f.bspl4.3  0.009925   0.020053   0.495    0.621    
## O3f.bspl4.4 -0.002316   0.015564  -0.149    0.882    
## O3f.bspl4.5 -0.012396   0.011633  -1.066    0.287    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 5.228 on 724 degrees of freedom
## Multiple R-squared:  0.0117, Adjusted R-squared:  0.004879 
## F-statistic: 1.715 on 5 and 724 DF,  p-value: 0.1288
## 
## -Names of possible atypical curves: 589 591 593 595 597 632 636 658 668 670 
##  It prints only the 10 most atypical curves. 
## -Names of possible influence curves: 65 66 71 469 497 520 537 545 640 669

reg_basis3_2= fregre.basis(NOx,medianNO)
summary(regbasis3_3)
##  *** Summary Functional Data Regression with representation in Basis *** 
## 
## Call:
## fregre.basis(fdataobj = O3f, y = maxO3)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -78.246 -11.749  -1.223  11.055  96.156 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  7.748e+01  7.836e-01  98.877   <2e-16 ***
## O3f.bspl4.1 -9.603e-05  4.804e-02  -0.002    0.998    
## O3f.bspl4.2  5.983e-03  5.856e-02   0.102    0.919    
## O3f.bspl4.3 -1.748e-02  8.121e-02  -0.215    0.830    
## O3f.bspl4.4  1.962e-02  6.303e-02   0.311    0.756    
## O3f.bspl4.5 -1.550e-03  4.711e-02  -0.033    0.974    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 21.17 on 724 degrees of freedom
## Multiple R-squared:  0.001945,   Adjusted R-squared:  -0.004947 
## F-statistic: 0.2822 on 5 and 724 DF,  p-value: 0.9229
## 
## -Names of possible atypical curves: 264 315 317 319 344 360 380 637 639 641 
##  It prints only the 10 most atypical curves. 
## -Names of possible influence curves: 65 66 71 469 497 520 537 545 640 669
basis1= create.fourier.basis(rangeval(NOx),nbasis=7)
reg_basis3_2= fregre.basis(NOx,medianNO,basis.x = basis1)
summary(regbasis3_3)
##  *** Summary Functional Data Regression with representation in Basis *** 
## 
## Call:
## fregre.basis(fdataobj = O3f, y = maxO3)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -78.246 -11.749  -1.223  11.055  96.156 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  7.748e+01  7.836e-01  98.877   <2e-16 ***
## O3f.bspl4.1 -9.603e-05  4.804e-02  -0.002    0.998    
## O3f.bspl4.2  5.983e-03  5.856e-02   0.102    0.919    
## O3f.bspl4.3 -1.748e-02  8.121e-02  -0.215    0.830    
## O3f.bspl4.4  1.962e-02  6.303e-02   0.311    0.756    
## O3f.bspl4.5 -1.550e-03  4.711e-02  -0.033    0.974    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 21.17 on 724 degrees of freedom
## Multiple R-squared:  0.001945,   Adjusted R-squared:  -0.004947 
## F-statistic: 0.2822 on 5 and 724 DF,  p-value: 0.9229
## 
## -Names of possible atypical curves: 264 315 317 319 344 360 380 637 639 641 
##  It prints only the 10 most atypical curves. 
## -Names of possible influence curves: 65 66 71 469 497 520 537 545 640 669

You can also embed plots, for example:

##            Length Class     Mode   
## fregre.pc  19     fregre.fd list   
## pc.opt      1     -none-    numeric
## lambda.opt  1     -none-    numeric
## PC.order    8     -none-    numeric
## MSC.order   8     -none-    numeric
##            Length Class     Mode   
## fregre.pc  19     fregre.fd list   
## pc.opt      1     -none-    numeric
## lambda.opt  1     -none-    numeric
## PC.order    8     -none-    numeric
## MSC.order   8     -none-    numeric
##            Length Class     Mode   
## fregre.pc  19     fregre.fd list   
## pc.opt      1     -none-    numeric
## lambda.opt  1     -none-    numeric
## PC.order    8     -none-    numeric
## MSC.order   8     -none-    numeric
##            Length Class     Mode   
## fregre.pc  19     fregre.fd list   
## pc.opt      1     -none-    numeric
## lambda.opt  1     -none-    numeric
## PC.order    8     -none-    numeric
## MSC.order   8     -none-    numeric
##            Length Class     Mode   
## fregre.pc  19     fregre.fd list   
## pc.opt      1     -none-    numeric
## lambda.opt  1     -none-    numeric
## PC.order    8     -none-    numeric
## MSC.order   8     -none-    numeric
##            Length Class     Mode   
## fregre.pc  19     fregre.fd list   
## pc.opt      1     -none-    numeric
## lambda.opt  1     -none-    numeric
## PC.order    8     -none-    numeric
## MSC.order   8     -none-    numeric
##            Length Class     Mode   
## fregre.pc  19     fregre.fd list   
## pc.opt      1     -none-    numeric
## lambda.opt  1     -none-    numeric
## PC.order    8     -none-    numeric
## MSC.order   8     -none-    numeric
##            Length Class     Mode   
## fregre.pc  19     fregre.fd list   
## pc.opt      1     -none-    numeric
## lambda.opt  1     -none-    numeric
## PC.order    8     -none-    numeric
## MSC.order   8     -none-    numeric
##            Length Class     Mode   
## fregre.pc  19     fregre.fd list   
## pc.opt      1     -none-    numeric
## lambda.opt  1     -none-    numeric
## PC.order    8     -none-    numeric
## MSC.order   8     -none-    numeric
##            Length Class     Mode   
## fregre.pc  19     fregre.fd list   
## pc.opt      1     -none-    numeric
## lambda.opt  1     -none-    numeric
## PC.order    8     -none-    numeric
## MSC.order   8     -none-    numeric
##            Length Class     Mode   
## fregre.pc  19     fregre.fd list   
## pc.opt      1     -none-    numeric
## lambda.opt  1     -none-    numeric
## PC.order    8     -none-    numeric
## MSC.order   8     -none-    numeric
##            Length Class     Mode   
## fregre.pc  19     fregre.fd list   
## pc.opt      1     -none-    numeric
## lambda.opt  1     -none-    numeric
## PC.order    8     -none-    numeric
## MSC.order   8     -none-    numeric
##            Length Class     Mode   
## fregre.pc  19     fregre.fd list   
## pc.opt      1     -none-    numeric
## lambda.opt  1     -none-    numeric
## PC.order    8     -none-    numeric
## MSC.order   8     -none-    numeric
##            Length Class     Mode   
## fregre.pc  19     fregre.fd list   
## pc.opt      1     -none-    numeric
## lambda.opt  1     -none-    numeric
## PC.order    8     -none-    numeric
## MSC.order   8     -none-    numeric
##            Length Class     Mode   
## fregre.pc  19     fregre.fd list   
## pc.opt      1     -none-    numeric
## lambda.opt  1     -none-    numeric
## PC.order    8     -none-    numeric
## MSC.order   8     -none-    numeric
##            Length Class     Mode   
## fregre.pc  19     fregre.fd list   
## pc.opt      1     -none-    numeric
## lambda.opt  1     -none-    numeric
## PC.order    8     -none-    numeric
## MSC.order   8     -none-    numeric
##            Length Class     Mode   
## fregre.pc  19     fregre.fd list   
## pc.opt      1     -none-    numeric
## lambda.opt  1     -none-    numeric
## PC.order    8     -none-    numeric
## MSC.order   8     -none-    numeric
##            Length Class     Mode   
## fregre.pc  19     fregre.fd list   
## pc.opt      1     -none-    numeric
## lambda.opt  1     -none-    numeric
## PC.order    8     -none-    numeric
## MSC.order   8     -none-    numeric
##            Length Class     Mode   
## fregre.pc  19     fregre.fd list   
## pc.opt      1     -none-    numeric
## lambda.opt  1     -none-    numeric
## PC.order    8     -none-    numeric
## MSC.order   8     -none-    numeric
##            Length Class     Mode   
## fregre.pc  19     fregre.fd list   
## pc.opt      1     -none-    numeric
## lambda.opt  1     -none-    numeric
## PC.order    8     -none-    numeric
## MSC.order   8     -none-    numeric
##            Length Class     Mode   
## fregre.pc  19     fregre.fd list   
## pc.opt      1     -none-    numeric
## lambda.opt  1     -none-    numeric
## PC.order    8     -none-    numeric
## MSC.order   8     -none-    numeric
##            Length Class     Mode   
## fregre.pc  19     fregre.fd list   
## pc.opt      1     -none-    numeric
## lambda.opt  1     -none-    numeric
## PC.order    8     -none-    numeric
## MSC.order   8     -none-    numeric
##            Length Class     Mode   
## fregre.pc  19     fregre.fd list   
## pc.opt      1     -none-    numeric
## lambda.opt  1     -none-    numeric
## PC.order    8     -none-    numeric
## MSC.order   8     -none-    numeric
##            Length Class     Mode   
## fregre.pc  19     fregre.fd list   
## pc.opt      1     -none-    numeric
## lambda.opt  1     -none-    numeric
## PC.order    8     -none-    numeric
## MSC.order   8     -none-    numeric
##            Length Class     Mode   
## fregre.pc  19     fregre.fd list   
## pc.opt      1     -none-    numeric
## lambda.opt  1     -none-    numeric
## PC.order    8     -none-    numeric
## MSC.order   8     -none-    numeric
## $fregre.pc
## 
## -Call: fregre.pc(fdataobj = fdataobj, y = y, l = drop(pc.opt3), lambda = rn.opt,     P = P, weights = weights)
## 
## -Coefficients:
## (Intercept)          PC2  
##    3.730822     0.002863  
## 
## -R squared:  0.00124658
## -Residual variance:  27.46552 
## 
## $pc.opt
## PC2 
##   2 
## 
## $lambda.opt
## [1] 0
## 
## $PC.order
##          PC(1) PC(2) PC(3) PC(4) PC(5) PC(6) PC(7) PC(8)
## lambda=0     2     7     8     4     3     1     6     5
## 
## $MSC.order
##             PC(1)    PC(2)    PC(3)    PC(4)    PC(5)    PC(6)    PC(7)
## lambda=0 3.328251 3.336394 3.344602 3.353036 3.361606 3.370413 3.379444
##             PC(8)
## lambda=0 3.388474

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.