## Paul Johnson
## 2014-02-15
## Notes on plotting things in R, starting from Joshua Wiley's example.

## Posted in r-sig-teaching 2011-04-04
## Joshua Wiley
## Ph.D. Student, Health Psychology

## Load in this function's code, then test out with example usages below

PlotDist <- function (alpha, from = -5, to = 5, n = 1000, filename = NULL,
alternative = c("two.tailed", "greater", "lesser"), distribution =
c("normal","t", "F", "chisq", "binomial"), colour = "black", fill = "skyblue2",
...)
{
alternative <- match.arg(alternative)
alt.alpha <- switch(alternative, two.tailed = alpha/2, greater = alpha,
lesser = alpha)
MyDen <- switch(distribution, normal = dnorm, t = dt, F = df,
chisq = dchisq, binomial = dbinom)
MyDist <- switch(distribution, normal = qnorm, t = qt, F = qf,
chisq = qchisq, binomial = qbinom)
crit.lower <- MyDist(p = alt.alpha, lower.tail = TRUE, ...)
crit.upper <- MyDist(p = alt.alpha, lower.tail = FALSE, ...)
cord.x1 <- c(from, seq(from = from, to = crit.lower, length.out = 100),
crit.lower)
cord.y1 <- c(0, MyDen(x = seq(from = from, to = crit.lower,
length.out = 100), ...), 0)
cord.x2 <- c(crit.upper, seq(from = crit.upper, to = to,
length.out = 100), to)
cord.y2 <- c(0, MyDen(x = seq(from = crit.upper, to = to,
length.out = 100), ...), 0)
if (!is.null(filename)) pdf(file = filename)
curve(MyDen(x, ...), from = from, to = to, n = n, col = colour,
lty = 1, lwd = 2, ylab = "Density", xlab = "Values")
if (!identical(alternative, "greater")) {
polygon(x = cord.x1, y = cord.y1, col = fill)
}
if (!identical(alternative, "lesser")) {
polygon(x = cord.x2, y = cord.y2, col = fill)
}
if (!is.null(filename)) dev.off()
}

### TEST that. Example usage. It is a little bit fun.

PlotDist(alpha = 0.05, alternative = c("two.tailed"), distribution = "normal", colour = "red", fill = "green")


PlotDist(alpha = 0.05, alternative = c("greater"), distribution = "normal")


PlotDist(alpha = 0.05, alternative = c("greater"), distribution = "F", df1 = 10, df2 = 20)


## left edge looks wrong.
PlotDist(alpha = 0.05, alternative = c("greater"), distribution = "F", from = 0, to = 10, df1 = 10, df2 = 20)


##double check the old fashioned way re-consider

x <- seq(0, 2, by = 0.0005)
denx <-df(x, df1 = 10, df2 = 20)
plot(x, denx, type = "l")


##Chi-square interesting
PlotDist(alpha = 0.05, alternative = c("greater"), distribution = "chisq", df = 5, from = 0, to = 50)


PlotDist(alpha = 0.05, alternative = c("greater"), distribution = "chisq", df = 10, from = 0, to = 50)


PlotDist(alpha = 0.05, alternative = c("greater"), distribution = "chisq", df = 20, from = 0, to = 50)


## doesn't work, did not check why. Suspect that a discrete distribution just won't work here.
##
PlotDist(alpha = 0.05, alternative = c("greater"), distribution = "binomial", size = 20, prob = 0.2, from=0, to = 5)

