[R] metRology package

mark.hogue at srs.gov mark.hogue at srs.gov
Wed Jul 12 22:02:42 CEST 2017


I'm having trouble with a simple application with metRology. I need to 
estimate the uncertainty of the density thickness of seven sheets of film. 
This is calculated from measurements of mass, length and width of 
rectangular samples of film.

It's not too hard to calculate the whole thing with a little Monte Carlo 
loop. I get about 0.07 with this:

        #sample area
        L<-5*2.54 #cm
        W<-8*2.54 #cm
        #sample mass
        m<-0.2543*1000 #mg
        #uncertainties
        L.u<-(1/16)*2.54 #cm (nearest 16th inch)
        W.u<-(1/16)*2.54 #cm 
        m.u<-0.006*1000 #mg scale calibration data 

        denth<-c(0,0,0)
        singth<-c(0,0,0)
        for(i in 1:1e5) {
          #denth[i]<-7*dt+sum(rnorm(7,0,dt.u))
          for(j in 1:7)
 singth[j]<-(m+rnorm(1,0,m.u))/((L+rnorm(1,0,L.u))*(W+rnorm(1,0,W.u)))
          denth[i]<-sum(singth)
        }
        sd(denth) #0.07279882

Now with the metRology package, I get a much higher number, which is 
actually the seven times the uncertainty of one layer:

        require(metRology)
        d.set<-list(mass=m,Length=L,Width=W)
        d.set.u<-list(m.u,L.u,W.u)

        dent<-expression(7*(mass/(Length*Width)))
        uncert(obj=dent, x=d.set, u=d.set.u, method="GUM")

I've tried other ways of defining the expression and every method option. 
I suspect the expression is the problem area, but if so, I really need to 
know how to get it right for harder problems. Thanks in advance for any 
suggestions.

- Mark

	[[alternative HTML version deleted]]



More information about the R-help mailing list