Skip to content

Commit

Permalink
clean up declared dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnMount committed Jul 11, 2016
1 parent 260d734 commit adb168e
Show file tree
Hide file tree
Showing 18 changed files with 171 additions and 325 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ Suggests:
knitr,
parallel,
rmarkdown,
dplyr
dplyr,
ggplot2
LazyData: true
VignetteBuilder: knitr
RoxygenNote: 5.0.1
21 changes: 2 additions & 19 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,8 @@
* using R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
* using platform: x86_64-apple-darwin14.5.0 (64-bit)

There were no ERRORs, or WARNINGSs.

There was one NOTE:

* checking for unstated dependencies in vignettes ... NOTE
'::' or ':::' import not declared from: ‘caret’
'library' or 'require' calls not declared from:
‘caret’ ‘ggplot2’


Both of the above calls are guarded by requireNamespace calls are are
there to illustrate how a user can use the additional caret or ggplot2
packages. caret and ggplot2 are not used (even optionally) in the
vtreat package, other than being also present in some unit tests
(again optional and to test things for users using caret or
data.table). These packages are deliberately not in suggests as the
vtreat package does not use them or even optionally alter its behavior
if they are available.

R CMD check results
0 errors | 0 warnings | 0 notes


Note_to_CRAN_maintainers
Expand Down
50 changes: 28 additions & 22 deletions inst/doc/vtreat.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<meta name="author" content="John Mount, Nina Zumel" />

<meta name="date" content="2016-06-27" />
<meta name="date" content="2016-07-11" />

<title>vtreat package</title>

Expand Down Expand Up @@ -70,7 +70,7 @@

<h1 class="title toc-ignore">vtreat package</h1>
<h4 class="author"><em>John Mount, Nina Zumel</em></h4>
<h4 class="date"><em>2016-06-27</em></h4>
<h4 class="date"><em>2016-07-11</em></h4>