## Warning: non-integer x = 0.010101
## Warning: non-integer x = 0.020202
## Warning: non-integer x = 0.030303
## Warning: non-integer x = 0.040404
## Warning: non-integer x = 0.050505
## Warning: non-integer x = 0.060606
## Warning: non-integer x = 0.070707
## Warning: non-integer x = 0.080808
## Warning: non-integer x = 0.090909
## Warning: non-integer x = 0.101010
## Warning: non-integer x = 0.111111
## Warning: non-integer x = 0.121212
## Warning: non-integer x = 0.131313
## Warning: non-integer x = 0.141414
## Warning: non-integer x = 0.151515
## Warning: non-integer x = 0.161616
## Warning: non-integer x = 0.171717
## Warning: non-integer x = 0.181818
## Warning: non-integer x = 0.191919
## Warning: non-integer x = 0.202020
## Warning: non-integer x = 0.212121
## Warning: non-integer x = 0.222222
## Warning: non-integer x = 0.232323
## Warning: non-integer x = 0.242424
## Warning: non-integer x = 0.252525
## Warning: non-integer x = 0.262626
## Warning: non-integer x = 0.272727
## Warning: non-integer x = 0.282828
## Warning: non-integer x = 0.292929
## Warning: non-integer x = 0.303030
## Warning: non-integer x = 0.313131
## Warning: non-integer x = 0.323232
## Warning: non-integer x = 0.333333
## Warning: non-integer x = 0.343434
## Warning: non-integer x = 0.353535
## Warning: non-integer x = 0.363636
## Warning: non-integer x = 0.373737
## Warning: non-integer x = 0.383838
## Warning: non-integer x = 0.393939
## Warning: non-integer x = 0.404040
## Warning: non-integer x = 0.414141
## Warning: non-integer x = 0.424242
## Warning: non-integer x = 0.434343
## Warning: non-integer x = 0.444444
## Warning: non-integer x = 0.454545
## Warning: non-integer x = 0.464646
## Warning: non-integer x = 0.474747
## Warning: non-integer x = 0.484848
## Warning: non-integer x = 0.494949
## Warning: non-integer x = 0.505051
## Warning: non-integer x = 0.515152
## Warning: non-integer x = 0.525253
## Warning: non-integer x = 0.535354
## Warning: non-integer x = 0.545455
## Warning: non-integer x = 0.555556
## Warning: non-integer x = 0.565657
## Warning: non-integer x = 0.575758
## Warning: non-integer x = 0.585859
## Warning: non-integer x = 0.595960
## Warning: non-integer x = 0.606061
## Warning: non-integer x = 0.616162
## Warning: non-integer x = 0.626263
## Warning: non-integer x = 0.636364
## Warning: non-integer x = 0.646465
## Warning: non-integer x = 0.656566
## Warning: non-integer x = 0.666667
## Warning: non-integer x = 0.676768
## Warning: non-integer x = 0.686869
## Warning: non-integer x = 0.696970
## Warning: non-integer x = 0.707071
## Warning: non-integer x = 0.717172
## Warning: non-integer x = 0.727273
## Warning: non-integer x = 0.737374
## Warning: non-integer x = 0.747475
## Warning: non-integer x = 0.757576
## Warning: non-integer x = 0.767677
## Warning: non-integer x = 0.777778
## Warning: non-integer x = 0.787879
## Warning: non-integer x = 0.797980
## Warning: non-integer x = 0.808081
## Warning: non-integer x = 0.818182
## Warning: non-integer x = 0.828283
## Warning: non-integer x = 0.838384
## Warning: non-integer x = 0.848485
## Warning: non-integer x = 0.858586
## Warning: non-integer x = 0.868687
## Warning: non-integer x = 0.878788
## Warning: non-integer x = 0.888889
## Warning: non-integer x = 0.898990
## Warning: non-integer x = 0.909091
## Warning: non-integer x = 0.919192
## Warning: non-integer x = 0.929293
## Warning: non-integer x = 0.939394
## Warning: non-integer x = 0.949495
## Warning: non-integer x = 0.959596
## Warning: non-integer x = 0.969697
## Warning: non-integer x = 0.979798
## Warning: non-integer x = 0.989899
## Warning: non-integer x = 6.979798
## Warning: non-integer x = 6.959596
## Warning: non-integer x = 6.939394
## Warning: non-integer x = 6.919192
## Warning: non-integer x = 6.898990
## Warning: non-integer x = 6.878788
## Warning: non-integer x = 6.858586
## Warning: non-integer x = 6.838384
## Warning: non-integer x = 6.818182
## Warning: non-integer x = 6.797980
## Warning: non-integer x = 6.777778
## Warning: non-integer x = 6.757576
## Warning: non-integer x = 6.737374
## Warning: non-integer x = 6.717172
## Warning: non-integer x = 6.696970
## Warning: non-integer x = 6.676768
## Warning: non-integer x = 6.656566
## Warning: non-integer x = 6.636364
## Warning: non-integer x = 6.616162
## Warning: non-integer x = 6.595960
## Warning: non-integer x = 6.575758
## Warning: non-integer x = 6.555556
## Warning: non-integer x = 6.535354
## Warning: non-integer x = 6.515152
## Warning: non-integer x = 6.494949
## Warning: non-integer x = 6.474747
## Warning: non-integer x = 6.454545
## Warning: non-integer x = 6.434343
## Warning: non-integer x = 6.414141
## Warning: non-integer x = 6.393939
## Warning: non-integer x = 6.373737
## Warning: non-integer x = 6.353535
## Warning: non-integer x = 6.333333
## Warning: non-integer x = 6.313131
## Warning: non-integer x = 6.292929
## Warning: non-integer x = 6.272727
## Warning: non-integer x = 6.252525
## Warning: non-integer x = 6.232323
## Warning: non-integer x = 6.212121
## Warning: non-integer x = 6.191919
## Warning: non-integer x = 6.171717
## Warning: non-integer x = 6.151515
## Warning: non-integer x = 6.131313
## Warning: non-integer x = 6.111111
## Warning: non-integer x = 6.090909
## Warning: non-integer x = 6.070707
## Warning: non-integer x = 6.050505
## Warning: non-integer x = 6.030303
## Warning: non-integer x = 6.010101
## Warning: non-integer x = 5.989899
## Warning: non-integer x = 5.969697
## Warning: non-integer x = 5.949495
## Warning: non-integer x = 5.929293
## Warning: non-integer x = 5.909091
## Warning: non-integer x = 5.888889
## Warning: non-integer x = 5.868687
## Warning: non-integer x = 5.848485
## Warning: non-integer x = 5.828283
## Warning: non-integer x = 5.808081
## Warning: non-integer x = 5.787879
## Warning: non-integer x = 5.767677
## Warning: non-integer x = 5.747475
## Warning: non-integer x = 5.727273
## Warning: non-integer x = 5.707071
## Warning: non-integer x = 5.686869
## Warning: non-integer x = 5.666667
## Warning: non-integer x = 5.646465
## Warning: non-integer x = 5.626263
## Warning: non-integer x = 5.606061
## Warning: non-integer x = 5.585859
## Warning: non-integer x = 5.565657
## Warning: non-integer x = 5.545455
## Warning: non-integer x = 5.525253
## Warning: non-integer x = 5.505051
## Warning: non-integer x = 5.484848
## Warning: non-integer x = 5.464646
## Warning: non-integer x = 5.444444
## Warning: non-integer x = 5.424242
## Warning: non-integer x = 5.404040
## Warning: non-integer x = 5.383838
## Warning: non-integer x = 5.363636
## Warning: non-integer x = 5.343434
## Warning: non-integer x = 5.323232
## Warning: non-integer x = 5.303030
## Warning: non-integer x = 5.282828
## Warning: non-integer x = 5.262626
## Warning: non-integer x = 5.242424
## Warning: non-integer x = 5.222222
## Warning: non-integer x = 5.202020
## Warning: non-integer x = 5.181818
## Warning: non-integer x = 5.161616
## Warning: non-integer x = 5.141414
## Warning: non-integer x = 5.121212
## Warning: non-integer x = 5.101010
## Warning: non-integer x = 5.080808
## Warning: non-integer x = 5.060606
## Warning: non-integer x = 5.040404
## Warning: non-integer x = 5.020202
## Warning: non-integer x = 0.005005
## Warning: non-integer x = 0.010010
## Warning: non-integer x = 0.015015
## Warning: non-integer x = 0.020020
## Warning: non-integer x = 0.025025
## Warning: non-integer x = 0.030030
## Warning: non-integer x = 0.035035
## Warning: non-integer x = 0.040040
## Warning: non-integer x = 0.045045
## Warning: non-integer x = 0.050050
## Warning: non-integer x = 0.055055
## Warning: non-integer x = 0.060060
## Warning: non-integer x = 0.065065
## Warning: non-integer x = 0.070070
## Warning: non-integer x = 0.075075
## Warning: non-integer x = 0.080080
## Warning: non-integer x = 0.085085
## Warning: non-integer x = 0.090090
## Warning: non-integer x = 0.095095
## Warning: non-integer x = 0.100100
## Warning: non-integer x = 0.105105
## Warning: non-integer x = 0.110110
## Warning: non-integer x = 0.115115
## Warning: non-integer x = 0.120120
## Warning: non-integer x = 0.125125
## Warning: non-integer x = 0.130130
## Warning: non-integer x = 0.135135
## Warning: non-integer x = 0.140140
## Warning: non-integer x = 0.145145
## Warning: non-integer x = 0.150150
## Warning: non-integer x = 0.155155
## Warning: non-integer x = 0.160160
## Warning: non-integer x = 0.165165
## Warning: non-integer x = 0.170170
## Warning: non-integer x = 0.175175
## Warning: non-integer x = 0.180180
## Warning: non-integer x = 0.185185
## Warning: non-integer x = 0.190190
## Warning: non-integer x = 0.195195
## Warning: non-integer x = 0.200200
## Warning: non-integer x = 0.205205
## Warning: non-integer x = 0.210210
## Warning: non-integer x = 0.215215
## Warning: non-integer x = 0.220220
## Warning: non-integer x = 0.225225
## Warning: non-integer x = 0.230230
## Warning: non-integer x = 0.235235
## Warning: non-integer x = 0.240240
## Warning: non-integer x = 0.245245
## Warning: non-integer x = 0.250250
## Warning: non-integer x = 0.255255
## Warning: non-integer x = 0.260260
## Warning: non-integer x = 0.265265
## Warning: non-integer x = 0.270270
## Warning: non-integer x = 0.275275
## Warning: non-integer x = 0.280280
## Warning: non-integer x = 0.285285
## Warning: non-integer x = 0.290290
## Warning: non-integer x = 0.295295
## Warning: non-integer x = 0.300300
## Warning: non-integer x = 0.305305
## Warning: non-integer x = 0.310310
## Warning: non-integer x = 0.315315
## Warning: non-integer x = 0.320320
## Warning: non-integer x = 0.325325
## Warning: non-integer x = 0.330330
## Warning: non-integer x = 0.335335
## Warning: non-integer x = 0.340340
## Warning: non-integer x = 0.345345
## Warning: non-integer x = 0.350350
## Warning: non-integer x = 0.355355
## Warning: non-integer x = 0.360360
## Warning: non-integer x = 0.365365
## Warning: non-integer x = 0.370370
## Warning: non-integer x = 0.375375
## Warning: non-integer x = 0.380380
## Warning: non-integer x = 0.385385
## Warning: non-integer x = 0.390390
## Warning: non-integer x = 0.395395
## Warning: non-integer x = 0.400400
## Warning: non-integer x = 0.405405
## Warning: non-integer x = 0.410410
## Warning: non-integer x = 0.415415
## Warning: non-integer x = 0.420420
## Warning: non-integer x = 0.425425
## Warning: non-integer x = 0.430430
## Warning: non-integer x = 0.435435
## Warning: non-integer x = 0.440440
## Warning: non-integer x = 0.445445
## Warning: non-integer x = 0.450450
## Warning: non-integer x = 0.455455
## Warning: non-integer x = 0.460460
## Warning: non-integer x = 0.465465
## Warning: non-integer x = 0.470470
## Warning: non-integer x = 0.475475
## Warning: non-integer x = 0.480480
## Warning: non-integer x = 0.485485
## Warning: non-integer x = 0.490490
## Warning: non-integer x = 0.495495
## Warning: non-integer x = 0.500501
## Warning: non-integer x = 0.505506
## Warning: non-integer x = 0.510511
## Warning: non-integer x = 0.515516
## Warning: non-integer x = 0.520521
## Warning: non-integer x = 0.525526
## Warning: non-integer x = 0.530531
## Warning: non-integer x = 0.535536
## Warning: non-integer x = 0.540541
## Warning: non-integer x = 0.545546
## Warning: non-integer x = 0.550551
## Warning: non-integer x = 0.555556
## Warning: non-integer x = 0.560561
## Warning: non-integer x = 0.565566
## Warning: non-integer x = 0.570571
## Warning: non-integer x = 0.575576
## Warning: non-integer x = 0.580581
## Warning: non-integer x = 0.585586
## Warning: non-integer x = 0.590591
## Warning: non-integer x = 0.595596
## Warning: non-integer x = 0.600601
## Warning: non-integer x = 0.605606
## Warning: non-integer x = 0.610611
## Warning: non-integer x = 0.615616
## Warning: non-integer x = 0.620621
## Warning: non-integer x = 0.625626
## Warning: non-integer x = 0.630631
## Warning: non-integer x = 0.635636
## Warning: non-integer x = 0.640641
## Warning: non-integer x = 0.645646
## Warning: non-integer x = 0.650651
## Warning: non-integer x = 0.655656
## Warning: non-integer x = 0.660661
## Warning: non-integer x = 0.665666
## Warning: non-integer x = 0.670671
## Warning: non-integer x = 0.675676
## Warning: non-integer x = 0.680681
## Warning: non-integer x = 0.685686
## Warning: non-integer x = 0.690691
## Warning: non-integer x = 0.695696
## Warning: non-integer x = 0.700701
## Warning: non-integer x = 0.705706
## Warning: non-integer x = 0.710711
## Warning: non-integer x = 0.715716
## Warning: non-integer x = 0.720721
## Warning: non-integer x = 0.725726
## Warning: non-integer x = 0.730731
## Warning: non-integer x = 0.735736
## Warning: non-integer x = 0.740741
## Warning: non-integer x = 0.745746
## Warning: non-integer x = 0.750751
## Warning: non-integer x = 0.755756
## Warning: non-integer x = 0.760761
## Warning: non-integer x = 0.765766
## Warning: non-integer x = 0.770771
## Warning: non-integer x = 0.775776
## Warning: non-integer x = 0.780781
## Warning: non-integer x = 0.785786
## Warning: non-integer x = 0.790791
## Warning: non-integer x = 0.795796
## Warning: non-integer x = 0.800801
## Warning: non-integer x = 0.805806
## Warning: non-integer x = 0.810811
## Warning: non-integer x = 0.815816
## Warning: non-integer x = 0.820821
## Warning: non-integer x = 0.825826
## Warning: non-integer x = 0.830831
## Warning: non-integer x = 0.835836
## Warning: non-integer x = 0.840841
## Warning: non-integer x = 0.845846
## Warning: non-integer x = 0.850851
## Warning: non-integer x = 0.855856
## Warning: non-integer x = 0.860861
## Warning: non-integer x = 0.865866
## Warning: non-integer x = 0.870871
## Warning: non-integer x = 0.875876
## Warning: non-integer x = 0.880881
## Warning: non-integer x = 0.885886
## Warning: non-integer x = 0.890891
## Warning: non-integer x = 0.895896
## Warning: non-integer x = 0.900901
## Warning: non-integer x = 0.905906
## Warning: non-integer x = 0.910911
## Warning: non-integer x = 0.915916
## Warning: non-integer x = 0.920921
## Warning: non-integer x = 0.925926
## Warning: non-integer x = 0.930931
## Warning: non-integer x = 0.935936
## Warning: non-integer x = 0.940941
## Warning: non-integer x = 0.945946
## Warning: non-integer x = 0.950951
## Warning: non-integer x = 0.955956
## Warning: non-integer x = 0.960961
## Warning: non-integer x = 0.965966
## Warning: non-integer x = 0.970971
## Warning: non-integer x = 0.975976
## Warning: non-integer x = 0.980981
## Warning: non-integer x = 0.985986
## Warning: non-integer x = 0.990991
## Warning: non-integer x = 0.995996
## Warning: non-integer x = 1.001001
## Warning: non-integer x = 1.006006
## Warning: non-integer x = 1.011011
## Warning: non-integer x = 1.016016
## Warning: non-integer x = 1.021021
## Warning: non-integer x = 1.026026
## Warning: non-integer x = 1.031031
## Warning: non-integer x = 1.036036
## Warning: non-integer x = 1.041041
## Warning: non-integer x = 1.046046
## Warning: non-integer x = 1.051051
## Warning: non-integer x = 1.056056
## Warning: non-integer x = 1.061061
## Warning: non-integer x = 1.066066
## Warning: non-integer x = 1.071071
## Warning: non-integer x = 1.076076
## Warning: non-integer x = 1.081081
## Warning: non-integer x = 1.086086
## Warning: non-integer x = 1.091091
## Warning: non-integer x = 1.096096
## Warning: non-integer x = 1.101101
## Warning: non-integer x = 1.106106
## Warning: non-integer x = 1.111111
## Warning: non-integer x = 1.116116
## Warning: non-integer x = 1.121121
## Warning: non-integer x = 1.126126
## Warning: non-integer x = 1.131131
## Warning: non-integer x = 1.136136
## Warning: non-integer x = 1.141141
## Warning: non-integer x = 1.146146
## Warning: non-integer x = 1.151151
## Warning: non-integer x = 1.156156
## Warning: non-integer x = 1.161161
## Warning: non-integer x = 1.166166
## Warning: non-integer x = 1.171171
## Warning: non-integer x = 1.176176
## Warning: non-integer x = 1.181181
## Warning: non-integer x = 1.186186
## Warning: non-integer x = 1.191191
## Warning: non-integer x = 1.196196
## Warning: non-integer x = 1.201201
## Warning: non-integer x = 1.206206
## Warning: non-integer x = 1.211211
## Warning: non-integer x = 1.216216
## Warning: non-integer x = 1.221221
## Warning: non-integer x = 1.226226
## Warning: non-integer x = 1.231231
## Warning: non-integer x = 1.236236
## Warning: non-integer x = 1.241241
## Warning: non-integer x = 1.246246
## Warning: non-integer x = 1.251251
## Warning: non-integer x = 1.256256
## Warning: non-integer x = 1.261261
## Warning: non-integer x = 1.266266
## Warning: non-integer x = 1.271271
## Warning: non-integer x = 1.276276
## Warning: non-integer x = 1.281281
## Warning: non-integer x = 1.286286
## Warning: non-integer x = 1.291291
## Warning: non-integer x = 1.296296
## Warning: non-integer x = 1.301301
## Warning: non-integer x = 1.306306
## Warning: non-integer x = 1.311311
## Warning: non-integer x = 1.316316
## Warning: non-integer x = 1.321321
## Warning: non-integer x = 1.326326
## Warning: non-integer x = 1.331331
## Warning: non-integer x = 1.336336
## Warning: non-integer x = 1.341341
## Warning: non-integer x = 1.346346
## Warning: non-integer x = 1.351351
## Warning: non-integer x = 1.356356
## Warning: non-integer x = 1.361361
## Warning: non-integer x = 1.366366
## Warning: non-integer x = 1.371371
## Warning: non-integer x = 1.376376
## Warning: non-integer x = 1.381381
## Warning: non-integer x = 1.386386
## Warning: non-integer x = 1.391391
## Warning: non-integer x = 1.396396
## Warning: non-integer x = 1.401401
## Warning: non-integer x = 1.406406
## Warning: non-integer x = 1.411411
## Warning: non-integer x = 1.416416
## Warning: non-integer x = 1.421421
## Warning: non-integer x = 1.426426
## Warning: non-integer x = 1.431431
## Warning: non-integer x = 1.436436
## Warning: non-integer x = 1.441441
## Warning: non-integer x = 1.446446
## Warning: non-integer x = 1.451451
## Warning: non-integer x = 1.456456
## Warning: non-integer x = 1.461461
## Warning: non-integer x = 1.466466
## Warning: non-integer x = 1.471471
## Warning: non-integer x = 1.476476
## Warning: non-integer x = 1.481481
## Warning: non-integer x = 1.486486
## Warning: non-integer x = 1.491491
## Warning: non-integer x = 1.496496
## Warning: non-integer x = 1.501502
## Warning: non-integer x = 1.506507
## Warning: non-integer x = 1.511512
## Warning: non-integer x = 1.516517
## Warning: non-integer x = 1.521522
## Warning: non-integer x = 1.526527
## Warning: non-integer x = 1.531532
## Warning: non-integer x = 1.536537
## Warning: non-integer x = 1.541542
## Warning: non-integer x = 1.546547
## Warning: non-integer x = 1.551552
## Warning: non-integer x = 1.556557
## Warning: non-integer x = 1.561562
## Warning: non-integer x = 1.566567
## Warning: non-integer x = 1.571572
## Warning: non-integer x = 1.576577
## Warning: non-integer x = 1.581582
## Warning: non-integer x = 1.586587
## Warning: non-integer x = 1.591592
## Warning: non-integer x = 1.596597
## Warning: non-integer x = 1.601602
## Warning: non-integer x = 1.606607
## Warning: non-integer x = 1.611612
## Warning: non-integer x = 1.616617
## Warning: non-integer x = 1.621622
## Warning: non-integer x = 1.626627
## Warning: non-integer x = 1.631632
## Warning: non-integer x = 1.636637
## Warning: non-integer x = 1.641642
## Warning: non-integer x = 1.646647
## Warning: non-integer x = 1.651652
## Warning: non-integer x = 1.656657
## Warning: non-integer x = 1.661662
## Warning: non-integer x = 1.666667
## Warning: non-integer x = 1.671672
## Warning: non-integer x = 1.676677
## Warning: non-integer x = 1.681682
## Warning: non-integer x = 1.686687
## Warning: non-integer x = 1.691692
## Warning: non-integer x = 1.696697
## Warning: non-integer x = 1.701702
## Warning: non-integer x = 1.706707
## Warning: non-integer x = 1.711712
## Warning: non-integer x = 1.716717
## Warning: non-integer x = 1.721722
## Warning: non-integer x = 1.726727
## Warning: non-integer x = 1.731732
## Warning: non-integer x = 1.736737
## Warning: non-integer x = 1.741742
## Warning: non-integer x = 1.746747
## Warning: non-integer x = 1.751752
## Warning: non-integer x = 1.756757
## Warning: non-integer x = 1.761762
## Warning: non-integer x = 1.766767
## Warning: non-integer x = 1.771772
## Warning: non-integer x = 1.776777
## Warning: non-integer x = 1.781782
## Warning: non-integer x = 1.786787
## Warning: non-integer x = 1.791792
## Warning: non-integer x = 1.796797
## Warning: non-integer x = 1.801802
## Warning: non-integer x = 1.806807
## Warning: non-integer x = 1.811812
## Warning: non-integer x = 1.816817
## Warning: non-integer x = 1.821822
## Warning: non-integer x = 1.826827
## Warning: non-integer x = 1.831832
## Warning: non-integer x = 1.836837
## Warning: non-integer x = 1.841842
## Warning: non-integer x = 1.846847
## Warning: non-integer x = 1.851852
## Warning: non-integer x = 1.856857
## Warning: non-integer x = 1.861862
## Warning: non-integer x = 1.866867
## Warning: non-integer x = 1.871872
## Warning: non-integer x = 1.876877
## Warning: non-integer x = 1.881882
## Warning: non-integer x = 1.886887
## Warning: non-integer x = 1.891892
## Warning: non-integer x = 1.896897
## Warning: non-integer x = 1.901902
## Warning: non-integer x = 1.906907
## Warning: non-integer x = 1.911912
## Warning: non-integer x = 1.916917
## Warning: non-integer x = 1.921922
## Warning: non-integer x = 1.926927
## Warning: non-integer x = 1.931932
## Warning: non-integer x = 1.936937
## Warning: non-integer x = 1.941942
## Warning: non-integer x = 1.946947
## Warning: non-integer x = 1.951952
## Warning: non-integer x = 1.956957
## Warning: non-integer x = 1.961962
## Warning: non-integer x = 1.966967
## Warning: non-integer x = 1.971972
## Warning: non-integer x = 1.976977
## Warning: non-integer x = 1.981982
## Warning: non-integer x = 1.986987
## Warning: non-integer x = 1.991992
## Warning: non-integer x = 1.996997
## Warning: non-integer x = 2.002002
## Warning: non-integer x = 2.007007
## Warning: non-integer x = 2.012012
## Warning: non-integer x = 2.017017
## Warning: non-integer x = 2.022022
## Warning: non-integer x = 2.027027
## Warning: non-integer x = 2.032032
## Warning: non-integer x = 2.037037
## Warning: non-integer x = 2.042042
## Warning: non-integer x = 2.047047
## Warning: non-integer x = 2.052052
## Warning: non-integer x = 2.057057
## Warning: non-integer x = 2.062062
## Warning: non-integer x = 2.067067
## Warning: non-integer x = 2.072072
## Warning: non-integer x = 2.077077
## Warning: non-integer x = 2.082082
## Warning: non-integer x = 2.087087
## Warning: non-integer x = 2.092092
## Warning: non-integer x = 2.097097
## Warning: non-integer x = 2.102102
## Warning: non-integer x = 2.107107
## Warning: non-integer x = 2.112112
## Warning: non-integer x = 2.117117
## Warning: non-integer x = 2.122122
## Warning: non-integer x = 2.127127
## Warning: non-integer x = 2.132132
## Warning: non-integer x = 2.137137
## Warning: non-integer x = 2.142142
## Warning: non-integer x = 2.147147
## Warning: non-integer x = 2.152152
## Warning: non-integer x = 2.157157
## Warning: non-integer x = 2.162162
## Warning: non-integer x = 2.167167
## Warning: non-integer x = 2.172172
## Warning: non-integer x = 2.177177
## Warning: non-integer x = 2.182182
## Warning: non-integer x = 2.187187
## Warning: non-integer x = 2.192192
## Warning: non-integer x = 2.197197
## Warning: non-integer x = 2.202202
## Warning: non-integer x = 2.207207
## Warning: non-integer x = 2.212212
## Warning: non-integer x = 2.217217
## Warning: non-integer x = 2.222222
## Warning: non-integer x = 2.227227
## Warning: non-integer x = 2.232232
## Warning: non-integer x = 2.237237
## Warning: non-integer x = 2.242242
## Warning: non-integer x = 2.247247
## Warning: non-integer x = 2.252252
## Warning: non-integer x = 2.257257
## Warning: non-integer x = 2.262262
## Warning: non-integer x = 2.267267
## Warning: non-integer x = 2.272272
## Warning: non-integer x = 2.277277
## Warning: non-integer x = 2.282282
## Warning: non-integer x = 2.287287
## Warning: non-integer x = 2.292292
## Warning: non-integer x = 2.297297
## Warning: non-integer x = 2.302302
## Warning: non-integer x = 2.307307
## Warning: non-integer x = 2.312312
## Warning: non-integer x = 2.317317
## Warning: non-integer x = 2.322322
## Warning: non-integer x = 2.327327
## Warning: non-integer x = 2.332332
## Warning: non-integer x = 2.337337
## Warning: non-integer x = 2.342342
## Warning: non-integer x = 2.347347
## Warning: non-integer x = 2.352352
## Warning: non-integer x = 2.357357
## Warning: non-integer x = 2.362362
## Warning: non-integer x = 2.367367
## Warning: non-integer x = 2.372372
## Warning: non-integer x = 2.377377
## Warning: non-integer x = 2.382382
## Warning: non-integer x = 2.387387
## Warning: non-integer x = 2.392392
## Warning: non-integer x = 2.397397
## Warning: non-integer x = 2.402402
## Warning: non-integer x = 2.407407
## Warning: non-integer x = 2.412412
## Warning: non-integer x = 2.417417
## Warning: non-integer x = 2.422422
## Warning: non-integer x = 2.427427
## Warning: non-integer x = 2.432432
## Warning: non-integer x = 2.437437
## Warning: non-integer x = 2.442442
## Warning: non-integer x = 2.447447
## Warning: non-integer x = 2.452452
## Warning: non-integer x = 2.457457
## Warning: non-integer x = 2.462462
## Warning: non-integer x = 2.467467
## Warning: non-integer x = 2.472472
## Warning: non-integer x = 2.477477
## Warning: non-integer x = 2.482482
## Warning: non-integer x = 2.487487
## Warning: non-integer x = 2.492492
## Warning: non-integer x = 2.497497
## Warning: non-integer x = 2.502503
## Warning: non-integer x = 2.507508
## Warning: non-integer x = 2.512513
## Warning: non-integer x = 2.517518
## Warning: non-integer x = 2.522523
## Warning: non-integer x = 2.527528
## Warning: non-integer x = 2.532533
## Warning: non-integer x = 2.537538
## Warning: non-integer x = 2.542543
## Warning: non-integer x = 2.547548
## Warning: non-integer x = 2.552553
## Warning: non-integer x = 2.557558
## Warning: non-integer x = 2.562563
## Warning: non-integer x = 2.567568
## Warning: non-integer x = 2.572573
## Warning: non-integer x = 2.577578
## Warning: non-integer x = 2.582583
## Warning: non-integer x = 2.587588
## Warning: non-integer x = 2.592593
## Warning: non-integer x = 2.597598
## Warning: non-integer x = 2.602603
## Warning: non-integer x = 2.607608
## Warning: non-integer x = 2.612613
## Warning: non-integer x = 2.617618
## Warning: non-integer x = 2.622623
## Warning: non-integer x = 2.627628
## Warning: non-integer x = 2.632633
## Warning: non-integer x = 2.637638
## Warning: non-integer x = 2.642643
## Warning: non-integer x = 2.647648
## Warning: non-integer x = 2.652653
## Warning: non-integer x = 2.657658
## Warning: non-integer x = 2.662663
## Warning: non-integer x = 2.667668
## Warning: non-integer x = 2.672673
## Warning: non-integer x = 2.677678
## Warning: non-integer x = 2.682683
## Warning: non-integer x = 2.687688
## Warning: non-integer x = 2.692693
## Warning: non-integer x = 2.697698
## Warning: non-integer x = 2.702703
## Warning: non-integer x = 2.707708
## Warning: non-integer x = 2.712713
## Warning: non-integer x = 2.717718
## Warning: non-integer x = 2.722723
## Warning: non-integer x = 2.727728
## Warning: non-integer x = 2.732733
## Warning: non-integer x = 2.737738
## Warning: non-integer x = 2.742743
## Warning: non-integer x = 2.747748
## Warning: non-integer x = 2.752753
## Warning: non-integer x = 2.757758
## Warning: non-integer x = 2.762763
## Warning: non-integer x = 2.767768
## Warning: non-integer x = 2.772773
## Warning: non-integer x = 2.777778
## Warning: non-integer x = 2.782783
## Warning: non-integer x = 2.787788
## Warning: non-integer x = 2.792793
## Warning: non-integer x = 2.797798
## Warning: non-integer x = 2.802803
## Warning: non-integer x = 2.807808
## Warning: non-integer x = 2.812813
## Warning: non-integer x = 2.817818
## Warning: non-integer x = 2.822823
## Warning: non-integer x = 2.827828
## Warning: non-integer x = 2.832833
## Warning: non-integer x = 2.837838
## Warning: non-integer x = 2.842843
## Warning: non-integer x = 2.847848
## Warning: non-integer x = 2.852853
## Warning: non-integer x = 2.857858
## Warning: non-integer x = 2.862863
## Warning: non-integer x = 2.867868
## Warning: non-integer x = 2.872873
## Warning: non-integer x = 2.877878
## Warning: non-integer x = 2.882883
## Warning: non-integer x = 2.887888
## Warning: non-integer x = 2.892893
## Warning: non-integer x = 2.897898
## Warning: non-integer x = 2.902903
## Warning: non-integer x = 2.907908
## Warning: non-integer x = 2.912913
## Warning: non-integer x = 2.917918
## Warning: non-integer x = 2.922923
## Warning: non-integer x = 2.927928
## Warning: non-integer x = 2.932933
## Warning: non-integer x = 2.937938
## Warning: non-integer x = 2.942943
## Warning: non-integer x = 2.947948
## Warning: non-integer x = 2.952953
## Warning: non-integer x = 2.957958
## Warning: non-integer x = 2.962963
## Warning: non-integer x = 2.967968
## Warning: non-integer x = 2.972973
## Warning: non-integer x = 2.977978
## Warning: non-integer x = 2.982983
## Warning: non-integer x = 2.987988
## Warning: non-integer x = 2.992993
## Warning: non-integer x = 2.997998
## Warning: non-integer x = 3.003003
## Warning: non-integer x = 3.008008
## Warning: non-integer x = 3.013013
## Warning: non-integer x = 3.018018
## Warning: non-integer x = 3.023023
## Warning: non-integer x = 3.028028
## Warning: non-integer x = 3.033033
## Warning: non-integer x = 3.038038
## Warning: non-integer x = 3.043043
## Warning: non-integer x = 3.048048
## Warning: non-integer x = 3.053053
## Warning: non-integer x = 3.058058
## Warning: non-integer x = 3.063063
## Warning: non-integer x = 3.068068
## Warning: non-integer x = 3.073073
## Warning: non-integer x = 3.078078
## Warning: non-integer x = 3.083083
## Warning: non-integer x = 3.088088
## Warning: non-integer x = 3.093093
## Warning: non-integer x = 3.098098
## Warning: non-integer x = 3.103103
## Warning: non-integer x = 3.108108
## Warning: non-integer x = 3.113113
## Warning: non-integer x = 3.118118
## Warning: non-integer x = 3.123123
## Warning: non-integer x = 3.128128
## Warning: non-integer x = 3.133133
## Warning: non-integer x = 3.138138
## Warning: non-integer x = 3.143143
## Warning: non-integer x = 3.148148
## Warning: non-integer x = 3.153153
## Warning: non-integer x = 3.158158
## Warning: non-integer x = 3.163163
## Warning: non-integer x = 3.168168
## Warning: non-integer x = 3.173173
## Warning: non-integer x = 3.178178
## Warning: non-integer x = 3.183183
## Warning: non-integer x = 3.188188
## Warning: non-integer x = 3.193193
## Warning: non-integer x = 3.198198
## Warning: non-integer x = 3.203203
## Warning: non-integer x = 3.208208
## Warning: non-integer x = 3.213213
## Warning: non-integer x = 3.218218
## Warning: non-integer x = 3.223223
## Warning: non-integer x = 3.228228
## Warning: non-integer x = 3.233233
## Warning: non-integer x = 3.238238
## Warning: non-integer x = 3.243243
## Warning: non-integer x = 3.248248
## Warning: non-integer x = 3.253253
## Warning: non-integer x = 3.258258
## Warning: non-integer x = 3.263263
## Warning: non-integer x = 3.268268
## Warning: non-integer x = 3.273273
## Warning: non-integer x = 3.278278
## Warning: non-integer x = 3.283283
## Warning: non-integer x = 3.288288
## Warning: non-integer x = 3.293293
## Warning: non-integer x = 3.298298
## Warning: non-integer x = 3.303303
## Warning: non-integer x = 3.308308
## Warning: non-integer x = 3.313313
## Warning: non-integer x = 3.318318
## Warning: non-integer x = 3.323323
## Warning: non-integer x = 3.328328
## Warning: non-integer x = 3.333333
## Warning: non-integer x = 3.338338
## Warning: non-integer x = 3.343343
## Warning: non-integer x = 3.348348
## Warning: non-integer x = 3.353353
## Warning: non-integer x = 3.358358
## Warning: non-integer x = 3.363363
## Warning: non-integer x = 3.368368
## Warning: non-integer x = 3.373373
## Warning: non-integer x = 3.378378
## Warning: non-integer x = 3.383383
## Warning: non-integer x = 3.388388
## Warning: non-integer x = 3.393393
## Warning: non-integer x = 3.398398
## Warning: non-integer x = 3.403403
## Warning: non-integer x = 3.408408
## Warning: non-integer x = 3.413413
## Warning: non-integer x = 3.418418
## Warning: non-integer x = 3.423423
## Warning: non-integer x = 3.428428
## Warning: non-integer x = 3.433433
## Warning: non-integer x = 3.438438
## Warning: non-integer x = 3.443443
## Warning: non-integer x = 3.448448
## Warning: non-integer x = 3.453453
## Warning: non-integer x = 3.458458
## Warning: non-integer x = 3.463463
## Warning: non-integer x = 3.468468
## Warning: non-integer x = 3.473473
## Warning: non-integer x = 3.478478
## Warning: non-integer x = 3.483483
## Warning: non-integer x = 3.488488
## Warning: non-integer x = 3.493493
## Warning: non-integer x = 3.498498
## Warning: non-integer x = 3.503504
## Warning: non-integer x = 3.508509
## Warning: non-integer x = 3.513514
## Warning: non-integer x = 3.518519
## Warning: non-integer x = 3.523524
## Warning: non-integer x = 3.528529
## Warning: non-integer x = 3.533534
## Warning: non-integer x = 3.538539
## Warning: non-integer x = 3.543544
## Warning: non-integer x = 3.548549
## Warning: non-integer x = 3.553554
## Warning: non-integer x = 3.558559
## Warning: non-integer x = 3.563564
## Warning: non-integer x = 3.568569
## Warning: non-integer x = 3.573574
## Warning: non-integer x = 3.578579
## Warning: non-integer x = 3.583584
## Warning: non-integer x = 3.588589
## Warning: non-integer x = 3.593594
## Warning: non-integer x = 3.598599
## Warning: non-integer x = 3.603604
## Warning: non-integer x = 3.608609
## Warning: non-integer x = 3.613614
## Warning: non-integer x = 3.618619
## Warning: non-integer x = 3.623624
## Warning: non-integer x = 3.628629
## Warning: non-integer x = 3.633634
## Warning: non-integer x = 3.638639
## Warning: non-integer x = 3.643644
## Warning: non-integer x = 3.648649
## Warning: non-integer x = 3.653654
## Warning: non-integer x = 3.658659
## Warning: non-integer x = 3.663664
## Warning: non-integer x = 3.668669
## Warning: non-integer x = 3.673674
## Warning: non-integer x = 3.678679
## Warning: non-integer x = 3.683684
## Warning: non-integer x = 3.688689
## Warning: non-integer x = 3.693694
## Warning: non-integer x = 3.698699
## Warning: non-integer x = 3.703704
## Warning: non-integer x = 3.708709
## Warning: non-integer x = 3.713714
## Warning: non-integer x = 3.718719
## Warning: non-integer x = 3.723724
## Warning: non-integer x = 3.728729
## Warning: non-integer x = 3.733734
## Warning: non-integer x = 3.738739
## Warning: non-integer x = 3.743744
## Warning: non-integer x = 3.748749
## Warning: non-integer x = 3.753754
## Warning: non-integer x = 3.758759
## Warning: non-integer x = 3.763764
## Warning: non-integer x = 3.768769
## Warning: non-integer x = 3.773774
## Warning: non-integer x = 3.778779
## Warning: non-integer x = 3.783784
## Warning: non-integer x = 3.788789
## Warning: non-integer x = 3.793794
## Warning: non-integer x = 3.798799
## Warning: non-integer x = 3.803804
## Warning: non-integer x = 3.808809
## Warning: non-integer x = 3.813814
## Warning: non-integer x = 3.818819
## Warning: non-integer x = 3.823824
## Warning: non-integer x = 3.828829
## Warning: non-integer x = 3.833834
## Warning: non-integer x = 3.838839
## Warning: non-integer x = 3.843844
## Warning: non-integer x = 3.848849
## Warning: non-integer x = 3.853854
## Warning: non-integer x = 3.858859
## Warning: non-integer x = 3.863864
## Warning: non-integer x = 3.868869
## Warning: non-integer x = 3.873874
## Warning: non-integer x = 3.878879
## Warning: non-integer x = 3.883884
## Warning: non-integer x = 3.888889
## Warning: non-integer x = 3.893894
## Warning: non-integer x = 3.898899
## Warning: non-integer x = 3.903904
## Warning: non-integer x = 3.908909
## Warning: non-integer x = 3.913914
## Warning: non-integer x = 3.918919
## Warning: non-integer x = 3.923924
## Warning: non-integer x = 3.928929
## Warning: non-integer x = 3.933934
## Warning: non-integer x = 3.938939
## Warning: non-integer x = 3.943944
## Warning: non-integer x = 3.948949
## Warning: non-integer x = 3.953954
## Warning: non-integer x = 3.958959
## Warning: non-integer x = 3.963964
## Warning: non-integer x = 3.968969
## Warning: non-integer x = 3.973974
## Warning: non-integer x = 3.978979
## Warning: non-integer x = 3.983984
## Warning: non-integer x = 3.988989
## Warning: non-integer x = 3.993994
## Warning: non-integer x = 3.998999
## Warning: non-integer x = 4.004004
## Warning: non-integer x = 4.009009
## Warning: non-integer x = 4.014014
## Warning: non-integer x = 4.019019
## Warning: non-integer x = 4.024024
## Warning: non-integer x = 4.029029
## Warning: non-integer x = 4.034034
## Warning: non-integer x = 4.039039
## Warning: non-integer x = 4.044044
## Warning: non-integer x = 4.049049
## Warning: non-integer x = 4.054054
## Warning: non-integer x = 4.059059
## Warning: non-integer x = 4.064064
## Warning: non-integer x = 4.069069
## Warning: non-integer x = 4.074074
## Warning: non-integer x = 4.079079
## Warning: non-integer x = 4.084084
## Warning: non-integer x = 4.089089
## Warning: non-integer x = 4.094094
## Warning: non-integer x = 4.099099
## Warning: non-integer x = 4.104104
## Warning: non-integer x = 4.109109
## Warning: non-integer x = 4.114114
## Warning: non-integer x = 4.119119
## Warning: non-integer x = 4.124124
## Warning: non-integer x = 4.129129
## Warning: non-integer x = 4.134134
## Warning: non-integer x = 4.139139
## Warning: non-integer x = 4.144144
## Warning: non-integer x = 4.149149
## Warning: non-integer x = 4.154154
## Warning: non-integer x = 4.159159
## Warning: non-integer x = 4.164164
## Warning: non-integer x = 4.169169
## Warning: non-integer x = 4.174174
## Warning: non-integer x = 4.179179
## Warning: non-integer x = 4.184184
## Warning: non-integer x = 4.189189
## Warning: non-integer x = 4.194194
## Warning: non-integer x = 4.199199
## Warning: non-integer x = 4.204204
## Warning: non-integer x = 4.209209
## Warning: non-integer x = 4.214214
## Warning: non-integer x = 4.219219
## Warning: non-integer x = 4.224224
## Warning: non-integer x = 4.229229
## Warning: non-integer x = 4.234234
## Warning: non-integer x = 4.239239
## Warning: non-integer x = 4.244244
## Warning: non-integer x = 4.249249
## Warning: non-integer x = 4.254254
## Warning: non-integer x = 4.259259
## Warning: non-integer x = 4.264264
## Warning: non-integer x = 4.269269
## Warning: non-integer x = 4.274274
## Warning: non-integer x = 4.279279
## Warning: non-integer x = 4.284284
## Warning: non-integer x = 4.289289
## Warning: non-integer x = 4.294294
## Warning: non-integer x = 4.299299
## Warning: non-integer x = 4.304304
## Warning: non-integer x = 4.309309
## Warning: non-integer x = 4.314314
## Warning: non-integer x = 4.319319
## Warning: non-integer x = 4.324324
## Warning: non-integer x = 4.329329
## Warning: non-integer x = 4.334334
## Warning: non-integer x = 4.339339
## Warning: non-integer x = 4.344344
## Warning: non-integer x = 4.349349
## Warning: non-integer x = 4.354354
## Warning: non-integer x = 4.359359
## Warning: non-integer x = 4.364364
## Warning: non-integer x = 4.369369
## Warning: non-integer x = 4.374374
## Warning: non-integer x = 4.379379
## Warning: non-integer x = 4.384384
## Warning: non-integer x = 4.389389
## Warning: non-integer x = 4.394394
## Warning: non-integer x = 4.399399
## Warning: non-integer x = 4.404404
## Warning: non-integer x = 4.409409
## Warning: non-integer x = 4.414414
## Warning: non-integer x = 4.419419
## Warning: non-integer x = 4.424424
## Warning: non-integer x = 4.429429
## Warning: non-integer x = 4.434434
## Warning: non-integer x = 4.439439
## Warning: non-integer x = 4.444444
## Warning: non-integer x = 4.449449
## Warning: non-integer x = 4.454454
## Warning: non-integer x = 4.459459
## Warning: non-integer x = 4.464464
## Warning: non-integer x = 4.469469
## Warning: non-integer x = 4.474474
## Warning: non-integer x = 4.479479
## Warning: non-integer x = 4.484484
## Warning: non-integer x = 4.489489
## Warning: non-integer x = 4.494494
## Warning: non-integer x = 4.499499
## Warning: non-integer x = 4.504505
## Warning: non-integer x = 4.509510
## Warning: non-integer x = 4.514515
## Warning: non-integer x = 4.519520
## Warning: non-integer x = 4.524525
## Warning: non-integer x = 4.529530
## Warning: non-integer x = 4.534535
## Warning: non-integer x = 4.539540
## Warning: non-integer x = 4.544545
## Warning: non-integer x = 4.549550
## Warning: non-integer x = 4.554555
## Warning: non-integer x = 4.559560
## Warning: non-integer x = 4.564565
## Warning: non-integer x = 4.569570
## Warning: non-integer x = 4.574575
## Warning: non-integer x = 4.579580
## Warning: non-integer x = 4.584585
## Warning: non-integer x = 4.589590
## Warning: non-integer x = 4.594595
## Warning: non-integer x = 4.599600
## Warning: non-integer x = 4.604605
## Warning: non-integer x = 4.609610
## Warning: non-integer x = 4.614615
## Warning: non-integer x = 4.619620
## Warning: non-integer x = 4.624625
## Warning: non-integer x = 4.629630
## Warning: non-integer x = 4.634635
## Warning: non-integer x = 4.639640
## Warning: non-integer x = 4.644645
## Warning: non-integer x = 4.649650
## Warning: non-integer x = 4.654655
## Warning: non-integer x = 4.659660
## Warning: non-integer x = 4.664665
## Warning: non-integer x = 4.669670
## Warning: non-integer x = 4.674675
## Warning: non-integer x = 4.679680
## Warning: non-integer x = 4.684685
## Warning: non-integer x = 4.689690
## Warning: non-integer x = 4.694695
## Warning: non-integer x = 4.699700
## Warning: non-integer x = 4.704705
## Warning: non-integer x = 4.709710
## Warning: non-integer x = 4.714715
## Warning: non-integer x = 4.719720
## Warning: non-integer x = 4.724725
## Warning: non-integer x = 4.729730
## Warning: non-integer x = 4.734735
## Warning: non-integer x = 4.739740
## Warning: non-integer x = 4.744745
## Warning: non-integer x = 4.749750
## Warning: non-integer x = 4.754755
## Warning: non-integer x = 4.759760
## Warning: non-integer x = 4.764765
## Warning: non-integer x = 4.769770
## Warning: non-integer x = 4.774775
## Warning: non-integer x = 4.779780
## Warning: non-integer x = 4.784785
## Warning: non-integer x = 4.789790
## Warning: non-integer x = 4.794795
## Warning: non-integer x = 4.799800
## Warning: non-integer x = 4.804805
## Warning: non-integer x = 4.809810
## Warning: non-integer x = 4.814815
## Warning: non-integer x = 4.819820
## Warning: non-integer x = 4.824825
## Warning: non-integer x = 4.829830
## Warning: non-integer x = 4.834835
## Warning: non-integer x = 4.839840
## Warning: non-integer x = 4.844845
## Warning: non-integer x = 4.849850
## Warning: non-integer x = 4.854855
## Warning: non-integer x = 4.859860
## Warning: non-integer x = 4.864865
## Warning: non-integer x = 4.869870
## Warning: non-integer x = 4.874875
## Warning: non-integer x = 4.879880
## Warning: non-integer x = 4.884885
## Warning: non-integer x = 4.889890
## Warning: non-integer x = 4.894895
## Warning: non-integer x = 4.899900
## Warning: non-integer x = 4.904905
## Warning: non-integer x = 4.909910
## Warning: non-integer x = 4.914915
## Warning: non-integer x = 4.919920
## Warning: non-integer x = 4.924925
## Warning: non-integer x = 4.929930
## Warning: non-integer x = 4.934935
## Warning: non-integer x = 4.939940
## Warning: non-integer x = 4.944945
## Warning: non-integer x = 4.949950
## Warning: non-integer x = 4.954955
## Warning: non-integer x = 4.959960
## Warning: non-integer x = 4.964965
## Warning: non-integer x = 4.969970
## Warning: non-integer x = 4.974975
## Warning: non-integer x = 4.979980
## Warning: non-integer x = 4.984985
## Warning: non-integer x = 4.989990
## Warning: non-integer x = 4.994995


