[R] ssanova help

David Winsemius dwinsemius at comcast.net
Tue Sep 1 02:53:16 CEST 2009


On Aug 31, 2009, at 7:19 PM, Josef Fruehwald wrote:

> Hi all,
>
> I'm using the ssanova function from the gss package to fit smoothing  
> spline
> anovas, and am running into some difficulty.
>
> For my data, I have measurements at 2 milisecond intervals for every
> observation. Every observation does not have the same duration, so I  
> have
> scaled the times for each observation to a scale between 0  and 1. I  
> would
> like to smooth over time, and the following works:
>
> ssanova(Measurement ~ ScaleTime, data = data)
>
> I would also like to see how the variable duration affects the  
> curve, so I
> have another column in the dataframe which contains the log  
> duration. I did
> it like so:
>
> Durations <- data.frame(LogDuration = log(tapply(data$Time, data 
> $Token,
> max)), Token = levels(data$Token)

That looks wrong. The results of tapply will not in general be a  
single number, so LogDuration could be a rather weird list of things.  
Have you run summary() on it?

> data <- merge(data, Durations, by = "Token")

But maybe I am not really understanding your genius.

>
> Now every measurement point for every observation also has the  
> log(duration)
> of the entire observation associated with it.
>
> I would assume that the following is how I should specify my formula:
>
> ssanova(Measurement ~ ScaleTime * LogDuration, data = data)

I wonder if log time (once you confirm that the variable is what you  
want it to be) ought to be entered as an offset?

>
> but I get the following error:
>
> Error in if (!((2 * order > dm) & (dm >= 1))) { :
>  missing value where TRUE/FALSE needed
>
> I get the same error if I try
>
> ssanova(Measurement ~ LogDuration, data = data)
>
> Any suggestions as to how I should approach this problem? I know  
> that if I
> break duration into some kind of factor, I can successfully fit the  
> model.
> However, I would like to assume that there is a continuous  
> transformation of
> the curve shape as duration increases or decreases.
>
> Thanks!
> Joe

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list