Expand Down Expand Up @@ -138,13 +138,13 @@ <h2>A Categorical Outcome Example</h2>
## 3 c 30
## 4 &lt;NA&gt; NA</code></pre>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">treatmentsC &lt;-<span class="st"> </span><span class="kw">designTreatmentsC</span>(dTrainC,<span class="kw">colnames</span>(dTrainC),<span class="st">'y'</span>,<span class="ot">TRUE</span>)</code></pre></div>
<pre><code>## [1] &quot;desigining treatments Mon Jun 27 08:57:28 2016&quot;
## [1] &quot;design var x Mon Jun 27 08:57:28 2016&quot;
## [1] &quot;design var z Mon Jun 27 08:57:28 2016&quot;
## [1] &quot;scoring treatments Mon Jun 27 08:57:28 2016&quot;
## [1] &quot;have treatment plan Mon Jun 27 08:57:28 2016&quot;
## [1] &quot;rescoring complex variables Mon Jun 27 08:57:28 2016&quot;
## [1] &quot;done rescoring complex variables Mon Jun 27 08:57:28 2016&quot;</code></pre>
<pre><code>## [1] &quot;desigining treatments Mon Jul 11 10:06:51 2016&quot;
## [1] &quot;design var x Mon Jul 11 10:06:51 2016&quot;
## [1] &quot;design var z Mon Jul 11 10:06:51 2016&quot;
## [1] &quot;scoring treatments Mon Jul 11 10:06:51 2016&quot;
## [1] &quot;have treatment plan Mon Jul 11 10:06:51 2016&quot;
## [1] &quot;rescoring complex variables Mon Jul 11 10:06:51 2016&quot;
## [1] &quot;done rescoring complex variables Mon Jul 11 10:06:51 2016&quot;</code></pre>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">print</span>(treatmentsC)</code></pre></div>
<pre><code>## $treatments
## $treatments[[1]]
Expand Down Expand Up @@ -184,15 +184,18 @@ <h2>A Categorical Outcome Example</h2>
## $outcomename
## [1] &quot;y&quot;
##
## $vtreatVersion
## [1] '0.5.26'
##
## $splitmethod
## [1] &quot;oneway&quot;
##
## $outcomeTarget
## [1] TRUE
##
## $outcomeType
## [1] &quot;Binary&quot;
##
## $vtreatVersion
## [1] '0.5.26'
##
## attr(,&quot;class&quot;)
## [1] &quot;treatmentplan&quot;</code></pre>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">print</span>(treatmentsC$treatments[[<span class="dv">1</span>]])</code></pre></div>
Expand Down Expand Up @@ -259,13 +262,13 @@ <h2>A Numeric Outcome Example</h2>
## 3 c 30
## 4 &lt;NA&gt; NA</code></pre>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">treatmentsN =<span class="st"> </span><span class="kw">designTreatmentsN</span>(dTrainN,<span class="kw">colnames</span>(dTrainN),<span class="st">'y'</span>)</code></pre></div>
<pre><code>## [1] &quot;desigining treatments Mon Jun 27 08:57:28 2016&quot;
## [1] &quot;design var x Mon Jun 27 08:57:28 2016&quot;
## [1] &quot;design var z Mon Jun 27 08:57:28 2016&quot;
## [1] &quot;scoring treatments Mon Jun 27 08:57:28 2016&quot;
## [1] &quot;have treatment plan Mon Jun 27 08:57:28 2016&quot;
## [1] &quot;rescoring complex variables Mon Jun 27 08:57:28 2016&quot;
## [1] &quot;done rescoring complex variables Mon Jun 27 08:57:28 2016&quot;</code></pre>
<pre><code>## [1] &quot;desigining treatments Mon Jul 11 10:06:51 2016&quot;
## [1] &quot;design var x Mon Jul 11 10:06:51 2016&quot;
## [1] &quot;design var z Mon Jul 11 10:06:51 2016&quot;
## [1] &quot;scoring treatments Mon Jul 11 10:06:51 2016&quot;
## [1] &quot;have treatment plan Mon Jul 11 10:06:51 2016&quot;
## [1] &quot;rescoring complex variables Mon Jul 11 10:06:51 2016&quot;
## [1] &quot;done rescoring complex variables Mon Jul 11 10:06:51 2016&quot;</code></pre>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">print</span>(treatmentsN)</code></pre></div>
<pre><code>## $treatments
## $treatments[[1]]
Expand Down Expand Up @@ -310,12 +313,15 @@ <h2>A Numeric Outcome Example</h2>
## $outcomename
## [1] &quot;y&quot;
##
## $outcomeType
## [1] &quot;Numeric&quot;
##
## $vtreatVersion
## [1] '0.5.26'
##
## $splitmethod
## [1] &quot;oneway&quot;
##
## $outcomeType
## [1] &quot;Numeric&quot;
##
## attr(,&quot;class&quot;)
## [1] &quot;treatmentplan&quot;</code></pre>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">dTrainNTreated &lt;-<span class="st"> </span><span class="kw">prepare</span>(treatmentsN,dTrainN,
Expand Down
44 changes: 22 additions & 22 deletions inst/doc/vtreatCrossFrames.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<meta name="author" content="John Mount, Nina Zumel" />

<meta name="date" content="2016-06-27" />
<meta name="date" content="2016-07-11" />

<title>vtreat cross frames</title>

Expand Down Expand Up @@ -70,7 +70,7 @@

<h1 class="title toc-ignore">vtreat cross frames</h1>
<h4 class="author"><em>John Mount, Nina Zumel</em></h4>
<h4 class="date"><em>2016-06-27</em></h4>
<h4 class="date"><em>2016-07-11</em></h4>



