Skip to content

Commit

Permalink
load .Rmd files with system.file from inst/examples instead
Browse files Browse the repository at this point in the history
  • Loading branch information
cboettig committed May 13, 2014
1 parent 67cad00 commit 6a38ce0
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 526 deletions.
4 changes: 2 additions & 2 deletions R/gp_mcmc.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ summary_gp_mcmc <- function(gp, burnin=0, thin=1){
df <- melt(postdist, id="index")
traces_plot <-
ggplot(df) + geom_line(aes(index, value)) +
facet_wrap(~ variable, scale="free", ncol=1)
facet_wrap(~ variable, scales="free", ncol=1)

s2.p <- gp$s2.p
d.p <- gp$d.p
Expand All @@ -136,7 +136,7 @@ summary_gp_mcmc <- function(gp, burnin=0, thin=1){
posteriors_plot <- ggplot(df, aes(value)) +
stat_density(geom="path", position="identity", alpha=0.7) +
geom_line(data=prior_curves, aes(x=value, y=density), col="red") +
facet_wrap(~ variable, scale="free", ncol=2)
facet_wrap(~ variable, scales="free", ncol=2)

# print(traces_plot)
# print(posteriors_plot)
Expand Down
7 changes: 4 additions & 3 deletions R/gp_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
#' Plot a Gaussian Process
#'
#' Plot the mean (line) and 2 standard deviations (ribbon)
#' @param gp a gpfit object from \code{\link{gp_fit}}
#' @param x a gpfit object from \code{\link{gp_fit}}
#' @param true an optional data.frame with columns "x" and "y" containing target curve.
#' @param ... additional arguments (not implemented)
#' @return a ggplot object of the plot
#' @export
plot.gpfit <- function(gp, ...){
dat <- data.frame(x=gp$X, y=(gp$Ef), ymin=(gp$Ef-2*sqrt(diag(gp$Cf))), ymax=(gp$Ef+2*sqrt(diag(gp$Cf))))
plot.gpfit <- function(x, true, ...){
dat <- data.frame(x=x$X, y=(x$Ef), ymin=(x$Ef-2*sqrt(diag(x$Cf))), ymax=(x$Ef+2*sqrt(diag(x$Cf))))
p <- ggplot(dat) +
geom_ribbon(aes(x=x,y=y, ymin=ymin, ymax=ymax), fill="grey80") + # Var
geom_line(aes(x=x,y=y), size=1) + #MEAN
Expand Down
6 changes: 4 additions & 2 deletions man/plot.gpfit.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
\alias{plot.gpfit}
\title{Plot a Gaussian Process}
\usage{
\method{plot}{gpfit}(gp, ...)
\method{plot}{gpfit}(x, true, ...)
}
\arguments{
\item{gp}{a gpfit object from \code{\link{gp_fit}}}
\item{x}{a gpfit object from \code{\link{gp_fit}}}

\item{true}{an optional data.frame with columns "x" and "y" containing target curve.}

\item{...}{additional arguments (not implemented)}
}
\value{
a ggplot object of the plot
Expand Down
301 changes: 0 additions & 301 deletions tests/testthat/gaussian-process-basics.Rmd

This file was deleted.

Loading

0 comments on commit 6a38ce0

Please sign in to comment.