gls function, very old results
----- Original Message ----- From: "Raphael Gottardo" <raph at alvie-mail.lanl.gov> To: <r-help at stat.math.ethz.ch> Sent: Tuesday, July 10, 2001 11:50 AM Subject: [R] gls function, very old results
Hello R-users, I am currently trying to learn how to use the function gls of the nlme library. I fitted the following model: Generalized least squares fit by REML Model: response ~ array + dye + genes + variety + variety * genes + array * genes + dye * genes Data: data I have 11 arrays, 2 dyes, 2 varieties, 3200 genes, and 2 replications for each. Therefore I should have the corresponding degrees of freedom and number of coefficients, but instead I have the following: Coefficients: (Intercept) array dye genes variety 5.955503e+00 2.695750e-02 4.120987e-01 -2.499571e-04 2.686421e-01 array:genes dye:genes genes:variety 1.319176e-06 -7.112527e-05 2.660801e-05 Degrees of freedom: 110386 total; 110378 residual Residual standard error: 1.030704
anova(fit)
Denom. DF: 110378
numDF F-value p-value
(Intercept) 1 7590769 <.0001
array 1 21263 <.0001
dye 1 3069 <.0001
genes 1 4277 <.0001
variety 1 2493 <.0001
array:genes 1 38 <.0001
dye:genes 1 99 <.0001
genes:variety 1 15 1e-04
So I would like to know what I am doing wrong?
I use the following command:
fit_gls(response~array+dye+genes+variety+variety*genes+array*genes+dye*genes ,data=data)
and my dataset looks like this: array variety dye genes response flag 1 79 1 1 1 8.395252 0 2 79 1 1 1 8.583917 0 3 79 1 1 2 8.544225 0 4 79 1 1 2 8.423542 0 5 79 1 1 3 7.502186 0 6 79 1 1 3 7.524021 0 7 79 1 1 4 8.188411 0 8 79 1 1 4 8.072779 0 9 79 1 1 5 7.629976 0 10 79 1 1 5 7.524021 0 11 79 1 1 6 7.684784 0 12 79 1 1 6 7.610358 0 13 79 1 1 7 8.366138 0 14 79 1 1 7 8.369621 0 15 79 1 1 8 7.166266 0 16 79 1 1 8 7.038784 0 17 79 1 1 9 7.474205 0 18 79 1 1 9 7.805067 0 19 79 1 1 10 8.339501 0 20 79 1 1 10 8.407155 0 Any suggestion would be greatly appreciated. Thank you, raphael
It appears that the variables "array", "dye", etc., need to be treated as "factors". Probably the most convenient approach would be to convert them in your data frame before carrying out the analysis. For example, the values of dye could be converted with the following code (mutatis mutandis).
data$dye<- factor(data$dye,labels=c("red","blue"))
Finding an appropriate model for these data is likely to be a challenging exercise. I highly recommend the book by Pinheiro and Bates entitled "Mixed Effects Models in S and S-Splus". These authors explain very clearly how to carry out mixed-effects modeling. -Bill -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._