## Paul Johnson 2013-02-20
## 2013-03-14: fixed typo in T distribution

## You can play around with that. I have explored some ways to make it more
## abstract. Nothing below is too awesome, but I work on it from time to time.

## I'd like to re-work that, to make more easily customizable output.

## I'd like to simplify user input. Choosing functions, adding new ones.
##
## I'd like it to guess "to" and "from" for plotting.
##
## Make the distribution chooser ignore capitalization. Users should not get
## rejected if they enter "Chisq" rather than "chisq". And I'd like it to
## work if they enter "chi"
##
## Couldn't users supply legal R name of the q function and we could
## parse the rest of the information from that?  They say distribution
## = qnorm, so we don't need all those switches and other excitements.
## Along the way, I'm using it as an example to debate the use of the
## "..." argument with myself. Oh, and can't I make this less tedious
## to code in additional distributions?  I think most programmers
## would not handle the function call that way. The'd use
##
## do.call(myPDF, list( more-arguments-here ))
##
## I'm a little surprised that the method in PlotDist() works,
## actually.  But it is a reminder that a function is just an object,
## it can be passed about.
##
## Lets improve the labeling of the output. I'd like the distribution
## types and parameters to be featured in the output.  I also want
## users to be able to pass through more arguments.

## I'm looking at 2 ways to do that. Method 1: The "Brute Force"
## method.  Create a named argument "parms" and scan that. That's my
## first idea, but I don't think it is as good as the dot-dot-dot
## method that Joshua used. So I'll come back to that later. Method 2:
## ballet of the dot-dot-dot argument.

