RPModel: Generate pairs '(x,y)' from joint distribution

Description Usage Arguments Value Note Author(s) References Examples

View source: R/RPModel.R

Description

Generates data from the models described in Cannings and Samworth (2017)

Usage

1
RPModel(Model.No, n, p, Pi = 1/2)

Arguments

Model.No

Model Number

n

Sample size

p

Data dimension

Pi

Class one prior probability

Value

x

An n by p data matrix – n observations of the p-dimensional features

y

A vector of length n containing the classes (either 1 or 2)

Note

Models 1 and 2 require p = 100 or 1000.

Author(s)

Timothy I. Cannings and Richard J. Samworth

References

Cannings, T. I. and Samworth, R. J. (2017) Random-projection ensemble classification, J. Roy. Statist. Soc., Ser. B. (with discussion), 79, 959–1035

Examples

1
2
3
4
Data <- RPModel(Model.No = 1, 100, 100, Pi = 1/2)
table(Data$y)
colMeans(Data$x[Data$y==1,])
colMeans(Data$x[Data$y==2,])

Example output

Loading required package: distr
Loading required package: startupmsg
:startupmsg>  Utilities for Start-Up Messages (version 0.9.5)
:startupmsg> 
:startupmsg>  For more information see ?"startupmsg",
:startupmsg>  NEWS("startupmsg")

Loading required package: sfsmisc
:distr>  Object Oriented Implementation of Distributions (version
:distr>  2.7.0)
:distr> 
:distr>  Attention: Arithmetics on distribution objects are
:distr>  understood as operations on corresponding random variables
:distr>  (r.v.s); see distrARITH().
:distr> 
:distr>  Some functions from package 'stats' are intentionally masked
:distr>  ---see distrMASK().
:distr> 
:distr>  Note that global options are controlled by distroptions()
:distr>  ---c.f. ?"distroptions".
:distr> 
:distr>  For more information see ?"distr", NEWS("distr"), as well as
:distr>    http://distr.r-forge.r-project.org/
:distr>  Package "distrDoc" provides a vignette to this package as
:distr>  well as to several extension packages; try
:distr>  vignette("distr").


Attaching package: 'distr'

The following objects are masked from 'package:stats':

    df, qqplot, sd

Loading required package: MASS
Loading required package: parallel

 1  2 
61 39 
  [1]  0.0119947332  0.0510332659  0.1590717831  0.1830418189 -0.0711722811
  [6] -0.1130970293  0.0933819319  0.0228999900  0.0096110647  0.1373676268
 [11]  0.0366566667  0.0040569902 -0.1330047339  0.0020349122 -0.0221014242
 [16]  0.0508354261  0.1811367914 -0.0925240081 -0.0006197830 -0.1509164869
 [21]  0.1139643304 -0.3055091914 -0.2105998853 -0.0937465887  0.0607568087
 [26]  0.1393110919 -0.1869032093 -0.2102101190  0.1024629606  0.1034405207
 [31]  0.0757682340 -0.1874885136 -0.0634848723 -0.1637731065 -0.1722236844
 [36] -0.2205989774  0.2051735569  0.0415359651  0.1460512219  0.0880026419
 [41]  0.0383735578  0.0855443301  0.1306921297 -0.1473895196  0.1469851556
 [46] -0.0023875792  0.0923773597 -0.1158951981 -0.0313436628  0.1324893493
 [51]  0.1208967024 -0.1688344643 -0.0921436327 -0.0106199449  0.1201344354
 [56] -0.2587168553  0.1663287915  0.1327294775 -0.0215774834 -0.1946138412
 [61]  0.0422159956 -0.1333692799 -0.1176190608  0.1256613485  0.0478165895
 [66]  0.0390669877  0.1687684869  0.1119208658  0.0420495159 -0.1303947242
 [71]  0.1061554076 -0.0348732188 -0.0476625816 -0.1441211446 -0.0508293885
 [76] -0.1339392072  0.1012399415  0.0636749249 -0.1604447498  0.0002377705
 [81] -0.0163717939 -0.0399578097 -0.0080538247 -0.0663944411 -0.0931758572
 [86]  0.0473515729  0.1057585671 -0.1330226013  0.0776258304  0.0912275239
 [91] -0.0117743350 -0.0189731512 -0.0411646263  0.1489529072 -0.0431536557
 [96] -0.1093754384 -0.0211947583  0.1212217989 -0.1415964468  0.1556380061
  [1] -0.276996885  0.570214422 -0.095784924  0.232407278  0.071493187
  [6] -0.131790371 -0.179232657 -0.200011700 -0.092116627 -0.238336435
 [11]  0.084827247 -0.172371825  0.284196522  0.027876648  0.033454141
 [16] -0.082991613 -0.054834001  0.040992569  0.004458588 -0.258450864
 [21] -0.129039274  0.031359357 -0.219334128  0.076882636 -0.076077986
 [26] -0.338850666  0.034555522 -0.026697365  0.037390565  0.068716474
 [31]  0.055386336  0.120998912  0.081598532  0.163912593  0.418833553
 [36]  0.021467893 -0.023733204 -0.255455725 -0.137638762  0.084578199
 [41] -0.214212459 -0.110719504 -0.103214896  0.160816321  0.109807474
 [46]  0.187867915  0.065631707  0.100642537 -0.141244204 -0.311385574
 [51]  0.347398805  0.226788175 -0.095438901  0.086372849  0.174504907
 [56]  0.301842694 -0.129325460  0.108339480 -0.195986946  0.099511255
 [61] -0.022646672  0.251364804 -0.013896724  0.013397540  0.092205035
 [66] -0.210042213 -0.239593469 -0.425505845  0.085005517  0.120280365
 [71]  0.274875371 -0.094396774 -0.001632578  0.077291436 -0.159731266
 [76] -0.143335831  0.087795446 -0.133084119  0.107971204  0.097877657
 [81] -0.038903583  0.047310514  0.067972522 -0.041523569  0.043975250
 [86] -0.100989148  0.022942320 -0.303112048 -0.146812823 -0.055774178
 [91]  0.142424739  0.220657571 -0.144782748  0.049074338 -0.411607708
 [96] -0.078971154 -0.056463989 -0.239270554  0.024411648 -0.127567305

RPEnsemble documentation built on Feb. 24, 2021, 5:06 p.m.