Hi,

Finally I could resolve. I understood how you can use dummy variables in lm().

Thanks!

Eva

--- El jue, 20/9/12, Eva Prieto Castro <evapcas...@yahoo.es> escribió:

De: Eva Prieto Castro <evapcas...@yahoo.es>
Asunto: Re: Dummy Variable : Doubt
Para: R-help@r-project.org
Fecha: jueves, 20 de septiembre, 2012 11:27

Sorry, I could write Dummy and not Gummy.

Regards

--- El jue, 20/9/12, Eva Prieto Castro <evapcas...@yahoo.es> escribió:

De: Eva Prieto Castro <evapcas...@yahoo.es>
Asunto: Gummy Variable : Doubt
Para: R-help@r-project.org
Fecha: jueves, 20 de septiembre, 2012 11:13



Hi, 


 

I have a system in which I analyze 2 subjects and 1 variable, so I have
2 models as follow:

 

y ~ x_1[, 1] + x_2[, 1] + x_1[, 2] + x_2[, 2]

 

Where 

 

x_1[, i] = cos(2 * pi * t / T_i)

x_2[, i] = sin(2 * pi * t / T_i)

 

i = 1, 2

 

Data have two columns: t and y.

 

As you can see, I have a multiple components model, with rithm and
without trends, and I have a fundamental period (T_1 = 24 hour; T_2 = 12 hour).

 

I have to compare the parameters between the two models (one for each
subject), using a parametric test as described in the doc I adjunt (page 500,
Parametric solution):

 

I have to reach results as follow:

 

______________________________________________________

H0: Equality of...          df          
            F                p

______________________________________________________

MESOR                      ( 1, 171)    224.0246 
   <0.0001

(A,phi) 24h                  ( 2, 171)      
  7.6332      0.0007

(A,phi) 24h                  ( 2, 171)        5.8370  
    0.0035

Rhythmic
components       ( 4, 171)     
  6.3568    <0.0001

Whole model                  (
5, 171)      51.6583 
  <0.0001




I know how to obtain df values and I know how to obtain F and p for the
whole model, because whole model means that all parameters of the two series
are equal, so it means that all values are in the same serie, so I construct a
unique serie concatenating the respective t’s and y’s vectors.

 

The problem is that I don’t know how to obtain F in the other cases (H1:
equal mesor, H2.x: equal amplitude and acrophase, H3: equal rhythmic
components). I suppose I have to use dummy variables, but I don’t know how to
do it.

 

I could access something similar in a solution manual of  a Weisberg
book (1985), chapter 6, problem 9, as follows:
m1 <- lm(Yvar~ Xvar + Fvar + Fvar:Xvar, na.action=na.omit, 
weights=theWeights)  # this is model 1 the most general 

m2 <- lm(Yvar~ Xvar + Fvar            , na.action=na.omit, 
weights=theWeights)  # this is model 2 parallel
m3 <- lm(Yvar~ Xvar + Fvar:Xvar       , na.action=na.omit, 
weights=theWeights)  # this is model 3 common intercept
m4 <- lm(Yvar~ Xvar                   , na.action=na.omit, 
weights=theWeights)  # this is model 4 the least general (all the same) 


 

Please could you help me?.

 

Thank you in advance.
Eva


 


        [[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.

Reply via email to