Re: [R] Uncertainty propagation

2010-09-27 Thread Maayt

Thanks for the help, I start to get reasonable errors on the model...
I finally turned to the simpler lm() fitting. As my data from which I fit
has only 8 points in each case, I guess it does not make much sense to
downweight outliers and use rlm() in this case. 



-- 
View this message in context: 
http://r.789695.n4.nabble.com/Uncertainty-propagation-tp2713499p2715085.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Uncertainty propagation

2010-09-26 Thread Maayt

Thanks a lot for the help,

I linearized my power relations en fitted them with a linear rlm() function.
When I re-sample my pairs from a bivariate normal distribution for my power
law what transformation do I need to apply a transformation to my covariance
(vcov) matrix to get back from my linearized regression to my power law
space.

Thanks


-- 
View this message in context: 
http://r.789695.n4.nabble.com/Uncertainty-propagation-tp2713499p2714549.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Uncertainty propagation

2010-09-26 Thread Ben Bolker
Maayt m.lupker at hotmail.com writes:

 I linearized my power relations en fitted them with a linear rlm() function.
 When I re-sample my pairs from a bivariate normal distribution for my power
 law what transformation do I need to apply a transformation to my covariance
 (vcov) matrix to get back from my linearized regression to my power law
 space.
 
 Thanks

   rlm() does return a fitted model object that 'inherits from' (is
a variant/superset of) the 'lm' class, therefore vcov(modelfit) should
work (but see caution below).  You should 'unpack' the results in the opposite
direction from your modeling -- simulate on the linearized scale, then
invert the transformation you used in order to get the curves back to your 
'power law space'.
   The caution is that without digging into the details of rlm() [and
reading the appropriate section of Venables and Ripley], I don't know 
whether the vcov() matrix based on robust regression will preserve the
non-Gaussian characteristics of your data ... you may find when you do
the simulations that they do *not* capture the variance of your data
appropriately, because the robust part of 'robust linear modeling' 
deliberately downweights the effects of outliers.
   You may find that your results look plausible anyway.
   If not, this begins to turn (for me anyway) into a non-trivial
problem.  One possibility (although more time-consuming) would be
to (nonparametrically) bootstrap the data, and generate a predicted
curve for each bootstrap sample -- then use the envelope of these
bootstrapped curves to characterize the uncertainty (in general this
would be a little bit more robust/general/parsimonious
than the 'prediction interval' approach I've suggested, although more
computationally intensive and slightly harder to set up).

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


[R] Uncertainty propagation

2010-09-25 Thread Maayt

I have a small model running under R. This is basically running various
power-law relations on a variable (in this case water level in a river)
changing spatially and through time. I'd like to include some kind of error
propagation to this.
My first intention was to use a kind of monte carlo routine and run the
model many times by changing the power law parameters. These power laws were
obtained by fitting data points under R. I thus have std error associated to
them: alpha (±da) * WaterHight ^ beta (±db). Is it statistically correct to
sample alpha and beta for each run by picking them from a normal
distribution centered on alpha (resp. beta) with a standard deviation of da
(resp. db) and to perform my statistics (mean and standrad edviation of the
model result) on the model output?
It seems to me that da and db are correlated in some way and by doing what I
entended to, I would overestimate the final error of my model...
My statistical skills are rather weak, is there a way people usually deal
with this kind of problems?

Thanks

-- 
View this message in context: 
http://r.789695.n4.nabble.com/Uncertainty-propagation-tp2713499p2713499.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Uncertainty propagation

2010-09-25 Thread Ben Bolker
Maayt m.lupker at hotmail.com writes:

[snip]
 My first intention was to use a kind of monte carlo routine and run the
 model many times by changing the power law parameters. These power laws were
 obtained by fitting data points under R. I thus have std error associated to
 them: alpha (±da) * WaterHight ^ beta (±db). Is it statistically correct to
 sample alpha and beta for each run by picking them from a normal
 distribution centered on alpha (resp. beta) with a standard deviation of da
 (resp. db) and to perform my statistics (mean and standrad edviation of the
 model result) on the model output?
 It seems to me that da and db are correlated in some way and by doing what I
 entended to, I would overestimate the final error of my model...

  How have you fitted the models?
  Many of the fitting procedures in R give you access not just to
the standard errors of the parameters, but also to their correlations/
covariances.  If you have this information, you can sample the pairs
of parameters from an appropriate multivariate normal distribution.
Typically you could do something like ...

params - MASS::mvrnorm(1000,mu=coef(modelfit),Sigma=vcov(modelfit))
predictions - apply(params,1,predictfun)

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