{"action":"created","issue":{"url":"https://api.github.com/repos/GLEON/LakeMetabolizer/issues/104","labels_url":"https://api.github.com/repos/GLEON/LakeMetabolizer/issues/104/labels{/name}","comments_url":"https://api.github.com/repos/GLEON/LakeMetabolizer/issues/104/comments","events_url":"https://api.github.com/repos/GLEON/LakeMetabolizer/issues/104/events","html_url":"https://github.com/GLEON/LakeMetabolizer/issues/104","id":103761829,"number":104,"title":"I Botched observation vs process error, yeah?","user":{"login":"rBatt","id":5630847,"avatar_url":"https://avatars.githubusercontent.com/u/5630847?v=3","gravatar_id":"","url":"https://api.github.com/users/rBatt","html_url":"https://github.com/rBatt","followers_url":"https://api.github.com/users/rBatt/followers","following_url":"https://api.github.com/users/rBatt/following{/other_user}","gists_url":"https://api.github.com/users/rBatt/gists{/gist_id}","starred_url":"https://api.github.com/users/rBatt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rBatt/subscriptions","organizations_url":"https://api.github.com/users/rBatt/orgs","repos_url":"https://api.github.com/users/rBatt/repos","events_url":"https://api.github.com/users/rBatt/events{/privacy}","received_events_url":"https://api.github.com/users/rBatt/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/GLEON/LakeMetabolizer/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/GLEON/LakeMetabolizer/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-08-28T17:32:13Z","updated_at":"2015-08-31T13:16:04Z","closed_at":null,"body":"I think I screwed up folks.\r\n\r\nGordon, thankfully (luckily) pointed this out in his review\r\n\r\nSay your estimate is `S`, your observation is `Y`, and your true value is `X`.\r\n\r\n# Simple Example\r\nSay the true process is  \r\n  `X[t] = X[t-1] + eta[t]`\r\n\r\nThe observations are  \r\n  `Y[t] = X[t] + epsilon[t]`\r\n\r\nTo make things simple, say that for the first time step,   \r\n`S[1] = X[1] = 0`  \r\ni.e., our estimate is equal to the true value which is equal to 0.\r\n\r\n# Observation Error only  NLL Function\r\nIf you fit a model like this:\r\n```r\r\nS[t] = S[t-1] # loop through this\r\n-sum(dnorm(S-Y, 0, sigma)) # this would be the NLL\r\n```\r\nIt is a process-only model, and `sigma` is the standard deviation of `epsilon`. The intuition here is that in a world where there are *only* observation errors, our process will be exactly correct, so the only reason `S` would differ from `Y` (what's in `dnorm()` there) is due to observation error. Note that in [metab.mle](https://github.com/GLEON/LakeMetabolizer/blob/master/R/metab.mle.R#L172) `alpha` is on both sides of the equation (note that this piece is actually [implemented in C here](https://github.com/GLEON/LakeMetabolizer/blob/master/src/mleLoop.c#L15)).\r\n\r\n# Process Error Only NLL Function\r\nIf you fit a model like this:\r\n```r\r\nS[t] = Y[t-1] # loop through\r\n-sum(dnorm(S-Y, 0, sigma)) # nll\r\n```\r\nIt is a process-only model, and `sigma` is the standard deviation of `eta`. In this scenario, we are assuming observations are *perfect*, so really `Y == X`! Therefore, if we get `S[t]` from `Y[t-1]`, and things don't match up perfectly, it's not because our observation wasn't good, it's because our process connecting `S` to `Y` isn't good.\r\n\r\n# So ... what does this mean for the package?\r\nThe process error only model is not what `metab.mle` does. It's actually what `metab.ols` does. Making a simple assumption about the covariance structure of the model terms, MLE and OLS are identical (if the mean and the residuals aren't correlated). That being said, MLE does offer some flexibility over OLS.  \r\n  \r\nSo we can choose to program a second `metab.mle` where we switch out `alpha` for the observation, and call it the PE-only version (maybe we just make this an argument to pass to `metab.mle`), or we can just say we're actually presenting an OE-only model. Which, as Gordon points out, I don't think anyone has done.\r\n\r\nSo, to summarize, we have a few options:  \r\n  1. **Keep all code as-is, and say**   \r\n    a. `metab.ols` is process-error-only  \r\n    b. `metab.mle` is observation-error-only  \r\n    c. we'd also say that this is not the MLE from Hanson or Solomon  \r\n  2. **Change `metab.mle` to PE-only**  \r\n    a. Switch the `alpha` on the right-side of the equation to the observation  \r\n    b. adjust manuscript text to say that we are using observation error models  \r\n  3. **Add option to `metab.mle`**  \r\n    a. Add argument like `error.type`, `match.arg(error.type, choices=c(\"OE\",\"PE\")`  \r\n    b. for `error.type=\"PE\"` we make change in 2  \r\n    c. for `error.type=\"OE\"` we would use the current code  \r\n    d. we'd probably have 2 different NLL functions\r\n\r\nThoughts? Can anyone independently verify that I'm right or wrong about any of this?  \r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/GLEON/LakeMetabolizer/issues/comments/136368079","html_url":"https://github.com/GLEON/LakeMetabolizer/issues/104#issuecomment-136368079","issue_url":"https://api.github.com/repos/GLEON/LakeMetabolizer/issues/104","id":136368079,"user":{"login":"pchanson","id":408701,"avatar_url":"https://avatars.githubusercontent.com/u/408701?v=3","gravatar_id":"","url":"https://api.github.com/users/pchanson","html_url":"https://github.com/pchanson","followers_url":"https://api.github.com/users/pchanson/followers","following_url":"https://api.github.com/users/pchanson/following{/other_user}","gists_url":"https://api.github.com/users/pchanson/gists{/gist_id}","starred_url":"https://api.github.com/users/pchanson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pchanson/subscriptions","organizations_url":"https://api.github.com/users/pchanson/orgs","repos_url":"https://api.github.com/users/pchanson/repos","events_url":"https://api.github.com/users/pchanson/events{/privacy}","received_events_url":"https://api.github.com/users/pchanson/received_events","type":"User","site_admin":false},"created_at":"2015-08-31T13:16:04Z","updated_at":"2015-08-31T13:16:04Z","body":"Luke\n\nNot sure I have the history on this. Anything important I can help with?\n\nPaul\n\n\n\nSent from my U.S. Cellular® Smartphone\n\n\n-------- Original message --------\nFrom: Luke Winslow <notifications@github.com>\nDate: 08/31/2015 7:14 AM (GMT-07:00)\nTo: GLEON/LakeMetabolizer <LakeMetabolizer@noreply.github.com>\nCc: Paul Hanson <pchanson@wisc.edu>\nSubject: Re: [LakeMetabolizer] I Botched observation vs process error, yeah? (#104)\n\n\nYeah, we botched it. Any of us could have caught it.\n\nDue to the already-existing use of the package, I'm temped to go with option 3.\n\n-\nReply to this email directly or view it on GitHub<https://github.com/GLEON/LakeMetabolizer/issues/104#issuecomment-136367277>.\n"}}