View source: R/splineDensity.smoothingSplinesValidation.R

smoothSplinesVal | R Documentation |

`alpha`

As `smoothSplines`

, `smoothSplinesVal`

computes the density function that 'best' fits
discretized distributional data, using B-spline basis functions, for different `alpha`

.

Comparing and choosing an appropriate `alpha`

is the ultimate goal.

```
smoothSplinesVal(
k,
l,
alpha,
data,
xcp,
knots,
weights = matrix(1, dim(data)[1], dim(data)[2]),
prior = "default",
cores = 1
)
```

`k` |
smoothing splines degree |

`l` |
order of derivative in the penalization term |

`alpha` |
vector of weights for penalization |

`data` |
an object of class "matrix" containing data to be smoothed, row by row |

`xcp` |
vector of control points |

`knots` |
either vector of knots for the splines or a integer for the number of equispaced knots |

`weights` |
matrix of weights. If not gives, all data points will be weighted the same. |

`prior` |
prior used for zero-replacements. This must be one of "perks", "jeffreys", "bayes_laplace", "sq" or "default" |

`cores` |
number of cores for parallel execution |

See `smoothSplines`

for the description of the algorithm.

A list of three objects:

`alpha` |
the values of |

`J` |
the values of the functional evaluated in the minimizing |

`CV-error` |
the values of the leave-one-out CV-error |

Alessia Di Blasi, Federico Pavone, Gianluca Zeni, Matthias Templ

J. Machalova, K. Hron & G.S. Monti (2016): Preprocessing of centred logratio transformed density functions using smoothing splines. Journal of Applied Statistics, 43:8, 1419-1435.

```
SepalLengthCm <- iris$Sepal.Length
Species <- iris$Species
iris1 <- SepalLengthCm[iris$Species==levels(iris$Species)[1]]
h1 <- hist(iris1, nclass = 12, plot = FALSE)
## Not run:
midx1 <- h1$mids
midy1 <- matrix(h1$density, nrow=1, ncol = length(h1$density), byrow=TRUE)
knots <- 7
sol1 <- smoothSplinesVal(k=3,l=2,alpha=10^seq(-4,4,by=1),midy1,midx1,knots,cores=1)
## End(Not run)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.