search for: drcarbon

Displaying 15 results from an estimated 15 matches for "drcarbon".

Did you mean: carbon
2005 Jan 12
4
Finding seasonal peaks in a time series....
I have a seasonal time series. I want to calculate the annual mean value of the time series at its peak (say the mean of the three values before the peak, the peak, and the three values after the peak). The peak of the time series might change cycle slightly from year to year. # E.g., nPts <- 254 foo <- sin((2 * pi * 1/24) * 1:nPts) foo <- foo + rnorm(nPts, 0, 0.05) bar <- ts(foo,
2005 Mar 03
3
creating a formula on-the-fly inside a function
I have a function that, among other things, runs a linear model and returns r2. But, the number of predictor variables passed to the function changes from 1 to 3. How can I change the formula inside the function depending on the number of variables passed in? An example: get.model.fit <- function(response.dat, pred1.dat, pred2.dat = NULL, pred3.dat = NULL) { res <- lm(response.dat ~
2007 Jul 18
0
Spline - frequency response (again)
Is it really possible that nobody can help me with this? Is r-help too overwhelmed now? Any help appreciated - Jon On 7/16/07, Dr Carbon <drcarbon at gmail.com> wrote: > Please preemptively excuse my ignorance. > > I'm trying to fit a cubic smoothing spline to a time series according to a method encountered in a paper. The authors state that they fit a spline whose frequency response is 50% at a wavelength of n years where n i...
2008 Nov 17
1
coerce data.frame with table-like data to a table for use with barchart.table
I have a data.frame containing survey data that is already organized like a table: > foo Excellent Very Good Good Fair Poor Very Poor Question 1 8 7 3 0 0 0 Question 2 5 5 7 1 0 0 Question 3 7 10 1 0 0 0 > class(foo) [1] "data.frame" > I would like to make a barchart
2009 Jan 28
1
gls prediction using the correlation structure in nlme
How does one coerce predict.gls to incorporate the fitted correlation structure from the gls object into predictions? In the example below the AR(1) process with phi=0.545 is not used with predict.gls. Is there another function that does this? I'm going to want to fit a few dozen models varying in order from AR(1) to AR(3) and would like to look at the fits with the correlation structure
2005 Jan 31
2
changing the time base in a ts
I'm probably apporaching this all wrong to start but.... Suppose I have a monthly time series and I want to compute the mean of months 6,7, and 8. I want to plot the original time series and the seasonal time series, one above the other. When I do that as below the time series don't line up for reasons that are obvious. How can I change the base of the seasonal time series so I can make
2004 Dec 14
2
drawing a rectangle through multiple plots
How do I draw a rectangle across multiple plots on a device? E.g., def.par <- par(no.readonly = TRUE) par(mfrow = c(3, 1)) plot(1:10, rnorm(10), ylim = c(-4,4), type = "l") plot(1:10, rnorm(10), ylim = c(-4,4), type = "l") plot(1:10, rnorm(10), ylim = c(-4,4), type = "l") rect(2, -4, 3, 4) par(def.par) I want the rectangle to extend across the whole device. How
2009 Jan 28
2
t.test in a loop
Hi All, I've been having a little trouble with creating a loop that will run a a series of t.tests for inspection, Below is the code i've tried, and some checks i've looked at. I've used the get(paste()) idea as i was told previously that the use of the eval should try and be avoided. I've run a single syntax to check that my systax is correct and works without any problems
2005 Mar 05
1
partial r2 using PLS
I'm trying to get the coefficient of partial determination for each of three independent variables. I've tried mvr in package pls.pcr. I'm a little confused by the output. I'm curious how I can order the LV's according to their names rather than their relative contribution to the regression. For instance, using the crabs data from MASS I made a regression of FL~RW+noise
2005 May 04
1
Difference between "tree" and "rpart"
In the help for rpart it says, "This differs from the tree function mainly in its handling of surrogate variables." And it says that an rpart object is a superset of a tree object. Both cite Brieman et al. 1984. Both call external code which looks like martian poetry to me. I've seen posts in the archives where BDR, and other knowledgeable folks, have said that rpart() is to be
2005 Jul 14
1
Using system to run a stand alone program that requires input in Windows
Under Windows I want to run a stand alone program that takes a number of commands from the user. I've been running the program from the command line using < C:\Data\> foo.exe < params.txt where foo is the program is params.txt is a text file with a few lines (9) of parameters. I want to run this from R using system a la: system("foo.exe", input = "params.txt")
2007 Jul 16
0
Spline - frequency response
Please preemptively excuse my ignorance. I'm trying to fit a cubic smoothing spline to a time series according to a method encountered in a paper. The authors state that they fit a spline whose frequency response is 50% at a wavelength of n years where n is 67% of the length of the time series. Is it possible to fit a spline like this in R using the spar parameter in smooth.spline? Or is
2005 Oct 31
3
question about precision, floor, and powers of two.
At the risk of being beaten about the face and body, can somebody explain why the middle example: log2(2^3); floor(log2(2^3)) is different than examples 1 and 3? > log2(2^2); floor(log2(2^2)) [1] 2 [1] 2 > log2(2^3); floor(log2(2^3)) [1] 3 [1] 2 > log2(2^4); floor(log2(2^4)) [1] 4 [1] 4 > DrC [[alternative HTML version deleted]]
2005 Feb 25
2
Teaching R in 40 minutes. What should be included?
If _you_ were asked to give a 40 minute dog and pony show about R for a group of scientists ranging from physicists to geographers what would you put in? These people want to know what R can do. I'm thinking about something like: A. Overview B. data structures C. arithmetic and manipulation D. reading data E. linear models using glm F. graphics G. programming H. other tricks like rpart or
2005 Jul 27
2
setting elements to NA across an array
Please excuse what is obviously a trivial matter... I have a large 3-d array. I wish to set the third dimension (z) to NA if there are any NA values in the first two dimnesions (xy). So, given array foo: foo <- array(data = NA, dim = c(5,5,3)) foo[,,1] <- matrix(rnorm(25), 5, 5) foo[,,2] <- matrix(rnorm(25), 5, 5) foo[,,3] <- matrix(rnorm(25), 5, 5) I'll set two elements