[R] Fwd: nonlinearity and interaction

Bert Gunter gunter.berton at gene.com
Fri May 14 18:54:58 CEST 2010


1. As this is not an R question, this is probably not an appropriate list
for posting. You might wish to consider a list specifically devoted to
statistics and data analysis.

2. Having said that, some kind souls on this list may be willing to help.

3. I believe you have the wrong data structure and need to rethink what the
appropriate one is. Local statistical resources, if you have any, may be
able to help (as a more intimate understanding of the nature of your study
design and goals may be required).

4. I believe your proposal to view your continuous x variable as an
indicator for interactions is utter nonsense. Again, if possible consult a
local statistician that you can spend some time with.


Bert Gunter
Genentech Nonclinical Statistics


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of William Simpson
Sent: Friday, May 14, 2010 5:25 AM
To: r-help at r-project.org
Subject: [R] Fwd: nonlinearity and interaction

[posted this at 9:25 and still hasn't appeared on the list at 13:26]


I have the following set-up.

6 values of a continuous variable (let's say light intensity) are
presented to a system.
The input is presented as a random series of blocks lasting (say) 5 sec
each.
             ----
    ----
----                         etc
        ----
time ->

The output is measured and sampled at say 10 samples/sec. Please
ignore the fact that this is a time series and don't suggest things
like ar() and arima(). I have looked at the autocorrelation function
of the output and it is an amazing spike at a lag of zero and zilch
elsewhere.

Call the input x and the output y.

I can find the relationship between x and y by
fit<-lm(y~x)
coef(fit) tells me the line that best fits x vs y (as shown in the
plot of the 6 values of x vs the mean values of y at those values).

****Question:
Suppose that the system is nonlinear such that the response to the
sequence 0,2 is not the same as the response to 2, 0 -- it is not just
a change of the response by the same amount. Or nonlinear in other
weird ways (I don't just mean simple things like y~x^2).

I am thinking that a way to characterise this might be to pretend that
x is not a continuous variable and to represent it with 5 indicator
variables. And then interactions between them would tell me about
nonlinear effects?
e.g.
lm(y~ d1 + d2 + d3 + d4 + d5 + d1*d2) etc
Does this make any sense? If so, please suggest a good way to go about
this; how to set up the dummy variables and how to interpret the
results.

Ideally, the same lm() fit would tell me about the linear effect y~x
and the nonlinearities. Both sorts of effect will co-exist.

Thanks very much for any help!

Bill

______________________________________________
R-help at 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.



More information about the R-help mailing list