Expand Down Expand Up @@ -117,16 +117,16 @@ <h2>The Wrong Way</h2>
<span class="st">'y'</span>,<span class="ot">TRUE</span>,
<span class="dt">rareCount=</span><span class="dv">0</span> <span class="co"># Note: usually want rareCount&gt;0, setting to zero to illustrate problem</span>
)</code></pre></div>
<pre><code>## [1] &quot;desigining treatments Mon Jun 27 08:57:29 2016&quot;
## [1] &quot;design var xBad1 Mon Jun 27 08:57:29 2016&quot;
## [1] &quot;design var xBad2 Mon Jun 27 08:57:29 2016&quot;
## [1] &quot;design var xBad3 Mon Jun 27 08:57:29 2016&quot;
## [1] &quot;design var xGood1 Mon Jun 27 08:57:29 2016&quot;
## [1] &quot;design var xGood2 Mon Jun 27 08:57:29 2016&quot;
## [1] &quot;scoring treatments Mon Jun 27 08:57:29 2016&quot;
## [1] &quot;have treatment plan Mon Jun 27 08:57:29 2016&quot;
## [1] &quot;rescoring complex variables Mon Jun 27 08:57:29 2016&quot;
## [1] &quot;done rescoring complex variables Mon Jun 27 08:57:29 2016&quot;</code></pre>
<pre><code>## [1] &quot;desigining treatments Mon Jul 11 10:06:52 2016&quot;
## [1] &quot;design var xBad1 Mon Jul 11 10:06:52 2016&quot;
## [1] &quot;design var xBad2 Mon Jul 11 10:06:52 2016&quot;
## [1] &quot;design var xBad3 Mon Jul 11 10:06:52 2016&quot;
## [1] &quot;design var xGood1 Mon Jul 11 10:06:52 2016&quot;
## [1] &quot;design var xGood2 Mon Jul 11 10:06:52 2016&quot;
## [1] &quot;scoring treatments Mon Jul 11 10:06:52 2016&quot;
## [1] &quot;have treatment plan Mon Jul 11 10:06:52 2016&quot;
## [1] &quot;rescoring complex variables Mon Jul 11 10:06:52 2016&quot;
## [1] &quot;done rescoring complex variables Mon Jul 11 10:06:52 2016&quot;</code></pre>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">dTrainTreated &lt;-<span class="st"> </span>vtreat::<span class="kw">prepare</span>(treatments,dTrain,
<span class="dt">pruneSig=</span><span class="kw">c</span>() <span class="co"># Note: usually want pruneSig to be a small fraction, setting to null to illustrate problems</span>
)
Expand Down Expand Up @@ -195,16 +195,16 @@ <h2>The Right Way: A Calibration Set</h2>
<span class="st">'y'</span>,<span class="ot">TRUE</span>,
<span class="dt">rareCount=</span><span class="dv">0</span> <span class="co"># Note: usually want rareCount&gt;0, setting to zero to illustrate problem</span>
)</code></pre></div>
<pre><code>## [1] &quot;desigining treatments Mon Jun 27 08:57:29 2016&quot;
## [1] &quot;design var xBad1 Mon Jun 27 08:57:29 2016&quot;
## [1] &quot;design var xBad2 Mon Jun 27 08:57:29 2016&quot;
## [1] &quot;design var xBad3 Mon Jun 27 08:57:29 2016&quot;
## [1] &quot;design var xGood1 Mon Jun 27 08:57:30 2016&quot;
## [1] &quot;design var xGood2 Mon Jun 27 08:57:30 2016&quot;
## [1] &quot;scoring treatments Mon Jun 27 08:57:30 2016&quot;
## [1] &quot;have treatment plan Mon Jun 27 08:57:30 2016&quot;
## [1] &quot;rescoring complex variables Mon Jun 27 08:57:30 2016&quot;
## [1] &quot;done rescoring complex variables Mon Jun 27 08:57:30 2016&quot;</code></pre>
<pre><code>## [1] &quot;desigining treatments Mon Jul 11 10:06:52 2016&quot;
## [1] &quot;design var xBad1 Mon Jul 11 10:06:52 2016&quot;
## [1] &quot;design var xBad2 Mon Jul 11 10:06:52 2016&quot;
## [1] &quot;design var xBad3 Mon Jul 11 10:06:52 2016&quot;
## [1] &quot;design var xGood1 Mon Jul 11 10:06:53 2016&quot;
## [1] &quot;design var xGood2 Mon Jul 11 10:06:53 2016&quot;
## [1] &quot;scoring treatments Mon Jul 11 10:06:53 2016&quot;
## [1] &quot;have treatment plan Mon Jul 11 10:06:53 2016&quot;
## [1] &quot;rescoring complex variables Mon Jul 11 10:06:53 2016&quot;
## [1] &quot;done rescoring complex variables Mon Jul 11 10:06:53 2016&quot;</code></pre>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">dTrainTreated &lt;-<span class="st"> </span>vtreat::<span class="kw">prepare</span>(treatments,dTrain,
<span class="dt">pruneSig=</span>pruneSig)
newvars &lt;-<span class="st"> </span><span class="kw">setdiff</span>(<span class="kw">colnames</span>(dTrainTreated),<span class="st">'y'</span>)
Expand Down
11 changes: 4 additions & 7 deletions inst/doc/vtreatGrouping.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
knitr::opts_chunk$set(fig.width = 7)