## 1. Revise, calculate "from" and "to" internally if not specified.
## 2. Add Title and xlab
## 3. Create parms argument, a list of values for the distribution
plotDist <-
function (alpha, to, from,  n = 1000, filename = NULL,
alternative = c("two.tailed", "greater", "lesser"),
distribution =  c("normal","t", "F", "chisq", "binomial"),
parms = list(),
colour = "black", fill = "skyblue2",
...)
{
alternative <- match.arg(alternative)

alt.alpha <- switch(alternative, two.tailed = alpha/2, greater = alpha,
lesser = alpha)

myPDF <- switch(distribution, normal = "dnorm", t = "dt", F = "df",
chisq = "dchisq", binomial = "dbinom")

myQ <- switch(distribution, normal = "qnorm", t = "qt", F = "qf",
chisq = "qchisq", binomial = "qbinom")
## meld together the default parameters I choose with the
## list of parms from command line.
myParms <- switch(distribution,
normal = modifyList(list(m = 0, sd = 1), parms),
t = modifyList(list(df = 100), parms),
F = modifyList(list(df1 = 100, df2 = 100), parms),
chisq = modifyList(list(df = 100), parms),
binomial = modifyList(list(size = 1, prob = 0.5), parms))

myName <- switch(distribution,
normal = "Normal",
t = "T",
F = "F",
chisq = "chi",
binomial = "Binomial")

myTitle <- switch(distribution,
normal = substitute(myName(mu == parm1, sigma^2 == parm2^2), list(myName = myName, parm1 = myParms$m, parm2 = myParms$sd)),
t = substitute(myName(nu == parm1), list(myName = as.name(myName), parm1 = myParms$df)), F = substitute(myName(nu[1] == parm1, nu[2] == parm2), list(myName = as.name(myName), parm1 = myParms$df1, parm2 = myParms$df2)), chisq = substitute(myName^2 * (nu == parm1), list(myName = as.name(myName), parm1 = myParms$df)),
binomial = substitute(myName(parm1, parm2), list(myName = myName, parm1 = myParms$size, parm2 = myParms$prob)))

crit.lower <- do.call(myQ, modifyList( list(p = alt.alpha, lower.tail = TRUE, ...), myParms ))
crit.upper <- do.call(myQ, modifyList( list(p = alt.alpha, lower.tail = FALSE, ...), myParms ))
## if (missing(from)) from <- crit.lower - 0.10 *(crit.upper - crit.lower)
## if (missing(to)) to <- crit.upper + 0.10 * (crit.upper - crit.lower)

if (missing(from)) from <- do.call(myQ, modifyList(list(p = 0.001), myParms))
if (missing(to)) to <- do.call(myQ, modifyList(list(p = 0.999), myParms))
cord.x1 <- c(from, seq(from = from, to = crit.lower, length.out = 100), crit.lower)
##cord.y1 <- c(0, do.call(myPDF,
##                        modifyList(list(x = seq(from = from, to = crit.lower,
##                                       length.out = 100), ...), myParms)), 0)
cord.y1 <- c(0, do.call(myPDF, c(list(x = seq(from = from, to = crit.lower,
length.out = 100)), myParms)), 0)

cord.x2 <- c(crit.upper, seq(from = crit.upper, to = to,
length.out = 100), to)

cord.y2 <- c(0, do.call(myPDF, modifyList(list(x = seq(from = crit.upper, to = to,
length.out = 100), ...), myParms)), 0)

if (!is.null(filename)) pdf(file = filename)

xseq <- seq(from, to, length.out = n)

probseq <- do.call(myPDF,  modifyList(list(x = xseq, ...), myParms))

plot(probseq ~ xseq, col = colour, type = "n" ,
ylab = "Density", xlab = "Values",
main = myTitle)
lines(probseq ~ xseq,  lty = 1, lwd = 1)
lines(x = c(to, from), y = c(0, 0), lty = 3, col = gray(0.80))
if (!identical(alternative, "greater")) {
polygon(x = cord.x1, y = cord.y1, col = fill)
}
if (!identical(alternative, "lesser")) {
polygon(x = cord.x2, y = cord.y2, col = fill)
}
if (!is.null(filename)) dev.off()
}

