I am working on an inventory of enteric methane emission in Mexico using the Tier 2 model from IPCC, this model has several formulas to calculate the methane emissions from dairy and beef cattle.

I am using the Propagate package to carry out the propagation of uncertainties of each used formula, for instance:

Neta energy of lactation have the following expression:

NEl = milk * (1.47 + 0.4 * fat)

Inputs

milk: mean 21.98 L, s.d. 5.2, PDF(milk)~normal(m, s.d.)

Fat: mean 3.5 %, s.d. 0.82, PDF(fat)~normal(m, s.d.)

Correlation between milk and fat: 0.5

I am using the following scripts:

DATANEt<-data.frame(MILK=c(21.98, 5.2),FAT=c(3.5, 0.82))

EXPNEt<-expression(MILK*(1.47+0.4*FAT))

PROPNEt<-propagate(EXPNEt, DATANEt)

PROPNEt

plot(PROPNEt)

summary(PROPNEt)

fitDistr(PROPNEt)$aic

I have two questions:

1.There is the possibility to define the distribution of inputs (MILK and FAT) in the FUNCTION propagate or the package assume that its distribution is normal.

2. How a can propagate the uncertainty take account the correlation between the inputs (FAT and MILK)

Many thanks and congrats to your amazing package

]]>Thank you very much for the useful package. When I run the

example in this blog, I get the following error message:

>plot(res)

Error in plot.window(xlim, ylim, “”, …) : need finite ‘ylim’ values

I’m running this with Rstudio Version 1.0.143.

]]>Hi Karin,

without your data and your function call I cannot be of real help. Also WordPress does some funny formatting of text.

I can helip you better if you mail me a.spiess@uke,de, maybe some example data and how you use the ‘propagate’ function. Anyway, your biomass function is highly nonlinear (two powers!), which inflates propagated error quite a lot!

Drop me a mail, that should work better…

Cheers,

Andrej

Thanks for your answer. Actually, I am working with a data from a forest inventory , (variables of each tree measurement: diameter, height, and wood density). in order to obtain the Biomass of the forest I use a general equation proposed by chave(2014):

0.0673*(wood.density*diameter^2*height)^0.976.

I would like to obtain the uncertainty equation with my data.

Errors in the three variables all result in error in estimating the biomass, This error is propagated to the AGB estimate through the general model.

I obtain the descriptive statistics I found a great variance.

Par example , for ecozone Selva Baja:

> summary(SB_30vd$correc_biomasa)

Min. 1st Qu. Median Mean 3rd Qu. Max.

54.03 702.60 1041.00 1558.00 1750.00 21700.00

> sd(SB_30vd$correc_biomasa)

[1] 1617.079

> se se(SB_30vd$correc_biomasa)

[1] 27.67981

> data_PRO DAT EXPR res res

Results from error propagation:

Mean.1 Mean.2 sd.1 sd.2 2.5% 97.5%

16639.76 -6833930.64 3045084.91 10251866.51 -26959008.91 13146021.03

Results from Monte Carlo simulation:

Mean sd Median MAD 2.5% 97.5%

46458.7920 85999.1315 14469.0721 20510.8366 23.0063 286044.0463

I am not sure if I am using the propagate package in the correct form. I would be appreciate it if you can give me some advices…

Thank yo very much

Karin

]]>Hi Karin,

either something is wrong with your data, or you used the ‘propagate’ function wrong. Did you use raw data?

I’m asking because there is a very strong discrepancy between first-order mean, second-order mean and Monte Carlo mean.

Also the first-order s.d. and Monte Carlo s.d. are totally different! Does your data have extreme variance? Or did you supply raw data to ‘propagate’ without setting type = “raw”?

Cheers,

Andrej

Could you help me telling me how can obtain s.e.m after runnig the package?

my results after running the package are:

Results from error propagation:

Mean.1 Mean.2 sd.1 sd.2 2.5% 97.5%

11.38983 -39.16052 217.16837 245.36785 -519.91888 443.65640

Results from Monte Carlo simulation:

Mean sd Median MAD 2.5%

37.65579274 70.53757552 11.62218452 16.43243847 0.01784693

97.5%

233.16307179

Thank you for your support!

Karin

Perfect, thanks!

]]>yes, of course, on second thought you are totally right, you have to use the “prediction standard deviation” for uncertainty propagation and not the error of the prediction mean.

Cheers,

Andrej

Thank for your answer. So yes, X1 and X2 are estimated from two different linear models. But Y can be simply derived by multiplying X1 and X2. Using predict(…)$se.fit yields very low uncertainties in Y, because for both linear models used to derive X1 and X2, I have a lots of data (and standard errors tend to zero when n is increasing). This is a bit counter-intuitive to me because the residual standard errors of the two models (sqrt(deviance(lm_fit)/df.residual(lm_fit))) are relatively high. Since predict(…)$se.fit gives the standard error of estimation of mu_x (used for confidence intervals), I was wondering whether I would rather need to compute the standard errors of prediction (used for prediction intervals and are un-compressible with n –> infinity) and propagate these values to compute the uncertainty in Y.

]]>Hi Antoine,

so X1 and X2 are actually two response values from two different linear models? And you are plugging them into a new equation to obtain Y? Then you should take the standard errors coming from predict(…)$se.fit. If the equation you are using to obtain Y also needs the the fit parameters of your linear models (slope1, intercept1, slope2, intercept2), then you should also take their parameter errors sqrt(diag(vcov(your_linear_model)).

Cheers,

Andrej