The function `quantile`

calculates quantiles on the probabilities of a model constructed with `hmscH`

. Quantiles are calculated for each species included in the model.
The function `basicStatHMSC`

calculates the means and standard deviations on the probabilities of a model constructed with `hmscH`

.
The function `summary`

calculates the means, standard deviations, and three quantiles (0.025,0.5,0.975) on the probabilities of a model constructed with `hmscH`

.

1 2 3 4 5 |

`x` |
An object of class |

`object` |
An object of class |

`probs` |
A numeric vector of probabilities with values ranging from 0 to 1. See |

`type` |
an integer between 1 and 9 selecting one of the nine quantile algorithms detailed in |

`stats` |
A character vector defining the statistics to calculate. Any unambiguous variation of wording used in this argument is accepted. |

`...` |
Arguments passed to |

These functions can calculate summary statistics for any type of `hmscH`

object, whether they stem from a linear or a non-linear model.

For `quantile`

: A three-dimensional array where the first dimension represents sites, the second dimension represents species, and the third dimensions the quantiles.
For `basicStatHMSC`

: A matrix where the rows represents sites and the columns represents species if only the mean or the standard deviation is calculated. Otherwise, a three-dimensional array where the first dimension represents sites, the second dimension represents species, and the third dimensions the means and standard deviations.

F. Guillaume Blanchet

Hyndman, R. J. and Fan, Y. (1996) Sample quantiles in statistical packages, *American Statistician*, **50**, 361-365.

`quantile`

, `hmscH`

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 | ```
#==================
### Simulating data
#==================
nspecies<-20
desc<-cbind(1,scale(1:50),scale(1:50)^2)
dataBase<-communitySimulH(desc,nsp=nspecies)
#=================================
### Formatting data and parameters
#=================================
formdata<-as.HMSCdata(dataBase$data$Y,desc,Ypattern="sp",interceptX=FALSE,interceptTr=FALSE)
#========================
### Formatting parameters
#========================
startParamX<-matrix(rnorm(nspecies*ncol(desc)),nrow=nspecies,ncol=ncol(desc))
startMean<-rnorm(ncol(desc))
startSigma<-rWishart(1,ncol(desc)+1,diag(ncol(desc)))[,,1]
formparam<-as.HMSCparam(formdata,paramX=startParamX,means=startMean,sigma=startSigma)
formpriors<-as.HMSCprior(formparam,rep(0,length(formparam$means)),0,length(formparam$means),diag(length(formparam$means)))
#===================================================
### Building model using a linear modelling approach
#===================================================
modelLinear<-hmscH(formdata,formparam,formpriors,niter=200,nburn=100)
meansdHMSC<-basicStatHMSC(modelLinear)
quantileHMSC<-quantile(modelLinear)
summaryHMSC<-summary(modelLinear)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.