Skip to content

Commit

Permalink
Final (?) cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown authored and unknown committed Oct 13, 2015
1 parent 29e3760 commit c66c627
Show file tree
Hide file tree
Showing 25 changed files with 83 additions and 554 deletions.
8 changes: 5 additions & 3 deletions R/powerCurve.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ powerCurve <- function(
) {

opts <- simrOptions(...)
on.exit(simrOptions(opts))

# START TIMING
timing <- system.time({
Expand Down Expand Up @@ -102,7 +103,10 @@ powerCurve <- function(

ss_list <- llply(breaks, function(z) x %in% head(targets, z))

msg <- str_c("Calculating power at ", length(ss_list), " sample sizes for ", along)
msg <- if(along==".simr_repl") {
str_c("Calculating power at ", length(ss_list), " sample sizes within ", within)
} else str_c("Calculating power at ", length(ss_list), " sample sizes along ", along)

if(getSimrOption("progress")) message(msg)

simulations <- maybe_llply(seq_len(nsim), function(.) doSim(sim), .text="Simulating")
Expand Down Expand Up @@ -142,8 +146,6 @@ powerCurve <- function(

.simrLastResult $ lastResult <- rval

simrOptions(opts)

return(rval)
}

Expand Down
3 changes: 1 addition & 2 deletions R/powerSim.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ powerSim <- function(
) {

opts <- simrOptions(...)
on.exit(simrOptions(opts))

nsim <- getSimrOption("nsim")
alpha <- getSimrOption("alpha")
Expand Down Expand Up @@ -88,8 +89,6 @@ powerSim <- function(
# END TIMING
timing <- proc.time() - start

simrOptions(opts)

# structure the return value
rval <- list()

Expand Down
14 changes: 11 additions & 3 deletions drafts/paper.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ set.seed(123)
```

```{r options, echo=FALSE, message=FALSE}
simrOptions(nsim=50, progress=FALSE)
simrOptions(nsim=1000, progress=FALSE)
```

```{r knitr, echo=FALSE}
Expand Down Expand Up @@ -108,12 +108,20 @@ pc3 <- powerCurve(model3, along="g")
plot(pc3)
```
```{r}
print(pc3)
```
### Part 2
Power curve with larger groups.
```{r powercurve4, cache=TRUE, autodep=TRUE}
model4 <- extend(model1, within="x+g")
pc4 <- powerCurve(model4, within="x+g")
model4 <- extend(model1, within="x+g", n=5)
pc4 <- powerCurve(model4, within="x+g", breaks=1:5)
plot(pc4)
```
```{r}
print(pc4)
```
130 changes: 66 additions & 64 deletions drafts/paper.html

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed drafts/paper_files/figure-html/powercurve4a-1.pdf
Binary file not shown.
Binary file removed drafts/paper_files/figure-html/powercurve4a-1.png
Binary file not shown.
255 changes: 0 additions & 255 deletions drafts/paper_files/figure-html/powercurve4a-1.svg

This file was deleted.

Binary file removed drafts/paper_files/figure-html/powercurve4b-1.pdf
Binary file not shown.
Binary file removed drafts/paper_files/figure-html/powercurve4b-1.png
Binary file not shown.
227 changes: 0 additions & 227 deletions drafts/paper_files/figure-html/powercurve4b-1.svg

This file was deleted.

0 comments on commit c66c627

Please sign in to comment.