## ----echo=FALSE, message=FALSE, warning=FALSE----------------------------
library(vtreat)
set.seed(23255)

have_ggplot = requireNamespace("ggplot2", quietly=TRUE)
have_dplyr = requireNamespace("dplyr", quietly=TRUE)
if(have_ggplot) {
Expand All @@ -11,11 +14,7 @@ if(have_dplyr) {
library(dplyr)
}


library(vtreat)
set.seed(23255)

## ----functions, echo=FALSE-----------------------------------------------
## ----echo=FALSE, message=FALSE, warning=FALSE----------------------------
#
# takes the frame (d) and the outcome column (d$conc)
# from the global environment
Expand Down Expand Up @@ -49,8 +48,6 @@ showGroupingBehavior = function(groupcol, title) {
}
}



## ----data----------------------------------------------------------------
# panel data for concentration in multiple subjects
d <- datasets::Theoph
Expand Down
15 changes: 6 additions & 9 deletions inst/doc/vtreatGrouping.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ knitr::opts_chunk$set(fig.width = 7)
```

```{r echo=FALSE, message=FALSE, warning=FALSE}
library(vtreat)
set.seed(23255)
have_ggplot = requireNamespace("ggplot2", quietly=TRUE)
have_dplyr = requireNamespace("dplyr", quietly=TRUE)
if(have_ggplot) {
Expand All @@ -22,15 +25,9 @@ if(have_ggplot) {
if(have_dplyr) {
library(dplyr)
}
library(vtreat)
set.seed(23255)
```

This vignette shows an example use of _y_-stratified sampling with a grouping restriction in `vtreat`.

```{r functions, echo=FALSE}
```{r echo=FALSE, message=FALSE, warning=FALSE}
#
# takes the frame (d) and the outcome column (d$conc)
# from the global environment
Expand Down Expand Up @@ -63,10 +60,10 @@ showGroupingBehavior = function(groupcol, title) {
print(plt)
}
}
```

This vignette shows an example use of _y_-stratified sampling with a grouping restriction in `vtreat`.

For this example, we will use the `Theosph` dataset: data from an experiment on the pharmacokinetics of theophylline. We will demonstrate the desired effects of _y_-stratification while also respecting a grouping constraint.

## The Data
Expand Down
50 changes: 25 additions & 25 deletions inst/doc/vtreatGrouping.html

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions inst/doc/vtreatOverfit.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<meta name="author" content="John Mount, Nina Zumel" />

<meta name="date" content="2016-06-27" />
<meta name="date" content="2016-07-11" />

<title>vtreat overfit</title>

Expand Down Expand Up @@ -70,7 +70,7 @@

<h1 class="title toc-ignore">vtreat overfit</h1>
<h4 class="author"><em>John Mount, Nina Zumel</em></h4>
<h4 class="date"><em>2016-06-27</em></h4>
<h4 class="date"><em>2016-07-11</em></h4>



Expand All @@ -96,12 +96,12 @@ <h2>Bad Practice: Using the same data to treat and to train</h2>
treatments &lt;-<span class="st"> </span>vtreat::<span class="kw">designTreatmentsC</span>(dTrain,<span class="st">'x'</span>,<span class="st">'y'</span>,<span class="ot">TRUE</span>,
<span class="dt">rareCount=</span><span class="dv">0</span> <span class="co"># Note: usually want rareCount&gt;0, setting to zero to illustrate problem</span>
)</code></pre></div>
<pre><code>## [1] &quot;desigining treatments Mon Jun 27 08:57:33 2016&quot;
## [1] &quot;design var x Mon Jun 27 08:57:33 2016&quot;
## [1] &quot;scoring treatments Mon Jun 27 08:57:33 2016&quot;
## [1] &quot;have treatment plan Mon Jun 27 08:57:33 2016&quot;
## [1] &quot;rescoring complex variables Mon Jun 27 08:57:33 2016&quot;
## [1] &quot;done rescoring complex variables Mon Jun 27 08:57:33 2016&quot;</code></pre>
<pre><code>## [1] &quot;desigining treatments Mon Jul 11 10:06:56 2016&quot;
## [1] &quot;design var x Mon Jul 11 10:06:56 2016&quot;
## [1] &quot;scoring treatments Mon Jul 11 10:06:56 2016&quot;
## [1] &quot;have treatment plan Mon Jul 11 10:06:56 2016&quot;
## [1] &quot;rescoring complex variables Mon Jul 11 10:06:56 2016&quot;
## [1] &quot;done rescoring complex variables Mon Jul 11 10:06:56 2016&quot;</code></pre>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">dTrainTreated &lt;-<span class="st"> </span>vtreat::<span class="kw">prepare</span>(treatments,dTrain,
<span class="dt">pruneSig=</span><span class="kw">c</span>() <span class="co"># Note: usually want pruneSig to be a small fraction, setting to null to illustrate problem</span>
)
Expand Down Expand Up @@ -193,12 +193,12 @@ <h2>Correct Practice: Use different data to treat and train</h2>
<span class="dt">rareCount=</span><span class="dv">0</span>, <span class="co"># Note set this to something larger, like 5</span>
<span class="dt">rareSig=</span><span class="kw">c</span>() <span class="co"># Note set this to something like 0.3</span>
)</code></pre></div>
<pre><code>## [1] &quot;desigining treatments Mon Jun 27 08:57:33 2016&quot;
## [1] &quot;design var x Mon Jun 27 08:57:33 2016&quot;
## [1] &quot;scoring treatments Mon Jun 27 08:57:34 2016&quot;
## [1] &quot;have treatment plan Mon Jun 27 08:57:34 2016&quot;
## [1] &quot;rescoring complex variables Mon Jun 27 08:57:34 2016&quot;
## [1] &quot;done rescoring complex variables Mon Jun 27 08:57:34 2016&quot;</code></pre>
<pre><code>## [1] &quot;desigining treatments Mon Jul 11 10:06:56 2016&quot;
## [1] &quot;design var x Mon Jul 11 10:06:56 2016&quot;
## [1] &quot;scoring treatments Mon Jul 11 10:06:56 2016&quot;
## [1] &quot;have treatment plan Mon Jul 11 10:06:56 2016&quot;
## [1] &quot;rescoring complex variables Mon Jul 11 10:06:56 2016&quot;
## [1] &quot;done rescoring complex variables Mon Jul 11 10:06:56 2016&quot;</code></pre>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">dTrainTreated &lt;-<span class="st"> </span>vtreat::<span class="kw">prepare</span>(treatments,dTrain,
<span class="dt">pruneSig=</span><span class="kw">c</span>() <span class="co"># Note: set this to filter, like 0.05 or 1/nvars</span>
)
Expand Down
4 changes: 2 additions & 2 deletions inst/doc/vtreatScaleMode.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<meta name="author" content="Win-Vector LLC" />

