Hey thanks!

I am now plotting a heat map, showing how the proportion of P-values (power) changes depending on the coefficient 3 and coefficient 4.

library(tidyverse)

n_people <- c(2:20)

coef1 <- 5

coef2 <- -0.05

coef3 <- 5

coef4 <- -0.02

distances <- c(60,90,135,202.5,303.75,455.625)

n_trials <- 60

oneto29 <- 29

oneto1000 <- 5

e <- 6

groupcategory = c(1,1,1,1,1,1,2,2,2,2,2,2)

x1 <- distances

z <- coef1 + coef2*x1

Datarray <- array(dim=c(length(coef3s), length(coef4s),length(n_people)))

coef3s <- c(1:11)

coef4s <- seq(from = -0.01, to = -0.1, length.out = 10)

coef3_counter =1

for (coef3 in coef3s) {

coef4_counter =1

for (coef4 in coef4s) {

z1 <- coef3 + coef4*x1

d = NULL

pr = 1/(1+exp(-z))

pr1 = 1/(1+exp(-z1))

```
counter=1
for (i in n_people) {
for (j in 1:oneto1000){
df <- c()
for (k in 1:i){
df <- rbind(df, data.frame(x1 = c(rep(distances, 2)),
y = c(rbinom(e,n_trials,pr), rbinom(e,n_trials,pr1)),
groupcategory = groupcategory, id = c(rep(k,12))))
# y = c(rbinom(e,n_trials,pr), rbinom(e,n_trials,pr1)),
#groupcategory = groupcategory, id = c(rep(k*2-1, 6), rep(k*2, 6))))
}
df_aov <- aov(y~x1*groupcategory+Error(id/(x1*groupcategory)),data=df)
df_aov_sum <- summary(df_aov)
pvalue <- df_aov_sum[[5]]
pvalue <- pvalue[[1]]["groupcategory","Pr(>F)"]
d = rbind(d,data.frame(pvalue))
}
count <- plyr::ldply(d,function(c) sum(c<=0.05))
Datarray[coef3_counter,coef4_counter,counter] <- count$V1/oneto1000
counter = counter +1
d = NULL
}
coef4_counter = coef4_counter + 1
```

}

coef3_counter = coef3_counter + 1

}

hv <- heatmap(object2, xlab = "Coef3", ylab = "Coef4",main = "Sample Size N=16",cex.axis=1.2)

I am unable to capp the legend values for my correlation matrix below: (?)

ggcorrplot(object2, aes(x=Coef3,y=Coef4), limits=FALSE)

It produces the correlation matrix, but the legend has values less than 0, and I only want it to have values 0 and above? Also, the y and x axis are also not labelling?

@FJCC