The R Project SVN R

Rev

Rev 52831 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 52831 Rev 52832
Line 1... Line 1...
1
 
1
 
2
R version 2.12.0 Under development (unstable) (2010-08-30 r52829)
2
R version 2.12.0 Under development (unstable) (2010-08-30 r52829)
3
Copyright (C) 2010 The R Foundation for Statistical Computing
3
Copyright (C) 2010 The R Foundation for Statistical Computing
4
ISBN 3-900051-07-0
4
ISBN 3-900051-07-0
5
Platform: i386-apple-darwin9.8.0/i386 (32-bit)
5
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
6
 
6
 
7
R is free software and comes with ABSOLUTELY NO WARRANTY.
7
R is free software and comes with ABSOLUTELY NO WARRANTY.
8
You are welcome to redistribute it under certain conditions.
8
You are welcome to redistribute it under certain conditions.
9
Type 'license()' or 'licence()' for distribution details.
9
Type 'license()' or 'licence()' for distribution details.
10
 
10
 
Line 9864... Line 9864...
9864
> ### ** Examples
9864
> ### ** Examples
9865
> 
9865
> 
9866
> cars.lo <- loess(dist ~ speed, cars)
9866
> cars.lo <- loess(dist ~ speed, cars)
9867
> predict(cars.lo, data.frame(speed = seq(5, 30, 1)), se = TRUE)
9867
> predict(cars.lo, data.frame(speed = seq(5, 30, 1)), se = TRUE)
9868
$fit
9868
$fit
-
 
9869
        1         2         3         4         5         6         7         8 
9869
 [1]  7.797353 10.002308 12.499786 15.281082 18.446568 21.865315 25.517015
9870
 7.797353 10.002308 12.499786 15.281082 18.446568 21.865315 25.517015 29.350386 
-
 
9871
        9        10        11        12        13        14        15        16 
9870
 [8] 29.350386 33.230660 37.167935 41.205226 45.055736 48.355889 49.824812
9872
33.230660 37.167935 41.205226 45.055736 48.355889 49.824812 51.986702 56.461318 
9871
[15] 51.986702 56.461318 61.959729 68.569313 76.316068 85.212121 95.324047
9873
       17        18        19        20        21        22        23        24 
9872
[22]        NA        NA        NA        NA        NA
9874
61.959729 68.569313 76.316068 85.212121 95.324047        NA        NA        NA 
-
 
9875
       25        26 
-
 
9876
       NA        NA 
9873
 
9877
 
9874
$se.fit
9878
$se.fit
-
 
9879
       1        2        3        4        5        6        7        8 
9875
 [1] 7.568120 5.945831 4.990827 4.545284 4.308639 4.115049 3.789542 3.716231
9880
7.568120 5.945831 4.990827 4.545284 4.308639 4.115049 3.789542 3.716231 
-
 
9881
       9       10       11       12       13       14       15       16 
9876
 [9] 3.776947 4.091747 4.709568 4.245427 4.035929 3.753410 4.004705 4.043190
9882
3.776947 4.091747 4.709568 4.245427 4.035929 3.753410 4.004705 4.043190 
-
 
9883
      17       18       19       20       21       22       23       24 
9877
[17] 4.026105 4.074664 4.570818 5.954217 8.302014       NA       NA       NA
9884
4.026105 4.074664 4.570818 5.954217 8.302014       NA       NA       NA 
-
 
9885
      25       26 
9878
[25]       NA       NA
9886
      NA       NA 
9879
 
9887
 
9880
$residual.scale
9888
$residual.scale
9881
[1] 15.29496
9889
[1] 15.29496
9882
 
9890
 
9883
$df
9891
$df
Line 9886... Line 9894...
9886
> # to allow extrapolation
9894
> # to allow extrapolation
9887
> cars.lo2 <- loess(dist ~ speed, cars,
9895
> cars.lo2 <- loess(dist ~ speed, cars,
9888
+   control = loess.control(surface = "direct"))
9896
+   control = loess.control(surface = "direct"))
9889
> predict(cars.lo2, data.frame(speed = seq(5, 30, 1)), se = TRUE)
9897
> predict(cars.lo2, data.frame(speed = seq(5, 30, 1)), se = TRUE)
9890
$fit
9898
$fit
-
 
