Commit b34bb2f3 authored by Tom Reynkens's avatar Tom Reynkens

Move examples for S3 methods into example for glmsmurf

parent 7210f230
Type: Package
Package: smurf
Title: Sparse Multi-Type Regularized Feature Modeling
Version: 1.0.0.9000
Version: 1.0.0
Date: 2018-12-03
Authors@R: c(
person("Tom", "Reynkens", email = "tomreynkens@hotmail.com", role = c("aut", "cre"),
......
......@@ -17,17 +17,7 @@
#'
#' @seealso \code{\link{coef_reest}}, \code{\link[stats]{coef}}, \code{\link{summary.glmsmurf}}, \code{\link{glmsmurf}}, \code{\link{glmsmurf-class}}
#'
#' @examples \dontrun{
#'
#' # See example(glmsmurf) on how to obtain
#' # the fitted model in the munich.fit object
#'
#' # Get coefficients of estimated model
#' coef(munich.fit)
#'
#' # Get coefficients of re-estimated model
#' coef_reest(munich.fit)
#' }
#' @examples ## See example(glmsmurf) for examples
#'
coef.glmsmurf <- function(object, ...) {
......@@ -55,17 +45,8 @@ coefficients.glmsmurf <- coef.glmsmurf
#'
#' @seealso \code{\link{coef.glmsmurf}}, \code{\link[stats]{coef}}, \code{\link{summary.glmsmurf}}, \code{\link{glmsmurf}}, \code{\link{glmsmurf-class}}
#'
#' @examples \dontrun{
#'
#' # See example(glmsmurf) on how to obtain
#' # the fitted model in the munich.fit object
#'
#' # Get coefficients of estimated model
#' coef(munich.fit)
#'
#' # Get coefficients of re-estimated model
#' coef_reest(munich.fit)
#' }
#' @examples ## See example(glmsmurf) for examples
#'
coef_reest <- function(object, ...) UseMethod("coef_reest", object)
......
......@@ -18,17 +18,8 @@
#' @seealso \code{\link{deviance_reest}}, \code{\link[stats]{deviance}}, \code{\link{summary.glmsmurf}},
#' \code{\link{glmsmurf}}, \code{\link{glmsmurf-class}}
#'
#' @examples \dontrun{
#'
#' # See example(glmsmurf) on how to obtain
#' # the fitted model in the munich.fit object
#'
#' # Get deviance of estimated model
#' deviance(munich.fit)
#'
#' # Get deviance of re-estimated model
#' deviance_reest(munich.fit)
#' }
#'
#' @examples ## See example(glmsmurf) for examples
#'
deviance.glmsmurf <- function(object, ...) {
......@@ -51,17 +42,7 @@ deviance.glmsmurf <- function(object, ...) {
#' @seealso \code{\link{deviance.glmsmurf}}, \code{\link[stats]{deviance}}, \code{\link{summary.glmsmurf}},
#' \code{\link{glmsmurf}}, \code{\link{glmsmurf-class}}
#'
#' @examples \dontrun{
#'
#' # See example(glmsmurf) on how to obtain
#' # the fitted model in the munich.fit object
#'
#' # Get deviance of estimated model
#' deviance(munich.fit)
#'
#' # Get deviance of re-estimated model
#' deviance_reest(munich.fit)
#' }
#' @examples ## See example(glmsmurf) for examples
#'
deviance_reest <- function(object, ...) UseMethod("deviance_reest", object)
......
......@@ -17,17 +17,7 @@
#'
#' @seealso \code{\link{fitted_reest}}, \code{\link[stats:fitted.values]{fitted}}, \code{\link{glmsmurf}}, \code{\link{glmsmurf-class}}
#'
#' @examples \dontrun{
#'
#' # See example(glmsmurf) on how to obtain
#' # the fitted model in the munich.fit object
#'
#' # Get fitted values of estimated model
#' fitted(munich.fit)
#'
#' # Get fitted values of re-estimated model
#' fitted_reest(munich.fit)
#' }
#' @examples ## See example(glmsmurf) for examples
#'
fitted.glmsmurf <- function(object, ...) {
......@@ -49,17 +39,7 @@ fitted.glmsmurf <- function(object, ...) {
#'
#' @seealso \code{\link{fitted.glmsmurf}}, \code{\link[stats:fitted.values]{fitted}}, \code{\link{glmsmurf}}, \code{\link{glmsmurf-class}}
#
#' @examples \dontrun{
#'
#' # See example(glmsmurf) on how to obtain
#' # the fitted model in the munich.fit object
#'
#' # Get fitted values of estimated model
#' fitted(munich.fit)
#'
#' # Get fitted values of re-estimated model
#' fitted_reest(munich.fit)
#' }
#' @examples ## See example(glmsmurf) for examples
#'
fitted_reest <- function(object, ...) UseMethod("fitted_reest", object)
#fitted.values_reest <- function(object, ...) UseMethod("fitted_reest", object) # Alias for fitted_reest
......
......@@ -26,17 +26,7 @@
#' @seealso \code{\link{predict_reest}}, \code{\link[stats]{predict.glm}}, \code{\link[stats]{predict}},
#' \code{\link{glmsmurf}}, \code{\link{glmsmurf-class}}
#'
#' @examples \dontrun{
#'
#' # See example(glmsmurf) on how to obtain
#' # the fitted model in the munich.fit object
#'
#' # Get predicted values of estimated model on scale of linear predictors
#' predict(munich.fit, type = "link")
#'
#' # Get predicted values of re-estimated model on scale of linear predictors
#' predict_reest(munich.fit, type = "link")
#' }
#' @examples ## See example(glmsmurf) for examples
#'
predict.glmsmurf <- function(object, newdata = NULL, newoffset = NULL, type = c("link", "response", "terms"), ...) {
......@@ -58,17 +48,7 @@ predict.glmsmurf <- function(object, newdata = NULL, newoffset = NULL, type = c(
#' @seealso \code{\link{predict.glmsmurf}}, \code{\link[stats]{predict.glm}}, \code{\link[stats]{predict}},
#' \code{\link{glmsmurf}}, \code{\link{glmsmurf-class}}
#'
#' @examples \dontrun{
#'
#' # See example(glmsmurf) on how to obtain
#' # the fitted model in the munich.fit object
#'
#' # Get predicted values of estimated model on scale of linear predictors
#' predict(munich.fit, type = "link")
#'
#' # Get predicted values of re-estimated model on scale of linear predictors
#' predict_reest(munich.fit, type = "link")
#' }
#' @examples ## See example(glmsmurf) for examples
#'
predict_reest <- function(object, ...) UseMethod("predict_reest", object)
......
......@@ -22,17 +22,7 @@
#'
#' @seealso \code{\link{residuals_reest}}, \code{\link{residuals}}, \code{\link[stats]{glm.summaries}}, \code{\link{glmsmurf-class}}
#'
#' @examples \dontrun{
#'
#' # See example(glmsmurf) on how to obtain
#' # the fitted model in the munich.fit object
#'
#' # Get deviance residuals of estimated model
#' residuals(munich.fit, type = "deviance")
#'
#' # Get deviance residuals of re-estimated model
#' residuals_reest(munich.fit, type = "deviance")
#' }
#' @examples ## See example(glmsmurf) for examples
#'
residuals.glmsmurf <- function(object, type = c("deviance", "pearson", "working", "response", "partial"), ...) {
......@@ -62,17 +52,7 @@ resid.glmsmurf <- residuals.glmsmurf
#'
#' @seealso \code{\link{residuals.glmsmurf}}, \code{\link{residuals}}, \code{\link[stats]{glm.summaries}}, \code{\link{glmsmurf-class}}
#'
#' @examples \dontrun{
#'
#' # See example(glmsmurf) on how to obtain
#' # the fitted model in the munich.fit object
#'
#' # Get deviance residuals of estimated model
#' residuals(munich.fit, type = "deviance")
#'
#' # Get deviance residuals of re-estimated model
#' residuals_reest(munich.fit, type = "deviance")
#' }
#' @examples ## See example(glmsmurf) for examples
#'
residuals_reest <- function(object, ...) UseMethod("residuals_reest", object)
......
......@@ -26,6 +26,8 @@ print.glmsmurf <- function(x, ...) {
#'
#' @seealso \code{\link[stats]{summary.glm}}, \code{\link{glmsmurf}}, \code{\link{glmsmurf-class}}
#'
#' @examples ## See example(glmsmurf) for examples
#'
#' @method summary glmsmurf
summary.glmsmurf <- function(object, digits = 3L, ...) {
......
......@@ -12,6 +12,12 @@
}
}
\subsection{Documentation changes:}{
\itemize{
\item Move examples for S3 methods into example for \code{glmsmurf}.
}
}
\subsection{Miscellaneous changes:}{
\itemize{
\item Remove maintainer field in DESCRIPTION as it is already set using Authors@R.
......@@ -21,7 +27,6 @@
\item First release on CRAN.
}
}
}
......
......@@ -59,11 +59,45 @@ munich.fit <- glmsmurf(formula = formu, family = gaussian(), data = rent,
pen.weights = "glm.stand", lambda = 0.008914)
####
# S3 methods for glmsmurf objects
# Model summary
summary(munich.fit)
# Get coefficients of estimated model
coef(munich.fit)
# Get coefficients of re-estimated model
coef_reest(munich.fit)
# Plot coefficients of estimated model
plot(munich.fit)
# Plot coefficients of re-estimated model
plot_reest(munich.fit)
# Model summary
summary(munich.fit)
# Get deviance of estimated model
deviance(munich.fit)
# Get deviance of re-estimated model
deviance_reest(munich.fit)
# Get fitted values of estimated model
fitted(munich.fit)
# Get fitted values of re-estimated model
fitted_reest(munich.fit)
# Get predicted values of estimated model on scale of linear predictors
predict(munich.fit, type = "link")
# Get predicted values of re-estimated model on scale of linear predictors
predict_reest(munich.fit, type = "link")
# Get deviance residuals of estimated model
residuals(munich.fit, type = "deviance")
# Get deviance residuals of re-estimated model
residuals_reest(munich.fit, type = "deviance")
......@@ -22,17 +22,7 @@ Function to extract the coefficients of the estimated model.
\code{coefficients} is an \emph{alias} for it.
}
\examples{
\dontrun{
# See example(glmsmurf) on how to obtain
# the fitted model in the munich.fit object
# Get coefficients of estimated model
coef(munich.fit)
# Get coefficients of re-estimated model
coef_reest(munich.fit)
}
## See example(glmsmurf) for examples
}
\seealso{
......
......@@ -30,17 +30,7 @@ Function to extract the coefficients of the re-estimated model.
\code{coefficients_reest} is an \emph{alias} for it.
}
\examples{
\dontrun{
# See example(glmsmurf) on how to obtain
# the fitted model in the munich.fit object
# Get coefficients of estimated model
coef(munich.fit)
# Get coefficients of re-estimated model
coef_reest(munich.fit)
}
## See example(glmsmurf) for examples
}
\seealso{
......
......@@ -18,17 +18,7 @@ The deviance of the estimated model in \code{object}.
Function to extract the deviance of the estimated model.
}
\examples{
\dontrun{
# See example(glmsmurf) on how to obtain
# the fitted model in the munich.fit object
# Get deviance of estimated model
deviance(munich.fit)
# Get deviance of re-estimated model
deviance_reest(munich.fit)
}
## See example(glmsmurf) for examples
}
\seealso{
......
......@@ -23,17 +23,7 @@ The deviance of the re-estimated model in \code{object},
Function to extract the deviance of the re-estimated model.
}
\examples{
\dontrun{
# See example(glmsmurf) on how to obtain
# the fitted model in the munich.fit object
# Get deviance of estimated model
deviance(munich.fit)
# Get deviance of re-estimated model
deviance_reest(munich.fit)
}
## See example(glmsmurf) for examples
}
\seealso{
......
......@@ -18,17 +18,7 @@ A vector containing the fitted values of the estimated model in \code{object}.
Function to extract the fitted values of the estimated model.
}
\examples{
\dontrun{
# See example(glmsmurf) on how to obtain
# the fitted model in the munich.fit object
# Get fitted values of estimated model
fitted(munich.fit)
# Get fitted values of re-estimated model
fitted_reest(munich.fit)
}
## See example(glmsmurf) for examples
}
\seealso{
......
......@@ -23,17 +23,7 @@ A vector containing the fitted values of the re-estimated model in \code{object}
Function to extract the fitted values of the re-estimated model.
}
\examples{
\dontrun{
# See example(glmsmurf) on how to obtain
# the fitted model in the munich.fit object
# Get fitted values of estimated model
fitted(munich.fit)
# Get fitted values of re-estimated model
fitted_reest(munich.fit)
}
## See example(glmsmurf) for examples
}
\seealso{
......
......@@ -184,14 +184,48 @@ munich.fit <- glmsmurf(formula = formu, family = gaussian(), data = rent,
pen.weights = "glm.stand", lambda = 0.008914)
####
# S3 methods for glmsmurf objects
# Model summary
summary(munich.fit)
# Get coefficients of estimated model
coef(munich.fit)
# Get coefficients of re-estimated model
coef_reest(munich.fit)
# Plot coefficients of estimated model
plot(munich.fit)
# Plot coefficients of re-estimated model
plot_reest(munich.fit)
# Model summary
summary(munich.fit)
# Get deviance of estimated model
deviance(munich.fit)
# Get deviance of re-estimated model
deviance_reest(munich.fit)
# Get fitted values of estimated model
fitted(munich.fit)
# Get fitted values of re-estimated model
fitted_reest(munich.fit)
# Get predicted values of estimated model on scale of linear predictors
predict(munich.fit, type = "link")
# Get predicted values of re-estimated model on scale of linear predictors
predict_reest(munich.fit, type = "link")
# Get deviance residuals of estimated model
residuals(munich.fit, type = "deviance")
# Get deviance residuals of re-estimated model
residuals_reest(munich.fit, type = "deviance")
}
\references{
Devriendt, S., Antonio, K., Reynkens, T. and Verbelen, R. (2018). "Sparse Regression with Multi-type Regularized Feature Modeling." \emph{arXiv:1810.03136}.
......
......@@ -30,17 +30,7 @@ A vector containing the predicted values using the estimated model in \code{obje
Function to obtain predictions using the estimated model.
}
\examples{
\dontrun{
# See example(glmsmurf) on how to obtain
# the fitted model in the munich.fit object
# Get predicted values of estimated model on scale of linear predictors
predict(munich.fit, type = "link")
# Get predicted values of re-estimated model on scale of linear predictors
predict_reest(munich.fit, type = "link")
}
## See example(glmsmurf) for examples
}
\seealso{
......
......@@ -35,17 +35,7 @@ A vector containing the predicted values using the re-estimated model in \code{o
Function to obtain predictions using the re-estimated model.
}
\examples{
\dontrun{
# See example(glmsmurf) on how to obtain
# the fitted model in the munich.fit object
# Get predicted values of estimated model on scale of linear predictors
predict(munich.fit, type = "link")
# Get predicted values of re-estimated model on scale of linear predictors
predict_reest(munich.fit, type = "link")
}
## See example(glmsmurf) for examples
}
\seealso{
......
......@@ -30,17 +30,7 @@ Function to extract the residuals of the estimated model.
See \code{\link[stats]{glm.summaries}} for an overview of the different types of residuals.
}
\examples{
\dontrun{
# See example(glmsmurf) on how to obtain
# the fitted model in the munich.fit object
# Get deviance residuals of estimated model
residuals(munich.fit, type = "deviance")
# Get deviance residuals of re-estimated model
residuals_reest(munich.fit, type = "deviance")
}
## See example(glmsmurf) for examples
}
\seealso{
......
......@@ -38,17 +38,7 @@ Function to extract the residuals of the re-estimated model.
See \code{\link[stats]{glm.summaries}} for an overview of the different types of residuals.
}
\examples{
\dontrun{
# See example(glmsmurf) on how to obtain
# the fitted model in the munich.fit object
# Get deviance residuals of estimated model
residuals(munich.fit, type = "deviance")
# Get deviance residuals of re-estimated model
residuals_reest(munich.fit, type = "deviance")
}
## See example(glmsmurf) for examples
}
\seealso{
......
......@@ -15,6 +15,10 @@
}
\description{
Function to print a summary of a \code{glmsmurf}-object.
}
\examples{
## See example(glmsmurf) for examples
}
\seealso{
\code{\link[stats]{summary.glm}}, \code{\link{glmsmurf}}, \code{\link{glmsmurf-class}}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment