Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added road distance adjacency matrix functionality #1

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata
*.Rproj.user
*.Rhistory
*.RData
*.Ruserdata
10 changes: 6 additions & 4 deletions R/INAscene.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#'
#' This function implements and summarizes multiple simulations across a designated range of parameter values
#'
#' Updated 2020-10-13
#' Updated 2021-10-22

#' @param nreals number of realizations to be evaluated
#' @param ntimesteps number of time steps to be evaluated
Expand All @@ -12,6 +12,8 @@

#' @param readgeocoords if T, read in geocoords - otherwise, generate it in each realization
#' @param geocoords matrix of x,y coordinates of nodes
#' @param roaddistfilepath filepath to a R Data (.RData extension) file containing an adjacency matrix with the distances via the road network between nodes in geocoords - mutually exclusive with roadtimefilepath
#' @param roadtimefilepath filepath to a R Data (.RData extension) file containing an adjacency matrix with the travel times via the road network between nodes in geocoords - mutually exclusive with roaddistfilepath

#' @param numnodes (genlocs) the number of nodes, can be a vector of different numbers of nodes for scenario comparisons (numnodes can be entered as a vector to evaluate multiple scenarios)
#' @param xrange (genlocs) range of x coordinates, e.g., c(0,50)
Expand Down Expand Up @@ -107,7 +109,7 @@



