Commit 56a00fdb by Eric Coissac

Rename simulate_matrix rmatrix

parent f3382025
...@@ -34,8 +34,8 @@ export(pca) ...@@ -34,8 +34,8 @@ export(pca)
export(pcoa) export(pcoa)
export(procmod_frame) export(procmod_frame)
export(protate) export(protate)
export(rmatrix)
export(simulate_correlation) export(simulate_correlation)
export(simulate_matrix)
export(varls) export(varls)
import(MASS) import(MASS)
import(doParallel) import(doParallel)
......
...@@ -21,8 +21,8 @@ NULL ...@@ -21,8 +21,8 @@ NULL
#' #'
#' @examples #' @examples
#' # Renerate a random matrix of size 10 x 15 #' # Renerate a random matrix of size 10 x 15
#' m1 <- simulate_matrix(10, 15) #' m1 <- rmatrix(10, 15)
#' m2 <- simulate_matrix(10, 20) #' m2 <- rmatrix(10, 20)
#' mr <- protate(m1, m2) #' mr <- protate(m1, m2)
#' #'
#' @author Christelle Gonindard-Melodelima #' @author Christelle Gonindard-Melodelima
......
...@@ -17,14 +17,14 @@ ...@@ -17,14 +17,14 @@
#' @return a numeric matrix of \code{n} rows and \code{p} columns #' @return a numeric matrix of \code{n} rows and \code{p} columns
#' #'
#' @examples #' @examples
#' sim1 <- simulate_matrix(25,10) #' sim1 <- rmatrix(25,10)
#' class(sim1) #' class(sim1)
#' dim(sim1) #' dim(sim1)
#' #'
#' @author Eric Coissac #' @author Eric Coissac
#' @author Christelle Gonindard-Melodelima #' @author Christelle Gonindard-Melodelima
#' @export #' @export
simulate_matrix <- function(n, p, equal_var = TRUE) { rmatrix <- function(n, p, equal_var = TRUE) {
new <- rnorm(n * p, mean = 0, sd = 1) new <- rnorm(n * p, mean = 0, sd = 1)
dim(new) <- c(n, p) dim(new) <- c(n, p)
...@@ -63,7 +63,7 @@ simulate_matrix <- function(n, p, equal_var = TRUE) { ...@@ -63,7 +63,7 @@ simulate_matrix <- function(n, p, equal_var = TRUE) {
#' @return a numeric matrix of \code{nrow(reference)} rows and \code{p} columns #' @return a numeric matrix of \code{nrow(reference)} rows and \code{p} columns
#' #'
#' @examples #' @examples
#' sim1 <- simulate_matrix(25,10) #' sim1 <- rmatrix(25,10)
#' class(sim1) #' class(sim1)
#' dim(sim1) #' dim(sim1)
#' sim2 <- simulate_correlation(sim1,20,0.8) #' sim2 <- simulate_correlation(sim1,20,0.8)
...@@ -77,7 +77,7 @@ simulate_correlation <- function(reference, p, r2, equal_var = TRUE) { ...@@ -77,7 +77,7 @@ simulate_correlation <- function(reference, p, r2, equal_var = TRUE) {
n <- nrow(reference) n <- nrow(reference)
maxdim <- max(ncol(reference), p) maxdim <- max(ncol(reference), p)
noise <- simulate_matrix(n, p, equal_var = equal_var) noise <- rmatrix(n, p, equal_var = equal_var)
if (maxdim == p && maxdim > ncol(reference)) { if (maxdim == p && maxdim > ncol(reference)) {
# noise is the largest matrix # noise is the largest matrix
...@@ -111,4 +111,4 @@ simulate_correlation <- function(reference, p, r2, equal_var = TRUE) { ...@@ -111,4 +111,4 @@ simulate_correlation <- function(reference, p, r2, equal_var = TRUE) {
return(new) return(new)
} }
#simulate_matrix_tree #rmatrix_tree
...@@ -21,8 +21,8 @@ No scaling and no centrering are done, before computing the SVD. ...@@ -21,8 +21,8 @@ No scaling and no centrering are done, before computing the SVD.
} }
\examples{ \examples{
# Renerate a random matrix of size 10 x 15 # Renerate a random matrix of size 10 x 15
m1 <- simulate_matrix(10, 15) m1 <- rmatrix(10, 15)
m2 <- simulate_matrix(10, 20) m2 <- rmatrix(10, 20)
mr <- protate(m1, m2) mr <- protate(m1, m2)
} }
......
% Generated by roxygen2: do not edit by hand % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/simulate.R % Please edit documentation in R/simulate.R
\name{simulate_matrix} \name{rmatrix}
\alias{simulate_matrix} \alias{rmatrix}
\title{Simulate n points of dimension p.} \title{Simulate n points of dimension p.}
\usage{ \usage{
simulate_matrix(n, p, equal_var = TRUE) rmatrix(n, p, equal_var = TRUE)
} }
\arguments{ \arguments{
\item{n}{an \code{int} value indicating the number of observations.} \item{n}{an \code{int} value indicating the number of observations.}
...@@ -28,7 +28,7 @@ Therefore they are expected to be equal to 0 and reflect only the ...@@ -28,7 +28,7 @@ Therefore they are expected to be equal to 0 and reflect only the
random distribution of the covariance between two random vectors. random distribution of the covariance between two random vectors.
} }
\examples{ \examples{
sim1 <- simulate_matrix(25,10) sim1 <- rmatrix(25,10)
class(sim1) class(sim1)
dim(sim1) dim(sim1)
......
...@@ -35,7 +35,7 @@ The intensity of the correlation is determined by the \code{r2} ...@@ -35,7 +35,7 @@ The intensity of the correlation is determined by the \code{r2}
parameter. parameter.
} }
\examples{ \examples{
sim1 <- simulate_matrix(25,10) sim1 <- rmatrix(25,10)
class(sim1) class(sim1)
dim(sim1) dim(sim1)
sim2 <- simulate_correlation(sim1,20,0.8) sim2 <- simulate_correlation(sim1,20,0.8)
......
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