if (FALSE) {
dframe <- data.frame(
siteID = paste0("Site", 1:100),
wgt = runif(100, 10, 100),
xcoord = runif(100),
ycoord = runif(100),
stratum = rep(c("Stratum1", "Stratum2"), 50),
ContVar = rnorm(100, 10, 1),
All_Sites = rep("All Sites", 100),
Resource_Class = rep(c("Good", "Poor"), c(55, 45))
)
myvars <- c("ContVar")
mysubpops <- c("All_Sites", "Resource_Class")
mypopsize <- data.frame(
Resource_Class = c("Good", "Poor"),
Total = c(4000, 1500)
)
myanalysis <- cont_analysis(dframe,
vars = myvars, subpops = mysubpops,
siteID = "siteID", weight = "wgt", xcoord = "xcoord", ycoord = "ycoord",
stratumID = "stratum", popsize = mypopsize
)
keep <- with(myanalysis$CDF, Type == "Resource_Class" &
Subpopulation == "Good")
par(mfrow = c(2, 1))
cdf_plot(myanalysis$CDF[keep, ],
xlab = "ContVar",
ylab = "Percent of Stream Length", ylab_r = "Stream Length (km)",
main = "Estimates for Resource Class: Good"
)
cdf_plot(myanalysis$CDF[keep, ],
xlab = "ContVar",
ylab = "Percent of Stream Length", ylab_r = "Same",
main = "Estimates for Resource Class: Good"
)
}
Run the code above in your browser using DataLab