metRology package

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

metRology package

m.pi.R
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]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: metRology package

S Ellison-2
> I'm having trouble with a simple application with metRology.

Well, what you probably need is to contact the maintainer  of the metRology package.
Fortunately that's me.

An immediate problem that I have is that I don't quite understand what you're doing (in the measurement), so I may need to get back to you off list to understand that more fully. However, an immediate issue is that uncert() in metrology assumes it's getting scalars, and when you said

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

you have asked for the uncertainty of seven times the mass per unit area. That would 'obviously' be around seven times the uncertainty of a single mass per unit area. If you wanted the latter, you'd probably need to have _mean_ mass ,Length and Width with standard uncertainties (or, better, covariance matrix, given that the three values aren't independent) for the _means_.

I'll need to spend a bit of time understanding why your own code came out differently; once I've had time to look at that I'll get back to you off list.

Steve Ellison

> -----Original Message-----
> From: R-help [mailto:[hidden email]] On Behalf Of
> [hidden email]
> Sent: 12 July 2017 21:03
> To: [hidden email]
> Subject: [R] metRology package
>
> 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]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.


*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Loading...