[R] spatial stats - geoR - variogram - standard deviation

2011-03-25 Thread Sean Parks
Hello,

I am attempting to get the standard deviation in multiple distance bins in 
my spatial data.

It appears as though the 'variog' command in the geoR package will do the 
trick, as one of the outputs from 'variog' is 'variog$sd', which, 
according to the manual, is the "standard deviation of the values in each 
bin". 

However, when I run this command, the standard deviation values are much 
larger than I would expect. 

I suspect my interpretation of the outputs from this command is wrong.  I 
would appreciate your input.  Please help.

Thank you,
Sean

Here is a sample of my data:
> head(data)
  id  x   y  fm   ign elev slp
1  0 739950 3700450 101 0.169 2468   7
2  1 740550 3700450  50 0.169 2404   5
3  2 729150 3700350   9 0.719 2455   3
4  3 740850 3700350 101 0.169 2397   7
5  4 726450 3700150   9 0.719 2430   7
6  5 731350 3700150   9 0.920 2395   9
> tail(data)
id  x   y fm   ign elev slp
9995  9994 802050 3649150  8 0.529 2810  32
9996  9995 802050 3648950  6 0.529 2694  27
9997  9996 802450 3648750  8 0.529 2513  16
9998  9997 802950 3648450  6 0.529 2365  16
  9998 803550 3648450 10 0.529 2431  24
1  802950 3648150  6 0.529 2514  31


Here is my code for creating/computing the variogram
coords <- coordinates(data)
coords <- coords[,2:3]
breaks <- seq(0, 1, by=500)
variogram <- variog(coords = coords, data = data$slp, option="bin", 
breaks=breaks)

Here are the results (standard deviation in bold):
> variogram
$u
 [1]  250  750 1250 1750 2250 2750 3250 3750 4250 4750 5250 5750 6250 6750 
7250
[16] 7750 8250 8750 9250 9750

$v
 [1] 33.41155 42.09367 45.74353 48.58874 50.89475 52.60261 53.63517 
55.11310
 [9] 55.25277 55.90801 56.24541 56.76813 56.90551 57.57173 58.11656 
58.30572
[17] 58.93047 59.47261 59.51137 59.75097

$n
 [1]  11000  36867  60185  81806 102093 125587 146849 162960 182990 199030
[11] 217245 236570 253696 266616 283172 296383 310687 325882 335439 349360

$sd
 [1] 59.32691 67.91576 70.66875 75.02404 77.39498 78.68779 79.77978 
81.38067
 [9] 81.17723 81.80769 82.20088 82.21075 82.51343 83.15514 83.51502 
83.62793
[17] 84.05560 84.92033 85.36226 85.67982

$bins.lim
 [1] 1.0e-12 5.0e+02 1.0e+03 1.5e+03 2.0e+03 2.5e+03 3.0e+03 3.5e+03 
4.0e+03
[10] 4.5e+03 5.0e+03 5.5e+03 6.0e+03 6.5e+03 7.0e+03 7.5e+03 8.0e+03 
8.5e+03
[19] 9.0e+03 9.5e+03 1.0e+04

$ind.bin
 [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 
TRUE
[16] TRUE TRUE TRUE TRUE TRUE

$var.mark
[1] 74.84206

$beta.ols
[1] 14.5665

$output.type
[1] "bin"

$max.dist
[1] 1

$estimator.type
[1] "classical"

$n.data
[1] 1

$lambda
[1] 1

$trend
[1] "cte"

$pairs.min
[1] 2

$nugget.tolerance
[1] 1e-12

$direction
[1] "omnidirectional"

$tolerance
[1] "none"

$uvec
 [1]  250  750 1250 1750 2250 2750 3250 3750 4250 4750 5250 5750 6250 6750 
7250
[16] 7750 8250 8750 9250 9750

$call
variog(coords = coords, data = data$slp, breaks = breaks, option = "bin")

attr(,"class")
[1] "variogram"





*
Sean Parks
Ecologist | Geospatial Analyst
Aldo Leopold Wilderness Research Institute
Rocky Mountain Research Station
(406) 542-4182
http://leopold.wilderness.net/
*
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Difficulty creating Julian day in data frame

2010-09-15 Thread Sean Parks
Hi,

I'm attempting to add a "Julian Day" column to a data frame.

Here is my code and the resulting data frame:

vic.data <- read.table("C:/VIC/data/vic.data.csv", header=F)
names(vic.data) <- c("year", "month", "day", "precip", "evap", 
"runoff", "baseflow", "Tsup", "SM1", "SM2", "SM3", "SWE")
 
vic.data$temp.date <- as.Date(paste(vic.data$year, "/", 
vic.data$month, "/", vic.data$day, sep=""))
vic.data$julian.day <- julian(vic.data$temp.date, origin = 
as.Date("1900-01-01"))[1]
head(vic.data)

  year month day precip   evap runoff baseflow Tsup SM1 SM2  
SM3  SWE  temp.date julian.day
1 1916 1   1   0.00 0.0789  0   0.5037 -15.9907 20.2285 63.4011 
296.9437 214.7537 1916-01-01   5843
2 1916 1   2   0.00 0.1135  0   0.5030 -14.1946 20.1619 63.3425 
296.5659 214.7009 1916-01-02   5843
3 1916 1   3  29.74 0.1584  0   0.5024 -11.1894 20.0998 63.2817 
296.1864 244.0971 1916-01-03   5843
4 1916 1   4  11.37 0.2056  0   0.5017 -12.9745 20.0416 63.2194 
295.8052 255.3145 1916-01-04   5843
5 1916 1   5   0.00 0.1467  0   0.5011 -15.1542 19.9866 63.1561 
295.4224 255.2361 1916-01-05   5843
6 1916 1   6   0.00 0.0939  0   0.5004 -12.5409 19.9345 63.0922 
295.0379 255.2084 1916-01-06   5843


As you can see, the "temp.date" column behaves as expected, but the 
"julian.day" column is populated with the Julian day value from 1/1/1916.

Please help me out if you have some ideas.

Thanks,
Sean




*
Sean Parks
Ecologist | Geospatial Analyst
Aldo Leopold Wilderness Research Institute
Rocky Mountain Research Station
(406) 542-4182
http://leopold.wilderness.net/
*
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] sample weight for box plot?

2009-10-29 Thread Sean Parks

Hi,

I would like to make a box and whisker plot but use a sample weight for each
observation.  I've searched around a bit and have not found a method of
doing this.  

Anyone have any advice?

Thanks much,
Sean Parks
-- 
View this message in context: 
http://www.nabble.com/sample-weight-for-box-plot--tp26104205p26104205.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.