plotDist(alpha=0.05, alternative=c("two.tailed"), distribution="normal")


plotDist(alpha=0.05, alternative=c("greater"), distribution="normal")


plotDist(alpha=0.05, alternative=c("greater"), distribution="normal", parms = list(m=-44, sd=19))


plotDist(alpha=0.05, alternative=c("two.tailed"), distribution="t")


plotDist(alpha=0.05, alternative=c("greater"), distribution="chisq")
plotDist(alpha=0.05, alternative=c("greater"), distribution="chisq", parms=list(df = 100))


plotDist(alpha=0.05, alternative=c("two.tailed"), distribution="normal", colour="red", fill="green")


plotDist(alpha=0.05, alternative=c("greater"), distribution="F", parms = list(df1=10, df2=20))


plotDist(alpha=0.05, alternative=c("greater"), distribution="F", parms = list(df1 = 2, df2 = 100))


## left edge looks wrong. But probably right.
plotDist(alpha=0.05, alternative=c("greater"), distribution="F", from=0, to=10, parms = list(df1=10, df2=20))


##double check the old fashioned way re-consider. looks OK
x <- seq(0, 5, by=0.0005)
denx <-df(x, df1=10, df2=20)
plot(x, denx, type = "l", main = "Plotting the F distribution the Old Fashioned Way")


##Chi-square interesting
plotDist(alpha=0.05, alternative=c("greater"), distribution="chisq", parms = list(df = 1), from = 0, to= 10)


plotDist(alpha=0.05, alternative=c("greater"), distribution="chisq", parms = list(df = 10), from = 0, to = 30)


plotDist(alpha=0.05, alternative=c("greater"), distribution="chisq", parms = list(df = 20), from = 0, to = 50)


#doesn't work
plotDist(alpha=0.05, alternative=c("greater"), distribution="binomial", parms = list(size=20, prob=0.2), from = 0, to = 40)