INAscene <- function(nreals, ntimesteps, doplot=F, outputvol='more', readgeocoords, geocoords=NA, numnodes=NA, xrange=NA, yrange=NA, randgeo=NA, readinitinfo, initinfo=NA, initinfo.norp=NA, initinfo.n=NA, initinfo.p=NA, initinfo.dist=NA, readinitbio, initbio=NA, initbio.norp=NA, initbio.n=NA, initbio.p=NA, initbio.dist=NA, readseam, seam=NA, seamdist=NA, seamrandp=NA, seampla=NA, seamplb=NA, readbpam, bpam=NA, bpamdist=NA, bpamrandp=NA, bpampla=NA, bpamplb=NA, readprobadoptvec, probadoptvec=NA, probadoptmean=NA, probadoptsd=NA, readprobestabvec, probestabvec=NA, probestabmean=NA, probestabsd=NA, maneffdir=NA, maneffmean=NA, maneffsd=NA, usethreshman, maneffthresh=NA, sampeffort=NA) {
INAscene <- function(nreals, ntimesteps, doplot=F, outputvol='more', readgeocoords, geocoords=NA, roaddistfilepath=NA, roadtimefilepath=NA, numnodes=NA, xrange=NA, yrange=NA, randgeo=NA, readinitinfo, initinfo=NA, initinfo.norp=NA, initinfo.n=NA, initinfo.p=NA, initinfo.dist=NA, readinitbio, initbio=NA, initbio.norp=NA, initbio.n=NA, initbio.p=NA, initbio.dist=NA, readseam, seam=NA, seamdist=NA, seamrandp=NA, seampla=NA, seamplb=NA, readbpam, bpam=NA, bpamdist=NA, bpamrandp=NA, bpampla=NA, bpamplb=NA, readprobadoptvec, probadoptvec=NA, probadoptmean=NA, probadoptsd=NA, readprobestabvec, probestabvec=NA, probestabmean=NA, probestabsd=NA, maneffdir=NA, maneffmean=NA, maneffsd=NA, usethreshman, maneffthresh=NA, sampeffort=NA) {

### error message(s)

Expand Down Expand Up @@ -311,7 +313,7 @@ for (j22 in 1:ncombs) {
}


temp <- multsame2(nreals2=nreals, ntimesteps2=ntimesteps, doplot2=doplot, readgeocoords2=readgeocoords, geocoords2=geocoords, numnodes2=numnodes, xrange2=xrange, yrange2=yrange, randgeo2=randgeo, readinitinfo2=readinitinfo, initinfo2=initinfo, initinfo.norp2=initinfo.norp, initinfo.n2=initinfo.n, initinfo.p2=initinfo.p, initinfo.dist2=initinfo.dist, readinitbio2=readinitbio, initbio2=initbio, initbio.norp2=initbio.norp, initbio.n2=initbio.n, initbio.p2=initbio.p, initbio.dist2=initbio.dist, readseam2=readseam, seam2=seam, seamdist2=seamdist, seamrandp2=seamrandp, seampla2=seampla, seamplb2=seamplb, readbpam2=readbpam, bpam2=bpam, bpamdist2=bpamdist, bpamrandp2=bpamrandp, bpampla2=bpampla, bpamplb2=bpamplb, readprobadoptvec2=readprobadoptvec, probadoptvec2=probadoptvec, probadoptmean2=probadoptmean, probadoptsd2=probadoptsd, readprobestabvec2=readprobestabvec, probestabvec2=probestabvec, probestabmean2=probestabmean, probestabsd2=probestabsd, maneffdir2=maneffdir, maneffmean2=maneffmean, maneffsd2=maneffsd, usethreshman2=usethreshman, maneffthresh2=maneffthresh, sampeffort2=sampeffort)
temp <- multsame2(nreals2=nreals, ntimesteps2=ntimesteps, doplot2=doplot, readgeocoords2=readgeocoords, geocoords2=geocoords, roaddistfilepath2=roaddistfilepath, roadtimefilepath2=roadtimefilepath, numnodes2=numnodes, xrange2=xrange, yrange2=yrange, randgeo2=randgeo, readinitinfo2=readinitinfo, initinfo2=initinfo, initinfo.norp2=initinfo.norp, initinfo.n2=initinfo.n, initinfo.p2=initinfo.p, initinfo.dist2=initinfo.dist, readinitbio2=readinitbio, initbio2=initbio, initbio.norp2=initbio.norp, initbio.n2=initbio.n, initbio.p2=initbio.p, initbio.dist2=initbio.dist, readseam2=readseam, seam2=seam, seamdist2=seamdist, seamrandp2=seamrandp, seampla2=seampla, seamplb2=seamplb, readbpam2=readbpam, bpam2=bpam, bpamdist2=bpamdist, bpamrandp2=bpamrandp, bpampla2=bpampla, bpamplb2=bpamplb, readprobadoptvec2=readprobadoptvec, probadoptvec2=probadoptvec, probadoptmean2=probadoptmean, probadoptsd2=probadoptsd, readprobestabvec2=readprobestabvec, probestabvec2=probestabvec, probestabmean2=probestabmean, probestabsd2=probestabsd, maneffdir2=maneffdir, maneffmean2=maneffmean, maneffsd2=maneffsd, usethreshman2=usethreshman, maneffthresh2=maneffthresh, sampeffort2=sampeffort)


multdetails[[rowcount]] <- temp
Expand Down Expand Up @@ -342,4 +344,4 @@ if (outputvol=='more') {
list(multout=multout)
}

}
}
327 changes: 327 additions & 0 deletions R/cities.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,327 @@
id,lon,lat
NewYork[d],-73.93,40.66
LosAngeles,-118.41,34.01
Chicago,-87.68,41.83
Houston,-95.39,29.78
Phoenix,-112.09,33.57
Philadelphia[e],-75.13,40
SanAntonio,-98.52,29.47
SanDiego,-117.13,32.81
Dallas,-96.76,32.79
SanJose,-121.81,37.29
Austin,-97.75,30.3
Jacksonville[f],-81.66,30.33
FortWorth,-97.34,32.78
Columbus,-82.98,39.98
Indianapolis[g],-86.14,39.77
Charlotte,-80.83,35.2
SanFrancisco[h],-123.03,37.72
Seattle,-122.35,47.62
Denver[i],-104.88,39.76
Washington[j],-77.01,38.9
Nashville[k],-86.78,36.17
OklahomaCity,-97.51,35.46
ElPaso,-106.42,31.84
Boston,-71.02,42.33
Portland,-122.65,45.53
LasVegas,-115.26,36.22
Detroit,-83.1,42.38
Memphis,-89.97,35.1
Louisville[l],-85.64,38.16
Baltimore[m],-76.61,39.3
Milwaukee,-87.96,43.06
Albuquerque,-106.64,35.1
Tucson,-110.87,32.15
Fresno,-119.79,36.78
Sacramento,-121.46,38.56
KansasCity,-94.55,39.12
Mesa,-111.71,33.4
Atlanta,-84.42,33.76
Omaha,-96.04,41.26
ColoradoSprings,-104.76,38.86
Raleigh,-78.64,35.83
LongBeach,-118.15,33.8
VirginiaBeach[m],-76.02,36.78
Miami,-80.2,25.77
Oakland,-122.22,37.76
Minneapolis,-93.26,44.96
Tulsa,-95.9,36.12
Bakersfield,-119.01,35.32
Wichita,-97.34,37.69
Arlington,-97.12,32.7
Aurora,-104.68,39.68
Tampa,-82.47,27.97
NewOrleans[n],-89.93,30.05
Cleveland,-81.67,41.47
Honolulu[b],-157.84,21.32
Anaheim,-117.76,33.85
Lexington[o],-84.45,38.04
Stockton,-121.31,37.97
CorpusChristi,-97.17,27.75
Henderson,-115.03,36
Riverside,-117.39,33.93
Newark,-74.17,40.72
SaintPaul,-93.1,44.94
SantaAna,-117.88,33.73
Cincinnati,-84.5,39.14
Irvine,-117.77,33.67
Orlando,-81.27,28.41
Pittsburgh,-79.97,40.43
St.Louis[m],-90.24,38.63
Greensboro,-79.82,36.09
JerseyCity,-74.06,40.71
Anchorage[p],-149.28,61.17
Lincoln,-96.68,40.81
Plano,-96.74,33.05
Durham,-78.9,35.98
Buffalo,-78.85,42.89
Chandler,-111.85,33.28
ChulaVista,-117.01,32.62
Toledo,-83.58,41.66
Madison,-89.42,43.08
Gilbert[q],-111.74,33.31
Reno,-119.84,39.54
FortWayne,-85.14,41.08
NorthLasVegas,-115.09,36.28
St.Petersburg,-82.64,27.76
Lubbock,-101.88,33.56
Irving,-96.97,32.85
Laredo,-99.48,27.56
WinstonSalem,-80.26,36.1
Chesapeake[m],-76.3,36.67
Glendale,-112.18,33.53
Garland,-96.63,32.9
Scottsdale,-111.86,33.68
Norfolk[m],-76.24,36.92
Boise[r],-116.23,43.6
Fremont,-121.94,37.49
Spokane,-117.43,47.66
SantaClarita,-118.5,34.4
BatonRouge[s],-91.13,30.44
Richmond[m],-77.47,37.53
Hialeah,-80.3,25.86
SanBernardino,-117.29,34.14
Tacoma,-122.45,47.25
Modesto,-121,37.63
Huntsville,-86.67,34.69
DesMoines,-93.61,41.57
Yonkers,-73.86,40.94
Rochester,-77.61,43.16
MorenoValley,-117.2,33.92
Fayetteville,-78.97,35.08
Fontana,-117.46,34.1
Columbus[t],-84.87,32.51
Worcester,-71.8,42.26
PortSt.Lucie,-80.38,27.28
LittleRock,-92.35,34.72
Augusta[u],-82.07,33.36
Oxnard,-119.2,34.2
Birmingham,-86.79,33.52
Montgomery,-86.26,32.34
Frisco,-96.82,33.15
Amarillo,-101.83,35.19
SaltLakeCity,-111.93,40.77
GrandRapids,-85.65,42.96
HuntingtonBeach,-118,33.69
OverlandPark,-94.69,38.88
Glendale,-118.24,34.18
Tallahassee,-84.25,30.45
GrandPrairie,-97.02,32.68
McKinney,-96.66,33.19
CapeCoral,-81.99,26.64
SiouxFalls,-96.73,43.53
Peoria,-112.3,33.78
Providence,-71.41,41.82
Vancouver,-122.59,45.63
Knoxville,-83.94,35.97
Akron,-81.52,41.08
Shreveport,-93.79,32.46
Mobile,-88.1,30.66
Brownsville,-97.45,25.99
NewportNews[m],-76.52,37.07
FortLauderdale,-80.14,26.14
Chattanooga,-85.24,35.06
Tempe,-111.93,33.38
Aurora,-88.29,41.76
SantaRosa,-122.7,38.44
Eugene,-123.11,44.05
ElkGrove,-121.38,38.41
Salem,-123.02,44.92
Ontario,-117.6,34.03
Cary[v],-78.81,35.78
RanchoCucamonga,-117.56,34.12
Oceanside,-117.3,33.22
Lancaster,-118.17,34.69
GardenGrove,-117.96,33.77
PembrokePines,-80.34,26.02
FortCollins,-105.06,40.54
Palmdale,-118.1,34.59
Springfield,-93.29,37.19
Clarksville,-87.34,36.56
Salinas,-121.63,36.69
Hayward,-122.1,37.62
Paterson,-74.16,40.91
Alexandria[m],-77.08,38.82
Macon[w],-83.69,32.8
Corona,-117.56,33.86
KansasCity[x],-94.74,39.12
Lakewood,-105.11,39.69
Springfield,-72.54,42.11
Sunnyvale,-122.02,37.38
Jackson,-90.21,32.31
Killeen,-97.73,31.07
Hollywood,-80.16,26.03
Murfreesboro,-86.41,35.85
Pasadena,-95.15,29.65
Bellevue,-122.15,47.59
Pomona,-117.76,34.05
Escondido,-117.07,33.13
Joliet,-88.14,41.51
Charleston,-79.95,32.81
Mesquite,-96.58,32.76
Naperville,-88.16,41.74
Rockford,-89.06,42.25
Bridgeport,-73.19,41.18
Syracuse,-76.14,43.04
Savannah,-81.15,32
Roseville,-121.31,38.76
Torrance,-118.34,33.83
Fullerton,-117.92,33.88
Surprise,-112.45,33.67
McAllen,-98.24,26.23
Thornton,-104.94,39.91
Visalia,-119.32,36.32
Olathe,-94.81,38.88
Gainesville,-82.34,29.67
WestValleyCity,-112.01,40.68
Orange,-117.86,33.78
Denton,-97.14,33.21
Warren,-83.02,42.49
Pasadena,-118.13,34.16
Waco,-97.18,31.56
CedarRapids,-91.67,41.96
Dayton,-84.19,39.77
Elizabeth,-74.19,40.66
Hampton[m],-76.29,37.04
Columbia,-80.89,34.02
Kent,-122.21,47.38
Stamford,-73.54,41.07
Lakewood,-74.21,40.08
Victorville,-117.35,34.52
Miramar,-80.33,25.97
CoralSprings,-80.25,26.27
SterlingHeights,-83.03,42.58
NewHaven,-72.92,41.31
Carrollton,-96.89,32.98
Midland,-102.11,32.02
Norman,-97.34,35.24
SantaClara,-121.96,37.36
Athens[y],-83.37,33.94
ThousandOaks,-118.87,34.19
Topeka,-95.69,39.03
SimiValley,-118.74,34.26
Columbia,-92.32,38.95
Vallejo,-122.26,38.1
Fargo,-96.82,46.86
Allentown,-75.47,40.59
Pearland,-95.32,29.55
Concord,-122,37.97
Abilene,-99.73,32.45
Arvada,-105.15,39.83
Berkeley,-122.29,37.86
AnnArbor,-83.73,42.27
Independence,-94.35,39.08
Rochester,-92.47,44.01
Lafayette[z],-92.02,30.2
Hartford,-72.68,41.76
CollegeStation,-96.29,30.58
Clovis,-119.68,36.82
Fairfield,-122.03,38.25
PalmBay,-80.66,27.98
Richardson,-96.7,32.97
RoundRock,-97.66,30.52
Cambridge,-71.11,42.37
Meridian,-116.39,43.61
WestPalmBeach,-80.12,26.74
Evansville,-87.53,37.98
Clearwater,-82.76,27.97
Billings,-108.54,45.78
WestJordan,-112,40.6
Richmond,-122.36,37.95
Westminster,-105.06,39.88
Manchester,-71.44,42.98
Lowell,-71.32,42.63
Wilmington,-77.88,34.2
Antioch,-121.79,37.97
Beaumont,-94.14,30.08
Provo,-111.64,40.24
NorthCharleston,-80.06,32.91
Elgin,-88.32,42.03
Carlsbad,-117.28,33.12
Odessa,-102.34,31.88
Waterbury,-73.03,41.55
Springfield,-89.64,39.79
LeagueCity,-95.1,29.49
Downey,-118.13,33.93
Gresham,-122.44,45.5
HighPoint,-79.99,35.99
BrokenArrow,-95.78,36.03
Peoria,-89.61,40.75
Lansing,-84.55,42.71
Lakeland,-81.95,28.05
PompanoBeach,-80.13,26.24
CostaMesa,-117.91,33.66
Pueblo,-104.61,38.26
Lewisville,-96.98,33.04
MiamiGardens,-80.24,25.94
LasCruces,-106.78,32.32
SugarLand,-95.61,29.59
Murrieta,-117.19,33.57
Ventura[aa],-119.25,34.26
Everett,-122.19,47.95
Temecula,-117.13,33.49
Dearborn,-83.21,42.31
SantaMaria,-120.44,34.93
WestCovina,-117.9,34.05
ElMonte,-118.02,34.07
Greeley,-104.76,40.41
Sparks,-119.73,39.55
Centennial,-104.86,39.59
Boulder,-105.25,40.02
SandySprings,-84.36,33.93
Inglewood,-118.34,33.95
Edison,-74.41,40.52
SouthFulton,-84.67,33.59
GreenBay,-87.98,44.52
Burbank,-118.32,34.19
Renton,-122.19,47.47
Hillsboro,-122.93,45.52
ElCajon,-116.96,32.8
Tyler,-95.3,32.31
Davie[ac],-80.28,26.07
SanMateo,-122.31,37.56
Brockton,-71.02,42.08
Concord,-80.6,35.4
JurupaValley,-117.46,34
DalyCity,-122.46,37.7
Allen,-96.66,33.09
RioRancho,-106.67,35.29
Rialto,-117.38,34.11
Woodbridge,-74.28,40.56
SouthBend,-86.26,41.67
SpokaneValley,-117.23,47.67
Norwalk,-118.08,33.9
Menifee,-117.19,33.69
Vacaville,-121.97,38.35
WichitaFalls,-98.52,33.9
Davenport,-90.6,41.55
Quincy,-71,42.25
Chico,-121.83,39.74
Lynn,-70.95,42.47
Lee'sSummit,-94.37,38.92
NewBedford,-70.93,41.64
FederalWay,-122.35,47.32
Clinton,-82.92,42.59
Edinburg,-98.16,26.3
Nampa,-116.56,43.57
Roanoke[m],-79.93,37.27
Loading