<meta name="date" content="2016-06-27" />
<meta name="date" content="2016-07-11" />

<title>vtreat scale mode</title>

Expand Down Expand Up @@ -70,7 +70,7 @@

<h1 class="title toc-ignore">vtreat scale mode</h1>
<h4 class="author"><em>Win-Vector LLC</em></h4>
<h4 class="date"><em>2016-06-27</em></h4>
<h4 class="date"><em>2016-07-11</em></h4>



Expand Down
18 changes: 9 additions & 9 deletions inst/doc/vtreatSignificance.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<meta name="author" content="John Mount, Nina Zumel" />

<meta name="date" content="2016-06-27" />
<meta name="date" content="2016-07-11" />

<title>vtreat significance</title>

Expand Down Expand Up @@ -70,7 +70,7 @@

<h1 class="title toc-ignore">vtreat significance</h1>
<h4 class="author"><em>John Mount, Nina Zumel</em></h4>
<h4 class="date"><em>2016-06-27</em></h4>
<h4 class="date"><em>2016-07-11</em></h4>



Expand Down Expand Up @@ -119,13 +119,13 @@ <h4 class="date"><em>2016-06-27</em></h4>
## 2 FALSE lev002 lev002F
## 252 FALSE lev002 lev002F</code></pre>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">treatmentsC &lt;-<span class="st"> </span>vtreat::<span class="kw">designTreatmentsC</span>(d,<span class="kw">c</span>(<span class="st">'catVarNoise'</span>,<span class="st">'catVarPerfect'</span>),<span class="st">'y'</span>,<span class="ot">TRUE</span>)</code></pre></div>
<pre><code>## [1] &quot;desigining treatments Mon Jun 27 08:57:35 2016&quot;
## [1] &quot;design var catVarNoise Mon Jun 27 08:57:35 2016&quot;
## [1] &quot;design var catVarPerfect Mon Jun 27 08:57:35 2016&quot;
## [1] &quot;scoring treatments Mon Jun 27 08:57:35 2016&quot;
## [1] &quot;have treatment plan Mon Jun 27 08:57:35 2016&quot;
## [1] &quot;rescoring complex variables Mon Jun 27 08:57:35 2016&quot;
## [1] &quot;done rescoring complex variables Mon Jun 27 08:57:35 2016&quot;</code></pre>
<pre><code>## [1] &quot;desigining treatments Mon Jul 11 10:06:57 2016&quot;
## [1] &quot;design var catVarNoise Mon Jul 11 10:06:57 2016&quot;
## [1] &quot;design var catVarPerfect Mon Jul 11 10:06:57 2016&quot;
## [1] &quot;scoring treatments Mon Jul 11 10:06:57 2016&quot;
## [1] &quot;have treatment plan Mon Jul 11 10:06:57 2016&quot;
## [1] &quot;rescoring complex variables Mon Jul 11 10:06:57 2016&quot;
## [1] &quot;done rescoring complex variables Mon Jul 11 10:06:58 2016&quot;</code></pre>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="co"># Estimate effect significance (not coeficient significance).</span>
estSigGLM &lt;-<span class="st"> </span>function(xVar,yVar,<span class="dt">numberOfHiddenDegrees=</span><span class="dv">0</span>) {
d &lt;-<span class="st"> </span><span class="kw">data.frame</span>(<span class="dt">x=</span>xVar,<span class="dt">y=</span>yVar,<span class="dt">stringsAsFactors =</span> <span class="ot">FALSE</span>)
Expand Down

0 comments on commit adb168e

Please sign in to comment.