## Warning: non-integer x = 0.010101
## Warning: non-integer x = 0.020202
## Warning: non-integer x = 0.030303
## Warning: non-integer x = 0.040404
## Warning: non-integer x = 0.050505
## Warning: non-integer x = 0.060606
## Warning: non-integer x = 0.070707
## Warning: non-integer x = 0.080808
## Warning: non-integer x = 0.090909
## Warning: non-integer x = 0.101010
## Warning: non-integer x = 0.111111
## Warning: non-integer x = 0.121212
## Warning: non-integer x = 0.131313
## Warning: non-integer x = 0.141414
## Warning: non-integer x = 0.151515
## Warning: non-integer x = 0.161616
## Warning: non-integer x = 0.171717
## Warning: non-integer x = 0.181818
## Warning: non-integer x = 0.191919
## Warning: non-integer x = 0.202020
## Warning: non-integer x = 0.212121
## Warning: non-integer x = 0.222222
## Warning: non-integer x = 0.232323
## Warning: non-integer x = 0.242424
## Warning: non-integer x = 0.252525
## Warning: non-integer x = 0.262626
## Warning: non-integer x = 0.272727
## Warning: non-integer x = 0.282828
## Warning: non-integer x = 0.292929
## Warning: non-integer x = 0.303030
## Warning: non-integer x = 0.313131
## Warning: non-integer x = 0.323232
## Warning: non-integer x = 0.333333
## Warning: non-integer x = 0.343434
## Warning: non-integer x = 0.353535
## Warning: non-integer x = 0.363636
## Warning: non-integer x = 0.373737
## Warning: non-integer x = 0.383838
## Warning: non-integer x = 0.393939
## Warning: non-integer x = 0.404040
## Warning: non-integer x = 0.414141
## Warning: non-integer x = 0.424242
## Warning: non-integer x = 0.434343
## Warning: non-integer x = 0.444444
## Warning: non-integer x = 0.454545
## Warning: non-integer x = 0.464646
## Warning: non-integer x = 0.474747
## Warning: non-integer x = 0.484848
## Warning: non-integer x = 0.494949
## Warning: non-integer x = 0.505051
## Warning: non-integer x = 0.515152
## Warning: non-integer x = 0.525253
## Warning: non-integer x = 0.535354
## Warning: non-integer x = 0.545455
## Warning: non-integer x = 0.555556
## Warning: non-integer x = 0.565657
## Warning: non-integer x = 0.575758
## Warning: non-integer x = 0.585859
## Warning: non-integer x = 0.595960
## Warning: non-integer x = 0.606061
## Warning: non-integer x = 0.616162
## Warning: non-integer x = 0.626263
## Warning: non-integer x = 0.636364
## Warning: non-integer x = 0.646465
## Warning: non-integer x = 0.656566
## Warning: non-integer x = 0.666667
## Warning: non-integer x = 0.676768
## Warning: non-integer x = 0.686869
## Warning: non-integer x = 0.696970
## Warning: non-integer x = 0.707071
## Warning: non-integer x = 0.717172
## Warning: non-integer x = 0.727273
## Warning: non-integer x = 0.737374
## Warning: non-integer x = 0.747475
## Warning: non-integer x = 0.757576
## Warning: non-integer x = 0.767677
## Warning: non-integer x = 0.777778
## Warning: non-integer x = 0.787879
## Warning: non-integer x = 0.797980
## Warning: non-integer x = 0.808081
## Warning: non-integer x = 0.818182
## Warning: non-integer x = 0.828283
## Warning: non-integer x = 0.838384
## Warning: non-integer x = 0.848485
## Warning: non-integer x = 0.858586
## Warning: non-integer x = 0.868687
## Warning: non-integer x = 0.878788
## Warning: non-integer x = 0.888889
## Warning: non-integer x = 0.898990
## Warning: non-integer x = 0.909091
## Warning: non-integer x = 0.919192
## Warning: non-integer x = 0.929293
## Warning: non-integer x = 0.939394
## Warning: non-integer x = 0.949495
## Warning: non-integer x = 0.959596
## Warning: non-integer x = 0.969697
## Warning: non-integer x = 0.979798
## Warning: non-integer x = 0.989899
## Warning: non-integer x = 7.333333
## Warning: non-integer x = 7.666667
## Warning: non-integer x = 8.333333
## Warning: non-integer x = 8.666667
## Warning: non-integer x = 9.333333
## Warning: non-integer x = 9.666667
## Warning: non-integer x = 10.333333
## Warning: non-integer x = 10.666667
## Warning: non-integer x = 11.333333
## Warning: non-integer x = 11.666667
## Warning: non-integer x = 12.333333
## Warning: non-integer x = 12.666667
## Warning: non-integer x = 13.333333
## Warning: non-integer x = 13.666667
## Warning: non-integer x = 14.333333
## Warning: non-integer x = 14.666667
## Warning: non-integer x = 15.333333
## Warning: non-integer x = 15.666667
## Warning: non-integer x = 16.333333
## Warning: non-integer x = 16.666667
## Warning: non-integer x = 17.333333
## Warning: non-integer x = 17.666667
## Warning: non-integer x = 18.333333
## Warning: non-integer x = 18.666667
## Warning: non-integer x = 19.333333
## Warning: non-integer x = 19.666667
## Warning: non-integer x = 20.333333
## Warning: non-integer x = 20.666667
## Warning: non-integer x = 21.333333
## Warning: non-integer x = 21.666667
## Warning: non-integer x = 22.333333
## Warning: non-integer x = 22.666667
## Warning: non-integer x = 23.333333
## Warning: non-integer x = 23.666667
## Warning: non-integer x = 24.333333
## Warning: non-integer x = 24.666667
## Warning: non-integer x = 25.333333
## Warning: non-integer x = 25.666667
## Warning: non-integer x = 26.333333
## Warning: non-integer x = 26.666667
## Warning: non-integer x = 27.333333
## Warning: non-integer x = 27.666667
## Warning: non-integer x = 28.333333
## Warning: non-integer x = 28.666667
## Warning: non-integer x = 29.333333
## Warning: non-integer x = 29.666667
## Warning: non-integer x = 30.333333
## Warning: non-integer x = 30.666667
## Warning: non-integer x = 31.333333
## Warning: non-integer x = 31.666667
## Warning: non-integer x = 32.333333
## Warning: non-integer x = 32.666667
## Warning: non-integer x = 33.333333
## Warning: non-integer x = 33.666667
## Warning: non-integer x = 34.333333
## Warning: non-integer x = 34.666667
## Warning: non-integer x = 35.333333
## Warning: non-integer x = 35.666667
## Warning: non-integer x = 36.333333
## Warning: non-integer x = 36.666667
## Warning: non-integer x = 37.333333
## Warning: non-integer x = 37.666667
## Warning: non-integer x = 38.333333
## Warning: non-integer x = 38.666667
## Warning: non-integer x = 39.333333
## Warning: non-integer x = 39.666667
## Warning: non-integer x = 0.040040
## Warning: non-integer x = 0.080080
## Warning: non-integer x = 0.120120
## Warning: non-integer x = 0.160160
## Warning: non-integer x = 0.200200
## Warning: non-integer x = 0.240240
## Warning: non-integer x = 0.280280
## Warning: non-integer x = 0.320320
## Warning: non-integer x = 0.360360
## Warning: non-integer x = 0.400400
## Warning: non-integer x = 0.440440
## Warning: non-integer x = 0.480480
## Warning: non-integer x = 0.520521
## Warning: non-integer x = 0.560561
## Warning: non-integer x = 0.600601
## Warning: non-integer x = 0.640641
## Warning: non-integer x = 0.680681
## Warning: non-integer x = 0.720721
## Warning: non-integer x = 0.760761
## Warning: non-integer x = 0.800801
## Warning: non-integer x = 0.840841
## Warning: non-integer x = 0.880881
## Warning: non-integer x = 0.920921
## Warning: non-integer x = 0.960961
## Warning: non-integer x = 1.001001
## Warning: non-integer x = 1.041041
## Warning: non-integer x = 1.081081
## Warning: non-integer x = 1.121121
## Warning: non-integer x = 1.161161
## Warning: non-integer x = 1.201201
## Warning: non-integer x = 1.241241
## Warning: non-integer x = 1.281281
## Warning: non-integer x = 1.321321
## Warning: non-integer x = 1.361361
## Warning: non-integer x = 1.401401
## Warning: non-integer x = 1.441441
## Warning: non-integer x = 1.481481
## Warning: non-integer x = 1.521522
## Warning: non-integer x = 1.561562
## Warning: non-integer x = 1.601602
## Warning: non-integer x = 1.641642
## Warning: non-integer x = 1.681682
## Warning: non-integer x = 1.721722
## Warning: non-integer x = 1.761762
## Warning: non-integer x = 1.801802
## Warning: non-integer x = 1.841842
## Warning: non-integer x = 1.881882
## Warning: non-integer x = 1.921922
## Warning: non-integer x = 1.961962
## Warning: non-integer x = 2.002002
## Warning: non-integer x = 2.042042
## Warning: non-integer x = 2.082082
## Warning: non-integer x = 2.122122
## Warning: non-integer x = 2.162162
## Warning: non-integer x = 2.202202
## Warning: non-integer x = 2.242242
## Warning: non-integer x = 2.282282
## Warning: non-integer x = 2.322322
## Warning: non-integer x = 2.362362
## Warning: non-integer x = 2.402402
## Warning: non-integer x = 2.442442
## Warning: non-integer x = 2.482482
## Warning: non-integer x = 2.522523
## Warning: non-integer x = 2.562563
## Warning: non-integer x = 2.602603
## Warning: non-integer x = 2.642643
## Warning: non-integer x = 2.682683
## Warning: non-integer x = 2.722723
## Warning: non-integer x = 2.762763
## Warning: non-integer x = 2.802803
## Warning: non-integer x = 2.842843
## Warning: non-integer x = 2.882883
## Warning: non-integer x = 2.922923
## Warning: non-integer x = 2.962963
## Warning: non-integer x = 3.003003
## Warning: non-integer x = 3.043043
## Warning: non-integer x = 3.083083
## Warning: non-integer x = 3.123123
## Warning: non-integer x = 3.163163
## Warning: non-integer x = 3.203203
## Warning: non-integer x = 3.243243
## Warning: non-integer x = 3.283283
## Warning: non-integer x = 3.323323
## Warning: non-integer x = 3.363363
## Warning: non-integer x = 3.403403
## Warning: non-integer x = 3.443443
## Warning: non-integer x = 3.483483
## Warning: non-integer x = 3.523524
## Warning: non-integer x = 3.563564
## Warning: non-integer x = 3.603604
## Warning: non-integer x = 3.643644
## Warning: non-integer x = 3.683684
## Warning: non-integer x = 3.723724
## Warning: non-integer x = 3.763764
## Warning: non-integer x = 3.803804
## Warning: non-integer x = 3.843844
## Warning: non-integer x = 3.883884
## Warning: non-integer x = 3.923924
## Warning: non-integer x = 3.963964
## Warning: non-integer x = 4.004004
## Warning: non-integer x = 4.044044
## Warning: non-integer x = 4.084084
## Warning: non-integer x = 4.124124
## Warning: non-integer x = 4.164164
## Warning: non-integer x = 4.204204
## Warning: non-integer x = 4.244244
## Warning: non-integer x = 4.284284
## Warning: non-integer x = 4.324324
## Warning: non-integer x = 4.364364
## Warning: non-integer x = 4.404404
## Warning: non-integer x = 4.444444
## Warning: non-integer x = 4.484484
## Warning: non-integer x = 4.524525
## Warning: non-integer x = 4.564565
## Warning: non-integer x = 4.604605
## Warning: non-integer x = 4.644645
## Warning: non-integer x = 4.684685
## Warning: non-integer x = 4.724725
## Warning: non-integer x = 4.764765
## Warning: non-integer x = 4.804805
## Warning: non-integer x = 4.844845
## Warning: non-integer x = 4.884885
## Warning: non-integer x = 4.924925
## Warning: non-integer x = 4.964965
## Warning: non-integer x = 5.005005
## Warning: non-integer x = 5.045045
## Warning: non-integer x = 5.085085
## Warning: non-integer x = 5.125125
## Warning: non-integer x = 5.165165
## Warning: non-integer x = 5.205205
## Warning: non-integer x = 5.245245
## Warning: non-integer x = 5.285285
## Warning: non-integer x = 5.325325
## Warning: non-integer x = 5.365365
## Warning: non-integer x = 5.405405
## Warning: non-integer x = 5.445445
## Warning: non-integer x = 5.485485
## Warning: non-integer x = 5.525526
## Warning: non-integer x = 5.565566
## Warning: non-integer x = 5.605606
## Warning: non-integer x = 5.645646
## Warning: non-integer x = 5.685686
## Warning: non-integer x = 5.725726
## Warning: non-integer x = 5.765766
## Warning: non-integer x = 5.805806
## Warning: non-integer x = 5.845846
## Warning: non-integer x = 5.885886
## Warning: non-integer x = 5.925926
## Warning: non-integer x = 5.965966
## Warning: non-integer x = 6.006006
## Warning: non-integer x = 6.046046
## Warning: non-integer x = 6.086086
## Warning: non-integer x = 6.126126
## Warning: non-integer x = 6.166166
## Warning: non-integer x = 6.206206
## Warning: non-integer x = 6.246246
## Warning: non-integer x = 6.286286
## Warning: non-integer x = 6.326326
## Warning: non-integer x = 6.366366
## Warning: non-integer x = 6.406406
## Warning: non-integer x = 6.446446
## Warning: non-integer x = 6.486486
## Warning: non-integer x = 6.526527
## Warning: non-integer x = 6.566567
## Warning: non-integer x = 6.606607
## Warning: non-integer x = 6.646647
## Warning: non-integer x = 6.686687
## Warning: non-integer x = 6.726727
## Warning: non-integer x = 6.766767
## Warning: non-integer x = 6.806807
## Warning: non-integer x = 6.846847
## Warning: non-integer x = 6.886887
## Warning: non-integer x = 6.926927
## Warning: non-integer x = 6.966967
## Warning: non-integer x = 7.007007
## Warning: non-integer x = 7.047047
## Warning: non-integer x = 7.087087
## Warning: non-integer x = 7.127127
## Warning: non-integer x = 7.167167
## Warning: non-integer x = 7.207207
## Warning: non-integer x = 7.247247
## Warning: non-integer x = 7.287287
## Warning: non-integer x = 7.327327
## Warning: non-integer x = 7.367367
## Warning: non-integer x = 7.407407
## Warning: non-integer x = 7.447447
## Warning: non-integer x = 7.487487
## Warning: non-integer x = 7.527528
## Warning: non-integer x = 7.567568
## Warning: non-integer x = 7.607608
## Warning: non-integer x = 7.647648
## Warning: non-integer x = 7.687688
## Warning: non-integer x = 7.727728
## Warning: non-integer x = 7.767768
## Warning: non-integer x = 7.807808
## Warning: non-integer x = 7.847848
## Warning: non-integer x = 7.887888
## Warning: non-integer x = 7.927928
## Warning: non-integer x = 7.967968
## Warning: non-integer x = 8.008008
## Warning: non-integer x = 8.048048
## Warning: non-integer x = 8.088088
## Warning: non-integer x = 8.128128
## Warning: non-integer x = 8.168168
## Warning: non-integer x = 8.208208
## Warning: non-integer x = 8.248248
## Warning: non-integer x = 8.288288
## Warning: non-integer x = 8.328328
## Warning: non-integer x = 8.368368
## Warning: non-integer x = 8.408408
## Warning: non-integer x = 8.448448
## Warning: non-integer x = 8.488488
## Warning: non-integer x = 8.528529
## Warning: non-integer x = 8.568569
## Warning: non-integer x = 8.608609
## Warning: non-integer x = 8.648649
## Warning: non-integer x = 8.688689
## Warning: non-integer x = 8.728729
## Warning: non-integer x = 8.768769
## Warning: non-integer x = 8.808809
## Warning: non-integer x = 8.848849
## Warning: non-integer x = 8.888889
## Warning: non-integer x = 8.928929
## Warning: non-integer x = 8.968969
## Warning: non-integer x = 9.009009
## Warning: non-integer x = 9.049049
## Warning: non-integer x = 9.089089
## Warning: non-integer x = 9.129129
## Warning: non-integer x = 9.169169
## Warning: non-integer x = 9.209209
## Warning: non-integer x = 9.249249
## Warning: non-integer x = 9.289289
## Warning: non-integer x = 9.329329
## Warning: non-integer x = 9.369369
## Warning: non-integer x = 9.409409
## Warning: non-integer x = 9.449449
## Warning: non-integer x = 9.489489
## Warning: non-integer x = 9.529530
## Warning: non-integer x = 9.569570
## Warning: non-integer x = 9.609610
## Warning: non-integer x = 9.649650
## Warning: non-integer x = 9.689690
## Warning: non-integer x = 9.729730
## Warning: non-integer x = 9.769770
## Warning: non-integer x = 9.809810
## Warning: non-integer x = 9.849850
## Warning: non-integer x = 9.889890
## Warning: non-integer x = 9.929930
## Warning: non-integer x = 9.969970
## Warning: non-integer x = 10.010010
## Warning: non-integer x = 10.050050
## Warning: non-integer x = 10.090090
## Warning: non-integer x = 10.130130
## Warning: non-integer x = 10.170170
## Warning: non-integer x = 10.210210
## Warning: non-integer x = 10.250250
## Warning: non-integer x = 10.290290
## Warning: non-integer x = 10.330330
## Warning: non-integer x = 10.370370
## Warning: non-integer x = 10.410410
## Warning: non-integer x = 10.450450
## Warning: non-integer x = 10.490490
## Warning: non-integer x = 10.530531
## Warning: non-integer x = 10.570571
## Warning: non-integer x = 10.610611
## Warning: non-integer x = 10.650651
## Warning: non-integer x = 10.690691
## Warning: non-integer x = 10.730731
## Warning: non-integer x = 10.770771
## Warning: non-integer x = 10.810811
## Warning: non-integer x = 10.850851
## Warning: non-integer x = 10.890891
## Warning: non-integer x = 10.930931
## Warning: non-integer x = 10.970971
## Warning: non-integer x = 11.011011
## Warning: non-integer x = 11.051051
## Warning: non-integer x = 11.091091
## Warning: non-integer x = 11.131131
## Warning: non-integer x = 11.171171
## Warning: non-integer x = 11.211211
## Warning: non-integer x = 11.251251
## Warning: non-integer x = 11.291291
## Warning: non-integer x = 11.331331
## Warning: non-integer x = 11.371371
## Warning: non-integer x = 11.411411
## Warning: non-integer x = 11.451451
## Warning: non-integer x = 11.491491
## Warning: non-integer x = 11.531532
## Warning: non-integer x = 11.571572
## Warning: non-integer x = 11.611612
## Warning: non-integer x = 11.651652
## Warning: non-integer x = 11.691692
## Warning: non-integer x = 11.731732
## Warning: non-integer x = 11.771772
## Warning: non-integer x = 11.811812
## Warning: non-integer x = 11.851852
## Warning: non-integer x = 11.891892
## Warning: non-integer x = 11.931932
## Warning: non-integer x = 11.971972
## Warning: non-integer x = 12.012012
## Warning: non-integer x = 12.052052
## Warning: non-integer x = 12.092092
## Warning: non-integer x = 12.132132
## Warning: non-integer x = 12.172172
## Warning: non-integer x = 12.212212
## Warning: non-integer x = 12.252252
## Warning: non-integer x = 12.292292
## Warning: non-integer x = 12.332332
## Warning: non-integer x = 12.372372
## Warning: non-integer x = 12.412412
## Warning: non-integer x = 12.452452
## Warning: non-integer x = 12.492492
## Warning: non-integer x = 12.532533
## Warning: non-integer x = 12.572573
## Warning: non-integer x = 12.612613
## Warning: non-integer x = 12.652653
## Warning: non-integer x = 12.692693
## Warning: non-integer x = 12.732733
## Warning: non-integer x = 12.772773
## Warning: non-integer x = 12.812813
## Warning: non-integer x = 12.852853
## Warning: non-integer x = 12.892893
## Warning: non-integer x = 12.932933
## Warning: non-integer x = 12.972973
## Warning: non-integer x = 13.013013
## Warning: non-integer x = 13.053053
## Warning: non-integer x = 13.093093
## Warning: non-integer x = 13.133133
## Warning: non-integer x = 13.173173
## Warning: non-integer x = 13.213213
## Warning: non-integer x = 13.253253
## Warning: non-integer x = 13.293293
## Warning: non-integer x = 13.333333
## Warning: non-integer x = 13.373373
## Warning: non-integer x = 13.413413
## Warning: non-integer x = 13.453453
## Warning: non-integer x = 13.493493
## Warning: non-integer x = 13.533534
## Warning: non-integer x = 13.573574
## Warning: non-integer x = 13.613614
## Warning: non-integer x = 13.653654
## Warning: non-integer x = 13.693694
## Warning: non-integer x = 13.733734
## Warning: non-integer x = 13.773774
## Warning: non-integer x = 13.813814
## Warning: non-integer x = 13.853854
## Warning: non-integer x = 13.893894
## Warning: non-integer x = 13.933934
## Warning: non-integer x = 13.973974
## Warning: non-integer x = 14.014014
## Warning: non-integer x = 14.054054
## Warning: non-integer x = 14.094094
## Warning: non-integer x = 14.134134
## Warning: non-integer x = 14.174174
## Warning: non-integer x = 14.214214
## Warning: non-integer x = 14.254254
## Warning: non-integer x = 14.294294
## Warning: non-integer x = 14.334334
## Warning: non-integer x = 14.374374
## Warning: non-integer x = 14.414414
## Warning: non-integer x = 14.454454
## Warning: non-integer x = 14.494494
## Warning: non-integer x = 14.534535
## Warning: non-integer x = 14.574575
## Warning: non-integer x = 14.614615
## Warning: non-integer x = 14.654655
## Warning: non-integer x = 14.694695
## Warning: non-integer x = 14.734735
## Warning: non-integer x = 14.774775
## Warning: non-integer x = 14.814815
## Warning: non-integer x = 14.854855
## Warning: non-integer x = 14.894895
## Warning: non-integer x = 14.934935
## Warning: non-integer x = 14.974975
## Warning: non-integer x = 15.015015
## Warning: non-integer x = 15.055055
## Warning: non-integer x = 15.095095
## Warning: non-integer x = 15.135135
## Warning: non-integer x = 15.175175
## Warning: non-integer x = 15.215215
## Warning: non-integer x = 15.255255
## Warning: non-integer x = 15.295295
## Warning: non-integer x = 15.335335
## Warning: non-integer x = 15.375375
## Warning: non-integer x = 15.415415
## Warning: non-integer x = 15.455455
## Warning: non-integer x = 15.495495
## Warning: non-integer x = 15.535536
## Warning: non-integer x = 15.575576
## Warning: non-integer x = 15.615616
## Warning: non-integer x = 15.655656
## Warning: non-integer x = 15.695696
## Warning: non-integer x = 15.735736
## Warning: non-integer x = 15.775776
## Warning: non-integer x = 15.815816
## Warning: non-integer x = 15.855856
## Warning: non-integer x = 15.895896
## Warning: non-integer x = 15.935936
## Warning: non-integer x = 15.975976
## Warning: non-integer x = 16.016016
## Warning: non-integer x = 16.056056
## Warning: non-integer x = 16.096096
## Warning: non-integer x = 16.136136
## Warning: non-integer x = 16.176176
## Warning: non-integer x = 16.216216
## Warning: non-integer x = 16.256256
## Warning: non-integer x = 16.296296
## Warning: non-integer x = 16.336336
## Warning: non-integer x = 16.376376
## Warning: non-integer x = 16.416416
## Warning: non-integer x = 16.456456
## Warning: non-integer x = 16.496496
## Warning: non-integer x = 16.536537
## Warning: non-integer x = 16.576577
## Warning: non-integer x = 16.616617
## Warning: non-integer x = 16.656657
## Warning: non-integer x = 16.696697
## Warning: non-integer x = 16.736737
## Warning: non-integer x = 16.776777
## Warning: non-integer x = 16.816817
## Warning: non-integer x = 16.856857
## Warning: non-integer x = 16.896897
## Warning: non-integer x = 16.936937
## Warning: non-integer x = 16.976977
## Warning: non-integer x = 17.017017
## Warning: non-integer x = 17.057057
## Warning: non-integer x = 17.097097
## Warning: non-integer x = 17.137137
## Warning: non-integer x = 17.177177
## Warning: non-integer x = 17.217217
## Warning: non-integer x = 17.257257
## Warning: non-integer x = 17.297297
## Warning: non-integer x = 17.337337
## Warning: non-integer x = 17.377377
## Warning: non-integer x = 17.417417
## Warning: non-integer x = 17.457457
## Warning: non-integer x = 17.497497
## Warning: non-integer x = 17.537538
## Warning: non-integer x = 17.577578
## Warning: non-integer x = 17.617618
## Warning: non-integer x = 17.657658
## Warning: non-integer x = 17.697698
## Warning: non-integer x = 17.737738
## Warning: non-integer x = 17.777778
## Warning: non-integer x = 17.817818
## Warning: non-integer x = 17.857858
## Warning: non-integer x = 17.897898
## Warning: non-integer x = 17.937938
## Warning: non-integer x = 17.977978
## Warning: non-integer x = 18.018018
## Warning: non-integer x = 18.058058
## Warning: non-integer x = 18.098098
## Warning: non-integer x = 18.138138
## Warning: non-integer x = 18.178178
## Warning: non-integer x = 18.218218
## Warning: non-integer x = 18.258258
## Warning: non-integer x = 18.298298
## Warning: non-integer x = 18.338338
## Warning: non-integer x = 18.378378
## Warning: non-integer x = 18.418418
## Warning: non-integer x = 18.458458
## Warning: non-integer x = 18.498498
## Warning: non-integer x = 18.538539
## Warning: non-integer x = 18.578579
## Warning: non-integer x = 18.618619
## Warning: non-integer x = 18.658659
## Warning: non-integer x = 18.698699
## Warning: non-integer x = 18.738739
## Warning: non-integer x = 18.778779
## Warning: non-integer x = 18.818819
## Warning: non-integer x = 18.858859
## Warning: non-integer x = 18.898899
## Warning: non-integer x = 18.938939
## Warning: non-integer x = 18.978979
## Warning: non-integer x = 19.019019
## Warning: non-integer x = 19.059059
## Warning: non-integer x = 19.099099
## Warning: non-integer x = 19.139139
## Warning: non-integer x = 19.179179
## Warning: non-integer x = 19.219219
## Warning: non-integer x = 19.259259
## Warning: non-integer x = 19.299299
## Warning: non-integer x = 19.339339
## Warning: non-integer x = 19.379379
## Warning: non-integer x = 19.419419
## Warning: non-integer x = 19.459459
## Warning: non-integer x = 19.499499
## Warning: non-integer x = 19.539540
## Warning: non-integer x = 19.579580
## Warning: non-integer x = 19.619620
## Warning: non-integer x = 19.659660
## Warning: non-integer x = 19.699700
## Warning: non-integer x = 19.739740
## Warning: non-integer x = 19.779780
## Warning: non-integer x = 19.819820
## Warning: non-integer x = 19.859860
## Warning: non-integer x = 19.899900
## Warning: non-integer x = 19.939940
## Warning: non-integer x = 19.979980
## Warning: non-integer x = 20.020020
## Warning: non-integer x = 20.060060
## Warning: non-integer x = 20.100100
## Warning: non-integer x = 20.140140
## Warning: non-integer x = 20.180180
## Warning: non-integer x = 20.220220
## Warning: non-integer x = 20.260260
## Warning: non-integer x = 20.300300
## Warning: non-integer x = 20.340340
## Warning: non-integer x = 20.380380
## Warning: non-integer x = 20.420420
## Warning: non-integer x = 20.460460
## Warning: non-integer x = 20.500501
## Warning: non-integer x = 20.540541
## Warning: non-integer x = 20.580581
## Warning: non-integer x = 20.620621
## Warning: non-integer x = 20.660661
## Warning: non-integer x = 20.700701
## Warning: non-integer x = 20.740741
## Warning: non-integer x = 20.780781
## Warning: non-integer x = 20.820821
## Warning: non-integer x = 20.860861
## Warning: non-integer x = 20.900901
## Warning: non-integer x = 20.940941
## Warning: non-integer x = 20.980981
## Warning: non-integer x = 21.021021
## Warning: non-integer x = 21.061061
## Warning: non-integer x = 21.101101
## Warning: non-integer x = 21.141141
## Warning: non-integer x = 21.181181
## Warning: non-integer x = 21.221221
## Warning: non-integer x = 21.261261
## Warning: non-integer x = 21.301301
## Warning: non-integer x = 21.341341
## Warning: non-integer x = 21.381381
## Warning: non-integer x = 21.421421
## Warning: non-integer x = 21.461461
## Warning: non-integer x = 21.501502
## Warning: non-integer x = 21.541542
## Warning: non-integer x = 21.581582
## Warning: non-integer x = 21.621622
## Warning: non-integer x = 21.661662
## Warning: non-integer x = 21.701702
## Warning: non-integer x = 21.741742
## Warning: non-integer x = 21.781782
## Warning: non-integer x = 21.821822
## Warning: non-integer x = 21.861862
## Warning: non-integer x = 21.901902
## Warning: non-integer x = 21.941942
## Warning: non-integer x = 21.981982
## Warning: non-integer x = 22.022022
## Warning: non-integer x = 22.062062
## Warning: non-integer x = 22.102102
## Warning: non-integer x = 22.142142
## Warning: non-integer x = 22.182182
## Warning: non-integer x = 22.222222
## Warning: non-integer x = 22.262262
## Warning: non-integer x = 22.302302
## Warning: non-integer x = 22.342342
## Warning: non-integer x = 22.382382
## Warning: non-integer x = 22.422422
## Warning: non-integer x = 22.462462
## Warning: non-integer x = 22.502503
## Warning: non-integer x = 22.542543
## Warning: non-integer x = 22.582583
## Warning: non-integer x = 22.622623
## Warning: non-integer x = 22.662663
## Warning: non-integer x = 22.702703
## Warning: non-integer x = 22.742743
## Warning: non-integer x = 22.782783
## Warning: non-integer x = 22.822823
## Warning: non-integer x = 22.862863
## Warning: non-integer x = 22.902903
## Warning: non-integer x = 22.942943
## Warning: non-integer x = 22.982983
## Warning: non-integer x = 23.023023
## Warning: non-integer x = 23.063063
## Warning: non-integer x = 23.103103
## Warning: non-integer x = 23.143143
## Warning: non-integer x = 23.183183
## Warning: non-integer x = 23.223223
## Warning: non-integer x = 23.263263
## Warning: non-integer x = 23.303303
## Warning: non-integer x = 23.343343
## Warning: non-integer x = 23.383383
## Warning: non-integer x = 23.423423
## Warning: non-integer x = 23.463463
## Warning: non-integer x = 23.503504
## Warning: non-integer x = 23.543544
## Warning: non-integer x = 23.583584
## Warning: non-integer x = 23.623624
## Warning: non-integer x = 23.663664
## Warning: non-integer x = 23.703704
## Warning: non-integer x = 23.743744
## Warning: non-integer x = 23.783784
## Warning: non-integer x = 23.823824
## Warning: non-integer x = 23.863864
## Warning: non-integer x = 23.903904
## Warning: non-integer x = 23.943944
## Warning: non-integer x = 23.983984
## Warning: non-integer x = 24.024024
## Warning: non-integer x = 24.064064
## Warning: non-integer x = 24.104104
## Warning: non-integer x = 24.144144
## Warning: non-integer x = 24.184184
## Warning: non-integer x = 24.224224
## Warning: non-integer x = 24.264264
## Warning: non-integer x = 24.304304
## Warning: non-integer x = 24.344344
## Warning: non-integer x = 24.384384
## Warning: non-integer x = 24.424424
## Warning: non-integer x = 24.464464
## Warning: non-integer x = 24.504505
## Warning: non-integer x = 24.544545
## Warning: non-integer x = 24.584585
## Warning: non-integer x = 24.624625
## Warning: non-integer x = 24.664665
## Warning: non-integer x = 24.704705
## Warning: non-integer x = 24.744745
## Warning: non-integer x = 24.784785
## Warning: non-integer x = 24.824825
## Warning: non-integer x = 24.864865
## Warning: non-integer x = 24.904905
## Warning: non-integer x = 24.944945
## Warning: non-integer x = 24.984985
## Warning: non-integer x = 25.025025
## Warning: non-integer x = 25.065065
## Warning: non-integer x = 25.105105
## Warning: non-integer x = 25.145145
## Warning: non-integer x = 25.185185
## Warning: non-integer x = 25.225225
## Warning: non-integer x = 25.265265
## Warning: non-integer x = 25.305305
## Warning: non-integer x = 25.345345
## Warning: non-integer x = 25.385385
## Warning: non-integer x = 25.425425
## Warning: non-integer x = 25.465465
## Warning: non-integer x = 25.505506
## Warning: non-integer x = 25.545546
## Warning: non-integer x = 25.585586
## Warning: non-integer x = 25.625626
## Warning: non-integer x = 25.665666
## Warning: non-integer x = 25.705706
## Warning: non-integer x = 25.745746
## Warning: non-integer x = 25.785786
## Warning: non-integer x = 25.825826
## Warning: non-integer x = 25.865866
## Warning: non-integer x = 25.905906
## Warning: non-integer x = 25.945946
## Warning: non-integer x = 25.985986
## Warning: non-integer x = 26.026026
## Warning: non-integer x = 26.066066
## Warning: non-integer x = 26.106106
## Warning: non-integer x = 26.146146
## Warning: non-integer x = 26.186186
## Warning: non-integer x = 26.226226
## Warning: non-integer x = 26.266266
## Warning: non-integer x = 26.306306
## Warning: non-integer x = 26.346346
## Warning: non-integer x = 26.386386
## Warning: non-integer x = 26.426426
## Warning: non-integer x = 26.466466
## Warning: non-integer x = 26.506507
## Warning: non-integer x = 26.546547
## Warning: non-integer x = 26.586587
## Warning: non-integer x = 26.626627
## Warning: non-integer x = 26.666667
## Warning: non-integer x = 26.706707
## Warning: non-integer x = 26.746747
## Warning: non-integer x = 26.786787
## Warning: non-integer x = 26.826827
## Warning: non-integer x = 26.866867
## Warning: non-integer x = 26.906907
## Warning: non-integer x = 26.946947
## Warning: non-integer x = 26.986987
## Warning: non-integer x = 27.027027
## Warning: non-integer x = 27.067067
## Warning: non-integer x = 27.107107
## Warning: non-integer x = 27.147147
## Warning: non-integer x = 27.187187
## Warning: non-integer x = 27.227227
## Warning: non-integer x = 27.267267
## Warning: non-integer x = 27.307307
## Warning: non-integer x = 27.347347
## Warning: non-integer x = 27.387387
## Warning: non-integer x = 27.427427
## Warning: non-integer x = 27.467467
## Warning: non-integer x = 27.507508
## Warning: non-integer x = 27.547548
## Warning: non-integer x = 27.587588
## Warning: non-integer x = 27.627628
## Warning: non-integer x = 27.667668
## Warning: non-integer x = 27.707708
## Warning: non-integer x = 27.747748
## Warning: non-integer x = 27.787788
## Warning: non-integer x = 27.827828
## Warning: non-integer x = 27.867868
## Warning: non-integer x = 27.907908
## Warning: non-integer x = 27.947948
## Warning: non-integer x = 27.987988
## Warning: non-integer x = 28.028028
## Warning: non-integer x = 28.068068
## Warning: non-integer x = 28.108108
## Warning: non-integer x = 28.148148
## Warning: non-integer x = 28.188188
## Warning: non-integer x = 28.228228
## Warning: non-integer x = 28.268268
## Warning: non-integer x = 28.308308
## Warning: non-integer x = 28.348348
## Warning: non-integer x = 28.388388
## Warning: non-integer x = 28.428428
## Warning: non-integer x = 28.468468
## Warning: non-integer x = 28.508509
## Warning: non-integer x = 28.548549
## Warning: non-integer x = 28.588589
## Warning: non-integer x = 28.628629
## Warning: non-integer x = 28.668669
## Warning: non-integer x = 28.708709
## Warning: non-integer x = 28.748749
## Warning: non-integer x = 28.788789
## Warning: non-integer x = 28.828829
## Warning: non-integer x = 28.868869
## Warning: non-integer x = 28.908909
## Warning: non-integer x = 28.948949
## Warning: non-integer x = 28.988989
## Warning: non-integer x = 29.029029
## Warning: non-integer x = 29.069069
## Warning: non-integer x = 29.109109
## Warning: non-integer x = 29.149149
## Warning: non-integer x = 29.189189
## Warning: non-integer x = 29.229229
## Warning: non-integer x = 29.269269
## Warning: non-integer x = 29.309309
## Warning: non-integer x = 29.349349
## Warning: non-integer x = 29.389389
## Warning: non-integer x = 29.429429
## Warning: non-integer x = 29.469469
## Warning: non-integer x = 29.509510
## Warning: non-integer x = 29.549550
## Warning: non-integer x = 29.589590
## Warning: non-integer x = 29.629630
## Warning: non-integer x = 29.669670
## Warning: non-integer x = 29.709710
## Warning: non-integer x = 29.749750
## Warning: non-integer x = 29.789790
## Warning: non-integer x = 29.829830
## Warning: non-integer x = 29.869870
## Warning: non-integer x = 29.909910
## Warning: non-integer x = 29.949950
## Warning: non-integer x = 29.989990
## Warning: non-integer x = 30.030030
## Warning: non-integer x = 30.070070
## Warning: non-integer x = 30.110110
## Warning: non-integer x = 30.150150
## Warning: non-integer x = 30.190190
## Warning: non-integer x = 30.230230
## Warning: non-integer x = 30.270270
## Warning: non-integer x = 30.310310
## Warning: non-integer x = 30.350350
## Warning: non-integer x = 30.390390
## Warning: non-integer x = 30.430430
## Warning: non-integer x = 30.470470
## Warning: non-integer x = 30.510511
## Warning: non-integer x = 30.550551
## Warning: non-integer x = 30.590591
## Warning: non-integer x = 30.630631
## Warning: non-integer x = 30.670671
## Warning: non-integer x = 30.710711
## Warning: non-integer x = 30.750751
## Warning: non-integer x = 30.790791
## Warning: non-integer x = 30.830831
## Warning: non-integer x = 30.870871
## Warning: non-integer x = 30.910911
## Warning: non-integer x = 30.950951
## Warning: non-integer x = 30.990991
## Warning: non-integer x = 31.031031
## Warning: non-integer x = 31.071071
## Warning: non-integer x = 31.111111
## Warning: non-integer x = 31.151151
## Warning: non-integer x = 31.191191
## Warning: non-integer x = 31.231231
## Warning: non-integer x = 31.271271
## Warning: non-integer x = 31.311311
## Warning: non-integer x = 31.351351
## Warning: non-integer x = 31.391391
## Warning: non-integer x = 31.431431
## Warning: non-integer x = 31.471471
## Warning: non-integer x = 31.511512
## Warning: non-integer x = 31.551552
## Warning: non-integer x = 31.591592
## Warning: non-integer x = 31.631632
## Warning: non-integer x = 31.671672
## Warning: non-integer x = 31.711712
## Warning: non-integer x = 31.751752
## Warning: non-integer x = 31.791792
## Warning: non-integer x = 31.831832
## Warning: non-integer x = 31.871872
## Warning: non-integer x = 31.911912
## Warning: non-integer x = 31.951952
## Warning: non-integer x = 31.991992
## Warning: non-integer x = 32.032032
## Warning: non-integer x = 32.072072
## Warning: non-integer x = 32.112112
## Warning: non-integer x = 32.152152
## Warning: non-integer x = 32.192192
## Warning: non-integer x = 32.232232
## Warning: non-integer x = 32.272272
## Warning: non-integer x = 32.312312
## Warning: non-integer x = 32.352352
## Warning: non-integer x = 32.392392
## Warning: non-integer x = 32.432432
## Warning: non-integer x = 32.472472
## Warning: non-integer x = 32.512513
## Warning: non-integer x = 32.552553
## Warning: non-integer x = 32.592593
## Warning: non-integer x = 32.632633
## Warning: non-integer x = 32.672673
## Warning: non-integer x = 32.712713
## Warning: non-integer x = 32.752753
## Warning: non-integer x = 32.792793
## Warning: non-integer x = 32.832833
## Warning: non-integer x = 32.872873
## Warning: non-integer x = 32.912913
## Warning: non-integer x = 32.952953
## Warning: non-integer x = 32.992993
## Warning: non-integer x = 33.033033
## Warning: non-integer x = 33.073073
## Warning: non-integer x = 33.113113
## Warning: non-integer x = 33.153153
## Warning: non-integer x = 33.193193
## Warning: non-integer x = 33.233233
## Warning: non-integer x = 33.273273
## Warning: non-integer x = 33.313313
## Warning: non-integer x = 33.353353
## Warning: non-integer x = 33.393393
## Warning: non-integer x = 33.433433
## Warning: non-integer x = 33.473473
## Warning: non-integer x = 33.513514
## Warning: non-integer x = 33.553554
## Warning: non-integer x = 33.593594
## Warning: non-integer x = 33.633634
## Warning: non-integer x = 33.673674
## Warning: non-integer x = 33.713714
## Warning: non-integer x = 33.753754
## Warning: non-integer x = 33.793794
## Warning: non-integer x = 33.833834
## Warning: non-integer x = 33.873874
## Warning: non-integer x = 33.913914
## Warning: non-integer x = 33.953954
## Warning: non-integer x = 33.993994
## Warning: non-integer x = 34.034034
## Warning: non-integer x = 34.074074
## Warning: non-integer x = 34.114114
## Warning: non-integer x = 34.154154
## Warning: non-integer x = 34.194194
## Warning: non-integer x = 34.234234
## Warning: non-integer x = 34.274274
## Warning: non-integer x = 34.314314
## Warning: non-integer x = 34.354354
## Warning: non-integer x = 34.394394
## Warning: non-integer x = 34.434434
## Warning: non-integer x = 34.474474
## Warning: non-integer x = 34.514515
## Warning: non-integer x = 34.554555
## Warning: non-integer x = 34.594595
## Warning: non-integer x = 34.634635
## Warning: non-integer x = 34.674675
## Warning: non-integer x = 34.714715
## Warning: non-integer x = 34.754755
## Warning: non-integer x = 34.794795
## Warning: non-integer x = 34.834835
## Warning: non-integer x = 34.874875
## Warning: non-integer x = 34.914915
## Warning: non-integer x = 34.954955
## Warning: non-integer x = 34.994995
## Warning: non-integer x = 35.035035
## Warning: non-integer x = 35.075075
## Warning: non-integer x = 35.115115
## Warning: non-integer x = 35.155155
## Warning: non-integer x = 35.195195
## Warning: non-integer x = 35.235235
## Warning: non-integer x = 35.275275
## Warning: non-integer x = 35.315315
## Warning: non-integer x = 35.355355
## Warning: non-integer x = 35.395395
## Warning: non-integer x = 35.435435
## Warning: non-integer x = 35.475475
## Warning: non-integer x = 35.515516
## Warning: non-integer x = 35.555556
## Warning: non-integer x = 35.595596
## Warning: non-integer x = 35.635636
## Warning: non-integer x = 35.675676
## Warning: non-integer x = 35.715716
## Warning: non-integer x = 35.755756
## Warning: non-integer x = 35.795796
## Warning: non-integer x = 35.835836
## Warning: non-integer x = 35.875876
## Warning: non-integer x = 35.915916
## Warning: non-integer x = 35.955956
## Warning: non-integer x = 35.995996
## Warning: non-integer x = 36.036036
## Warning: non-integer x = 36.076076
## Warning: non-integer x = 36.116116
## Warning: non-integer x = 36.156156
## Warning: non-integer x = 36.196196
## Warning: non-integer x = 36.236236
## Warning: non-integer x = 36.276276
## Warning: non-integer x = 36.316316
## Warning: non-integer x = 36.356356
## Warning: non-integer x = 36.396396
## Warning: non-integer x = 36.436436
## Warning: non-integer x = 36.476476
## Warning: non-integer x = 36.516517
## Warning: non-integer x = 36.556557
## Warning: non-integer x = 36.596597
## Warning: non-integer x = 36.636637
## Warning: non-integer x = 36.676677
## Warning: non-integer x = 36.716717
## Warning: non-integer x = 36.756757
## Warning: non-integer x = 36.796797
## Warning: non-integer x = 36.836837
## Warning: non-integer x = 36.876877
## Warning: non-integer x = 36.916917
## Warning: non-integer x = 36.956957
## Warning: non-integer x = 36.996997
## Warning: non-integer x = 37.037037
## Warning: non-integer x = 37.077077
## Warning: non-integer x = 37.117117
## Warning: non-integer x = 37.157157
## Warning: non-integer x = 37.197197
## Warning: non-integer x = 37.237237
## Warning: non-integer x = 37.277277
## Warning: non-integer x = 37.317317
## Warning: non-integer x = 37.357357
## Warning: non-integer x = 37.397397
## Warning: non-integer x = 37.437437
## Warning: non-integer x = 37.477477
## Warning: non-integer x = 37.517518
## Warning: non-integer x = 37.557558
## Warning: non-integer x = 37.597598
## Warning: non-integer x = 37.637638
## Warning: non-integer x = 37.677678
## Warning: non-integer x = 37.717718
## Warning: non-integer x = 37.757758
## Warning: non-integer x = 37.797798
## Warning: non-integer x = 37.837838
## Warning: non-integer x = 37.877878
## Warning: non-integer x = 37.917918
## Warning: non-integer x = 37.957958
## Warning: non-integer x = 37.997998
## Warning: non-integer x = 38.038038
## Warning: non-integer x = 38.078078
## Warning: non-integer x = 38.118118
## Warning: non-integer x = 38.158158
## Warning: non-integer x = 38.198198
## Warning: non-integer x = 38.238238
## Warning: non-integer x = 38.278278
## Warning: non-integer x = 38.318318
## Warning: non-integer x = 38.358358
## Warning: non-integer x = 38.398398
## Warning: non-integer x = 38.438438
## Warning: non-integer x = 38.478478
## Warning: non-integer x = 38.518519
## Warning: non-integer x = 38.558559
## Warning: non-integer x = 38.598599
## Warning: non-integer x = 38.638639
## Warning: non-integer x = 38.678679
## Warning: non-integer x = 38.718719
## Warning: non-integer x = 38.758759
## Warning: non-integer x = 38.798799
## Warning: non-integer x = 38.838839
## Warning: non-integer x = 38.878879
## Warning: non-integer x = 38.918919
## Warning: non-integer x = 38.958959
## Warning: non-integer x = 38.998999
## Warning: non-integer x = 39.039039
## Warning: non-integer x = 39.079079
## Warning: non-integer x = 39.119119
## Warning: non-integer x = 39.159159
## Warning: non-integer x = 39.199199
## Warning: non-integer x = 39.239239
## Warning: non-integer x = 39.279279
## Warning: non-integer x = 39.319319
## Warning: non-integer x = 39.359359
## Warning: non-integer x = 39.399399
## Warning: non-integer x = 39.439439
## Warning: non-integer x = 39.479479
## Warning: non-integer x = 39.519520
## Warning: non-integer x = 39.559560
## Warning: non-integer x = 39.599600
## Warning: non-integer x = 39.639640
## Warning: non-integer x = 39.679680
## Warning: non-integer x = 39.719720
## Warning: non-integer x = 39.759760
## Warning: non-integer x = 39.799800
## Warning: non-integer x = 39.839840
## Warning: non-integer x = 39.879880
## Warning: non-integer x = 39.919920
## Warning: non-integer x = 39.959960


