Learn R Programming

InfDim (version 1.0)

psii: A generic function to produce a matrix of Legendre polynomials for IDM calculation

Description

The function creates an n times n matrix, each row of the matrix replicating Legendre polynomials for the corresponding value of the re-scaled age vector the length of which is n. This function is a subfunction of IDM.

Usage

psii(adjusted_age)

Arguments

adjusted_age
The vector of ages scaled to range from -1 to 1.

Value

Details

For further details, see Kirkpatrick et al. 1990.

References

Kirkpatrick M, Lofsvold D, Bulmer M (1990) Analysis of the inheritance, selection and evolution of growth trajectories. Genetics 124:979-993.

See Also

IDM, IDM.bootCI

Examples

Run this code

# The function is defined as
function(adjusted_age){
n=length(adjusted_age)

adjust_temp=rep(adjusted_age,each=n)
j_temp=rep(0:(n-1),n)

psii_elements=rep(NA,n*n)
for(i in 1:(n*n)){
psii_elements[i]=p.function(j=j_temp[i],x=adjust_temp[i])
  }
psii_temp=matrix(psii_elements,byrow=T,nrow=n,ncol=n)
return(psii_temp)
  }

Run the code above in your browser using DataLab