LegendrePolyMatrices: Legendre Orthogonal Polynomials for various values of alpha...

Description Usage Author(s) Examples

Description

Legendre Orthogonal Polynomials for various values of alpha and beta. The dataset is used in the demo("LegendrePolynomials").

Usage

1
data("LegendrePolyMatrices")

Author(s)

Richard M. Heiberger <rmh@temple.edu>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
## Not run: 
## dontrun is to avoid requiring the user to install the polynom and orthopolynom packages

## These matrices are used in the demo showing both latex and msWord tables
##     demo("LegendrePolynomials"       , package="microplot", ask=TRUE)

## Legendre Polynomials
if (require(orthopolynom)) {
LP.score <- function(alpha, beta, m = 4, B = 100) {
  x <- seq(1/B, 1 - 1/B, length = B)
  u <- stats::pbeta(x, alpha, beta)
  poly <-  slegendre.polynomials(m, normalized=TRUE)
  data.frame(x=x, T=sapply(poly[-1], predict, u))
}

alphas <- c(.25, .5, 1)
betas <- c(.25, .5, 1, 2, 10)


## generate LegendrePolyMatrices
LegendrePolyMatrices <- matrix(list(), nrow=length(alphas), ncol=length(betas),
                               dimnames=list(alphas=alphas, betas=betas))
for (alpha in seq(along=alphas))
   for (beta in seq(along=betas))
     LegendrePolyMatrices[[alpha, beta]] <- LP.score(alphas[alpha], betas[beta])

save(LegendrePolyMatrices, file="LegendrePolyMatrices.rda")

detach("package:orthopolynom", unload=TRUE)
detach("package:polynom", unload=TRUE)
} else data(LegendrePolyMatrices)

## End(Not run)

microplot documentation built on Nov. 29, 2020, 1:07 a.m.