Skip to content

Commit

Permalink
Merge pull request #57 from daijiang/new_vignette
Browse files Browse the repository at this point in the history
update pkgdown site
  • Loading branch information
Daijiang Li authored Jul 19, 2020
2 parents fd06af5 + 54b79f3 commit 35ba369
Show file tree
Hide file tree
Showing 24 changed files with 71 additions and 67 deletions.
11 changes: 4 additions & 7 deletions R/pglmm-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -1291,10 +1291,7 @@ predict.communityPGLMM <- function(object, newdata = NULL, ...) {
#' @export
#'
simulate.communityPGLMM <- function(object, nsim = 1, seed = NULL,
use.u = FALSE, re.form = NULL, ...) {
if(use.u & object$bayes) {
stop("Sorry, simulate.communityPGLMM currently doesn't support use.u = TRUE, but we are working on it!")
}
re.form = NULL, ...) {
if(!is.null(seed)) set.seed(seed)

#sim <- INLA::inla.posterior.sample(nsim, object$inla.model)
Expand All @@ -1304,14 +1301,14 @@ simulate.communityPGLMM <- function(object, nsim = 1, seed = NULL,
# for gaussion, binomial, and poisson distributions.
nn <- nrow(object$iV)

if(is.null(re.form) | use.u){
if(is.null(re.form)){
sim <- pglmm_predicted_values(object, re.form = NULL, type = "link")$Y_hat
sim <- sim %*% matrix(1, 1, nsim)
if(object$family == "gaussian")
sim <- sim + sqrt(object$s2resid) * matrix(rnorm(nsim * nn), nrow = nn)
} else {
re.form = deparse(NA)
if(deparse(re.form) == "~0" | deparse(re.form) == "NA" | !use.u){
if(deparse(re.form) == "~0" | deparse(re.form) == "NA"){
# condition on none of the random effects
sim <- (object$X %*% object$B) %*% matrix(1, 1, nsim)
chol.V <- backsolve(chol(object$iV), diag(nn))
Expand All @@ -1332,7 +1329,7 @@ simulate.communityPGLMM <- function(object, nsim = 1, seed = NULL,
sim <- apply(mu_sim, MARGIN = 2, FUN = function(x) rbinom(length(x), Ntrials, x))
}
} else { # beyes version
if(deparse(re.form) == "~0" | deparse(re.form) == "NA" | !use.u)
if(deparse(re.form) == "~0" | deparse(re.form) == "NA")
warning("re.form = NULL is the only option for bayes models at this moment",
immediate. = TRUE)
mu_sim <- do.call(rbind, lapply(object$inla.model$marginals.fitted.values,
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ To install this package:
devtools::install_github("daijiang/phyr")
# or install from binary file (may not be the latest version)
# macOS
install.packages("https://raw.githubusercontent.com/daijiang/phyr/master/phyr_0.1.6.tgz", repos = NULL)
install.packages("https://raw.githubusercontent.com/daijiang/phyr/master/phyr_1.0.3.tgz", repos = NULL)
# Windows
install.packages("https://raw.githubusercontent.com/daijiang/phyr/master/phyr_0.1.6.zip", repos = NULL)
```
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ To install this package:
devtools::install_github("daijiang/phyr")
# or install from binary file (may not be the latest version)
# macOS
install.packages("https://raw.githubusercontent.com/daijiang/phyr/master/phyr_0.1.6.tgz", repos = NULL)
install.packages("https://raw.githubusercontent.com/daijiang/phyr/master/phyr_1.0.3.tgz", repos = NULL)
# Windows
install.packages("https://raw.githubusercontent.com/daijiang/phyr/master/phyr_0.1.6.zip", repos = NULL)
```
Expand Down
2 changes: 1 addition & 1 deletion docs/articles/benchmarks.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/pglmm.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 23 additions & 16 deletions docs/articles/phyr_example_empirical.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/articles/plot-re.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ pandoc: 2.7.3
pkgdown: 1.5.1.9000
pkgdown_sha: caf7cc74e008e8d0d6e53eeda93cd3cad3545bf2
articles: []
last_built: 2020-07-16T01:00Z
last_built: 2020-07-18T19:08Z

2 changes: 1 addition & 1 deletion docs/reference/fixef.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/reference/pglmm-plot-data.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 35ba369

Please # to comment.