9899
         1          2          3          4          5          6          7 
9891
 [1]   7.741006   9.926596  12.442424  15.281082  18.425712  21.865315
9900
  7.741006   9.926596  12.442424  15.281082  18.425712  21.865315  25.713413 
-
 
9901
         8          9         10         11         12         13         14 
9892
 [7]  25.713413  29.350386  33.230660  37.167935  41.205226  45.781544
9902
 29.350386  33.230660  37.167935  41.205226  45.781544  48.355889  50.067148 
9893
[13]  48.355889  50.067148  51.986702  56.445263  62.025404  68.569313
9903
        15         16         17         18         19         20         21 
9894
[19]  76.193111  85.053364  95.300523 106.974661 120.092581 134.665851
9904
 51.986702  56.445263  62.025404  68.569313  76.193111  85.053364  95.300523 
-
 
9905
        22         23         24         25         26 
9895
[25] 150.698545 168.190283
9906
106.974661 120.092581 134.665851 150.698545 168.190283 
9896
 
9907
 
9897
$se.fit
9908
$se.fit
-
 
9909
        1         2         3         4         5         6         7         8 
9898
 [1]  7.565991  5.959097  5.012013  4.550013  4.321596  4.119331  3.939804
9910
 7.565991  5.959097  5.012013  4.550013  4.321596  4.119331  3.939804  3.720098 
-
 
9911
        9        10        11        12        13        14        15        16 
9899
 [8]  3.720098  3.780877  4.096004  4.714469  4.398936  4.040129  4.184257
9912
 3.780877  4.096004  4.714469  4.398936  4.040129  4.184257  4.008873  4.061865 
-
 
9913
       17        18        19        20        21        22        23        24 
9900
[15]  4.008873  4.061865  4.033998  4.078904  4.584606  5.952480  8.306901
9914
 4.033998  4.078904  4.584606  5.952480  8.306901 11.601911 15.792480 20.864660 
-
 
9915
       25        26 
9901
[22] 11.601911 15.792480 20.864660 26.823827 33.683999
9916
26.823827 33.683999 
9902
 
9917
 
9903
$residual.scale
9918
$residual.scale
9904
[1] 15.31087
9919
[1] 15.31087
9905
 
9920
 
9906
$df
9921
$df
Line 14002... Line 14017...
14002
> ### ** Examples
14017
> ### ** Examples
14003
> 
14018
> 
14004
> cars.lo <- loess(dist ~ speed, cars)
14019
> cars.lo <- loess(dist ~ speed, cars)
14005
> predict(cars.lo, data.frame(speed=seq(5, 30, 1)), se=TRUE)
14020
> predict(cars.lo, data.frame(speed=seq(5, 30, 1)), se=TRUE)
14006
$fit
14021
$fit
-
 
14022
        1         2         3         4         5         6         7         8 
14007
 [1]  7.797353 10.002308 12.499786 15.281082 18.446568 21.865315 25.517015
14023
 7.797353 10.002308 12.499786 15.281082 18.446568 21.865315 25.517015 29.350386 
-
 
14024
        9        10        11        12        13        14        15        16 
14008
 [8] 29.350386 33.230660 37.167935 41.205226 45.055736 48.355889 49.824812
14025
33.230660 37.167935 41.205226 45.055736 48.355889 49.824812 51.986702 56.461318 
14009
[15] 51.986702 56.461318 61.959729 68.569313 76.316068 85.212121 95.324047
14026
       17        18        19        20        21        22        23        24 
14010
[22]        NA        NA        NA        NA        NA
14027
61.959729 68.569313 76.316068 85.212121 95.324047        NA        NA        NA 
-
 
14028
       25        26 
-
 
14029
       NA        NA 
14011
 
14030
 
