stephen sefick
2008-Oct-15 16:59 UTC
[R] investigating interaction term for a model of Gross Primary Productivity
I am trying to investigate the interaction term in the below. The paradigm in aquatic systems is that algal production is either nitrogen (TIN) or Phosphorus limited, and I am trying to investigate this- what is the best way to go about investigating the interaction term. I have some thoughts on the above, but I will withhold them to see what others think. Thanks for your help. d <- (structure(list(d.GPP = c(1.213695235, 3.817313822, 1.267930498, 10.45692825, 3.268295623, 3.505286001, 4.468225245, 0.915653726, 1.635617261, 3.726133898, 1.363453706, 13.99650967, 0.417618143, 0.741080504, 0.412440872, 3.515743675, 8.248491445, 1.537773727, 1.537773727, 3.249103284, 3.249103284, 0.768531626, 2.633107621, 3.113199095, 0.773824094, 0.680150068, 0.680150068, 0.026385752, 0.369310858, 8.049276658, 7.487378383, 0.950072035, 0.950072035, 0.763580377, 0.333244629, 5.475999014, 9.235631398), d.TIN = c(0.53, 0.52, 0.446, 0.217, 0.39, 0.34, 0.45, 0.29, 0.23, 0.308, 0.3, 0.1, 0.52, 0.13, 0.38, 0.36, 0.226, 0.345, 0.345, 0.217, 0.217, 0.47, 0.34, 0.31, 0.35, 0.41, 0.41, 0.432, 0.333, 0.168, 0.22, 0.37, 0.37, 0.44, 0.38, 0.3, 0.105), d.Phosphorus = c(0.17, 0.19, 0.2, 0.012, 0.13, 0.14, 0.069, 0.13, 0.13, 0.13, 0.099, 0.013, 0.16, 0.076, 0.12, 0.037, 0.011, 0.1, 0.1, 0.021, 0.021, 0.12, 0.099, 0.088, 0.036, 0.15, 0.15, 0.12, 0.12, 0.0076, 0.014, 0.14, 0.14, 0.15, 0.15, 0.12, 0.011), d.TSS = c(2.8, 8.4, 11, 1.3, 4.2, 2, 3.4, 14, 8.2, 3.1, 1.4, 0.9, 6.1, 9.2, 11, 1.2, 1.3, 11, 11, 8.5, 8.5, 13, 4.4, 1.4, 2.1, 25, 25, 9.3, 6.1, 1.6, 1.5, 19, 19, 24, 9.6, 1.8, 1.4)), .Names = c("d.GPP", "d.TIN", "d.Phosphorus", "d.TSS"), row.names = c(NA, -37L), class = "data.frame")) #here is the model model.GPP <- lm(GPP~TIN*Phosphorus+I(1/TSS), data=d) #regression equation GPP <- function(TIN, P, TSS){ 8.765-(22.896*TIN)-(63.513*P)+(5.836/TSS)+(170.735*(TIN*P)) } #predicting GPP from the data - This is kind of useless in this context because I am predicting GPP from the data that I modeled it with, but I think I am going to have to fool around #with these values to investigate the interaction term. This is kind of where I am stuck. a <- GPP(d$TIN, d$Phosphorus, d$TSS) #plotting the data plot(a~d$TSS) -- Stephen Sefick Research Scientist Southeastern Natural Sciences Academy Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis
John Fox
2008-Oct-15 18:21 UTC
[R] investigating interaction term for a model of Gross Primary Productivity
Dear Stephen, I'm not sure exactly what you have in mind, but you might take a look at the effects package. I hope this helps, John On Wed, 15 Oct 2008 12:59:33 -0400 "stephen sefick" <ssefick at gmail.com> wrote:> I am trying to investigate the interaction term in the below. The > paradigm in aquatic systems is that algal production is either > nitrogen (TIN) or Phosphorus limited, and I am trying to investigate > this- what is the best way to go about investigating the interaction > term. I have some thoughts on the above, but I will withhold them to > see what others think. Thanks for your help. > > d <- (structure(list(d.GPP = c(1.213695235, 3.817313822, 1.267930498, > 10.45692825, 3.268295623, 3.505286001, 4.468225245, 0.915653726, > 1.635617261, 3.726133898, 1.363453706, 13.99650967, 0.417618143, > 0.741080504, 0.412440872, 3.515743675, 8.248491445, 1.537773727, > 1.537773727, 3.249103284, 3.249103284, 0.768531626, 2.633107621, > 3.113199095, 0.773824094, 0.680150068, 0.680150068, 0.026385752, > 0.369310858, 8.049276658, 7.487378383, 0.950072035, 0.950072035, > 0.763580377, 0.333244629, 5.475999014, 9.235631398), d.TIN = c(0.53, > 0.52, 0.446, 0.217, 0.39, 0.34, 0.45, 0.29, 0.23, 0.308, 0.3, > 0.1, 0.52, 0.13, 0.38, 0.36, 0.226, 0.345, 0.345, 0.217, 0.217, > 0.47, 0.34, 0.31, 0.35, 0.41, 0.41, 0.432, 0.333, 0.168, 0.22, > 0.37, 0.37, 0.44, 0.38, 0.3, 0.105), d.Phosphorus = c(0.17, 0.19, > 0.2, 0.012, 0.13, 0.14, 0.069, 0.13, 0.13, 0.13, 0.099, 0.013, > 0.16, 0.076, 0.12, 0.037, 0.011, 0.1, 0.1, 0.021, 0.021, 0.12, > 0.099, 0.088, 0.036, 0.15, 0.15, 0.12, 0.12, 0.0076, 0.014, 0.14, > 0.14, 0.15, 0.15, 0.12, 0.011), d.TSS = c(2.8, 8.4, 11, 1.3, > 4.2, 2, 3.4, 14, 8.2, 3.1, 1.4, 0.9, 6.1, 9.2, 11, 1.2, 1.3, > 11, 11, 8.5, 8.5, 13, 4.4, 1.4, 2.1, 25, 25, 9.3, 6.1, 1.6, 1.5, > 19, 19, 24, 9.6, 1.8, 1.4)), .Names = c("d.GPP", "d.TIN", > "d.Phosphorus", > "d.TSS"), row.names = c(NA, -37L), class = "data.frame")) > > #here is the model > model.GPP <- lm(GPP~TIN*Phosphorus+I(1/TSS), data=d) > > #regression equation > GPP <- function(TIN, P, TSS){ > 8.765-(22.896*TIN)-(63.513*P)+(5.836/TSS)+(170.735*(TIN*P)) > } > > #predicting GPP from the data - This is kind of useless in this > context because I am predicting GPP from the data that I modeled it > with, but I think I am going to have to fool around #with these > values > to investigate the interaction term. This is kind of where I am > stuck. > a <- GPP(d$TIN, d$Phosphorus, d$TSS) > > #plotting the data > plot(a~d$TSS) > > > -- > Stephen Sefick > Research Scientist > Southeastern Natural Sciences Academy > > Let's not spend our time and resources thinking about things that are > so little or so large that all they really do for us is puff us up > and > make us feel like gods. We are mammals, and have not exhausted the > annoying little problems of being mammals. > > -K. Mullis > > ______________________________________________ > 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.-------------------------------- John Fox, Professor Department of Sociology McMaster University Hamilton, Ontario, Canada http://socserv.mcmaster.ca/jfox/
Possibly Parallel Threads
- ggplot2 plot with symbols and then add line
- lattice xyplot symbols instead of colors and legend matching plot symbols or colors
- nls, lattice, and conversion over to ggplot
- Error with psi value for 'segmented' package for R
- option to control the spac between columns in data frame