## Method 2. Look at the ... argument, remove the parameters
## that are intended for the distribution object.

## Find out what arguments are accepted by a function and extract
## them from a list (usually, a "dots" list).
## Big Problem: It only finds fully matching argument names, no partials
getDotsFor <- function(fn = NULL, dots = NULL, remove = FALSE){
matches <- names(dots) %in%  names(formals(fn))
parms <-  dots[matches]
if(remove) dots[matches] <<- NULL
parms
}

dots <- list(a = 6, mean = 13, sd = 44, f = TRUE)

getDotsFor(fn = "rnorm", dots = dots)

## $mean ## [1] 13 ## ##$sd
## [1] 44

getDotsFor(fn = "rnorm", dots = dots, remove = TRUE)

## $mean ## [1] 13 ## ##$sd
## [1] 44

## previous "parms" now in ...

plotDist2  <- function (alpha, to, from,  n = 1000, filename = NULL,
alternative = c("two.tailed", "greater", "lesser"),
distribution =  c("normal","t", "F", "chisq", "binomial"),
colour = "black", fill = "skyblue2",
...)
{
alternative <- match.arg(alternative)
alt.alpha <- switch(alternative, two.tailed = alpha/2, greater = alpha,
lesser = alpha)
myPDF <- switch(distribution, normal = "dnorm", t = "dt", F = "df",
chisq = "dchisq", binomial = "dbinom")
myQ <- switch(distribution, normal = "qnorm", t = "qt", F = "qf",
chisq = "qchisq", binomial = "qbinom")

dots <- list(...)

distParms <- getDotsFor(myQ, dots =  dots, remove = TRUE)
## Note: dots now PURGED of arguments for the distribution

## For each, set defaults, then replace if alternatives were in ...
myParms <- switch(distribution,
normal = modifyList(list(mean = 0, sd = 1), distParms),
t = modifyList(list(df = 100), distParms),
F = modifyList(list(df1 = 100, df2 = 100), distParms),
chisq = modifyList(list(df = 100), distParms),
binomial = modifyList(list(size = 1, prob = 0.5), distParms))

myName <- switch(distribution,
normal = "Normal",
t = "T",
F = "F",
chisq = expression(chi),
binomial = "Binomial")

myTitle <- switch(distribution,
normal = substitute(myName(mu == parm1, sigma^2 == parm2^2), list(myName = myName, parm1 = myParms$m, parm2 = myParms$sd)),
t = substitute(T(nu == parm1), list(myName = myName, parm1 == myParms$df)), F = substitute(F(nu[1] == parm1, nu[2] == parm2), list(parm1 = myParms$df1, parm2 = myParms$df2)), chisq = substitute(chi[parm1], list(myName = myName, parm1 = myParms$df)),
binomial = substitute(Binomial(parm1, parm2), list(myName = myName, parm1 = myParms$size, parm2 = myParms$prob)))

crit.lower <- do.call(myQ, modifyList( list(p = alt.alpha, lower.tail = TRUE, ...), myParms ))
crit.upper <- do.call(myQ, modifyList( list(p = alt.alpha, lower.tail = FALSE, ...), myParms ))
## if (missing(from)) from <- crit.lower - 0.10 *(crit.upper - crit.lower)
## if (missing(to)) to <- crit.upper + 0.10 * (crit.upper - crit.lower)

if (missing(from)) from <- do.call(myQ, modifyList(list(p = 0.001), myParms))
if (missing(to)) to <- do.call(myQ, modifyList(list(p = 0.999), myParms))
cord.x1 <- c(from, seq(from = from, to = crit.lower, length.out = 100), crit.lower)
cord.y1 <- c(0, do.call(myPDF, modifyList(list(x = seq(from = from, to = crit.lower,
length.out = 100), ...), myParms)), 0)
cord.x2 <- c(crit.upper, seq(from = crit.upper, to = to,
length.out = 100), to)
cord.y2 <- c(0, do.call(myPDF, modifyList(list(x = seq(from = crit.upper, to = to,
length.out = 100), ...), myParms)), 0)
if (!is.null(filename)) pdf(file = filename)

xseq <- seq(from, to, length.out = n)
probseq <- do.call(myPDF,  modifyList(list(x = xseq, ...), myParms))
plot(probseq ~ xseq, col = colour, type = "l" , lty = 1, lwd = 1,
ylab = "Density", xlab = paste("Values from the", myName),
main = myTitle)
if (!identical(alternative, "greater")) {
polygon(x = cord.x1, y = cord.y1, col = fill)
}
if (!identical(alternative, "lesser")) {
polygon(x = cord.x2, y = cord.y2, col = fill)
}
if (!is.null(filename)) dev.off()
}

plotDist2(alpha = 0.05, alternative=c("two.tailed"), distribution="normal")


##looked encouraging

plotDist2(alpha = 0.05, alternative=c("two.tailed"), distribution="normal", mean = 17, sd = 3)


## works, as long as I fully spell out "mean" and "sd". I need to work on partial argument
## matching, maybe.

plotDist2(alpha = 0.05, alternative=c("greater"), distribution="normal")


plotDist2(alpha=0.05, alternative=c("greater"), distribution="normal", mean = -44, sd = 19)


plotDist(alpha=0.05, alternative=c("two.tailed"), distribution="t")


plotDist(alpha=0.05, alternative=c("two.tailed"), distribution="chisq")


##Usually people don't want that one

plotDist(alpha=0.05, alternative=c("greater"), distribution="chisq")