14012
$se.fit
14031
$se.fit
-
 
14032
       1        2        3        4        5        6        7        8 
14013
 [1] 7.568120 5.945831 4.990827 4.545284 4.308639 4.115049 3.789542 3.716231
14033
7.568120 5.945831 4.990827 4.545284 4.308639 4.115049 3.789542 3.716231 
-
 
14034
       9       10       11       12       13       14       15       16 
14014
 [9] 3.776947 4.091747 4.709568 4.245427 4.035929 3.753410 4.004705 4.043190
14035
3.776947 4.091747 4.709568 4.245427 4.035929 3.753410 4.004705 4.043190 
-
 
14036
      17       18       19       20       21       22       23       24 
14015
[17] 4.026105 4.074664 4.570818 5.954217 8.302014       NA       NA       NA
14037
4.026105 4.074664 4.570818 5.954217 8.302014       NA       NA       NA 
-
 
14038
      25       26 
14016
[25]       NA       NA
14039
      NA       NA 
14017
 
14040
 
14018
$residual.scale
14041
$residual.scale
14019
[1] 15.29496
14042
[1] 15.29496
14020
 
14043
 
14021
$df
14044
$df
Line 14024... Line 14047...
14024
> # to get extrapolation
14047
> # to get extrapolation
14025
> cars.lo2 <- loess(dist ~ speed, cars,
14048
> cars.lo2 <- loess(dist ~ speed, cars,
14026
+   control=loess.control(surface="direct"))
14049
+   control=loess.control(surface="direct"))
14027
> predict(cars.lo2, data.frame(speed=seq(5, 30, 1)), se=TRUE)
14050
> predict(cars.lo2, data.frame(speed=seq(5, 30, 1)), se=TRUE)
14028
$fit
14051
$fit
-
 
14052
         1          2          3          4          5          6          7 
14029
 [1]   7.741006   9.926596  12.442424  15.281082  18.425712  21.865315
14053
  7.741006   9.926596  12.442424  15.281082  18.425712  21.865315  25.713413 
-
 
14054
         8          9         10         11         12         13         14 
14030
 [7]  25.713413  29.350386  33.230660  37.167935  41.205226  45.781544
14055
 29.350386  33.230660  37.167935  41.205226  45.781544  48.355889  50.067148 
14031
[13]  48.355889  50.067148  51.986702  56.445263  62.025404  68.569313
14056
        15         16         17         18         19         20         21 
14032
[19]  76.193111  85.053364  95.300523 106.974661 120.092581 134.665851
14057
 51.986702  56.445263  62.025404  68.569313  76.193111  85.053364  95.300523 
-
 
14058
        22         23         24         25         26 
14033
[25] 150.698545 168.190283
14059
106.974661 120.092581 134.665851 150.698545 168.190283 
14034
 
14060
 
14035
$se.fit
14061
$se.fit
-
 
14062
        1         2         3         4         5         6         7         8 
14036
 [1]  7.565991  5.959097  5.012013  4.550013  4.321596  4.119331  3.939804
14063
 7.565991  5.959097  5.012013  4.550013  4.321596  4.119331  3.939804  3.720098 
-
 
14064
        9        10        11        12        13        14        15        16 
14037
 [8]  3.720098  3.780877  4.096004  4.714469  4.398936  4.040129  4.184257
14065
 3.780877  4.096004  4.714469  4.398936  4.040129  4.184257  4.008873  4.061865 
-
 
14066
       17        18        19        20        21        22        23        24 
14038
[15]  4.008873  4.061865  4.033998  4.078904  4.584606  5.952480  8.306901
14067
 4.033998  4.078904  4.584606  5.952480  8.306901 11.601911 15.792480 20.864660 
-
 
14068
       25        26 
14039
[22] 11.601911 15.792480 20.864660 26.823827 33.683999
14069
26.823827 33.683999 
14040
 
14070
 
14041
$residual.scale
14071
$residual.scale
14042
[1] 15.31087
14072
[1] 15.31087
14043
 
14073
 
14044
$df
14074
$df