Running examples in 'StatMatch-Ex.R' failed
The error most likely occurred in:

> ### Name: Frechet.bounds.cat
> ### Title: Frechet bounds of cells in a contingency table
> ### Aliases: Frechet.bounds.cat
> ### Keywords: multivariate
> 
> ### ** Examples
> 
> 
> data(quine, package="MASS") #loads quine from MASS
> str(quine)
'data.frame':	146 obs. of  5 variables:
 $ Eth : Factor w/ 2 levels "A","N": 1 1 1 1 1 1 1 1 1 1 ...
 $ Sex : Factor w/ 2 levels "F","M": 2 2 2 2 2 2 2 2 2 2 ...
 $ Age : Factor w/ 4 levels "F0","F1","F2",..: 1 1 1 1 1 1 1 1 2 2 ...
 $ Lrn : Factor w/ 2 levels "AL","SL": 2 2 2 1 1 1 1 1 2 2 ...
 $ Days: int  2 11 14 5 5 13 20 22 6 6 ...
> 
> # split quine in two subsets
> set.seed(7654)
> lab.A <- sample(nrow(quine), 70, replace=TRUE)
> quine.A <- quine[lab.A, 1:3]
> quine.B <- quine[-lab.A, 2:4]
> 
> # compute the tables required by Frechet.bounds.cat()
> freq.x <- xtabs(~Sex+Age, data=quine.A)
> freq.xy <- xtabs(~Sex+Age+Eth, data=quine.A)
> freq.xz <- xtabs(~Sex+Age+Lrn, data=quine.B)
> 
> # apply Frechet.bounds.cat()
> bounds.yz <- Frechet.bounds.cat(tab.x=freq.x, tab.xy=freq.xy,
+         tab.xz=freq.xz, print.f="data.frame")
Warning in Frechet.bounds.cat(tab.x = freq.x, tab.xy = freq.xy, tab.xz = freq.xz,  :
  The marginal distr. of the X variables 
 in tab.xz is not equal to tab.x
Warning in Frechet.bounds.cat(tab.x = freq.x, tab.xy = freq.xy, tab.xz = freq.xz,  :
  The marginal distr. of the X variables 
 in tab.xy and in tab.xz are not equal
> bounds.yz
$bounds
  Eth Lrn     low.u     low.cx       CIA     up.cx      up.u
1   A  AL 0.0000000 0.19714286 0.2677708 0.3508163 0.3714286
2   N  AL 0.0998358 0.25208791 0.3351334 0.4057614 0.4712644
3   A  SL 0.0000000 0.02061224 0.1036578 0.1742857 0.3714286
4   N  SL 0.1573071 0.22281005 0.2934380 0.3764835 0.5287356

$uncertainty
     av.u     av.cx 
0.3714286 0.1536735 

> 
> #compare marg. distribution of Xs in A and B
> comp.prop(p1=margin.table(freq.xy,c(1,2)), p2=margin.table(freq.xz,c(1,2)), 
+           n1=nrow(quine.A), n2=nrow(quine.B))
$meas
      tvd   overlap     Bhatt      Hell 
0.2095238 0.7904762 0.9716959 0.1682383 

$chi.sq
   Pearson         df      q0.05   delta.h0 
 8.5112905  7.0000000 14.0671404  0.6050477 

$p.exp
   Age
Sex         F0         F1         F2         F3
  F 0.07006369 0.22292994 0.12101911 0.14012739
  M 0.11464968 0.08917197 0.14012739 0.10191083

> 
> # harmonize distr. of Sex vs. Age before applying
> # Frechet.bounds.cat()
> 
> N <- nrow(quine)
> quine.A$pop <- N
> quine.A$f <- N/70 # reciprocal sampling fraction
> quine.B$pop <- N
> quine.B$f <- N/(N-70)
> 
> # derive the table of Sex vs. Age related to the whole data set
> tot.sex.age <- colSums(model.matrix(~Sex*Age-1, data=quine))
> tot.sex.age
      SexF       SexM      AgeF1      AgeF2      AgeF3 SexM:AgeF1 SexM:AgeF2 
        80         66         46         40         33         14         21 
SexM:AgeF3 
        14 
> 
> # use hamonize.x() to harmonize the Sex vs. Age between
> # quine.A and quine.B
> 
> # create svydesign objects
> require(survey)
> svy.qA <- svydesign(~1, weights=~f, fpc=~pop, data=quine.A)
> svy.qB <- svydesign(~1, weights=~f, fpc=~pop, data=quine.B)
> 
> # apply harmonize.x 
> out.hz <- harmonize.x(svy.A=svy.qA, svy.B=svy.qB, form.x=~Sex*Age-1, x.tot=tot.sex.age)
> 
> # compute the new tables required by Frechet.bounds.cat()
> freq.x <- xtabs(out.hz$weights.A~Sex+Age, data=quine.A)
> freq.xy <- xtabs(out.hz$weights.A~Sex+Age+Eth, data=quine.A)
> freq.xz <- xtabs(out.hz$weights.B~Sex+Age+Lrn, data=quine.B)
> 
> #compare marg. distribution of Xs in A and B
> comp.prop(p1=margin.table(freq.xy,c(1,2)), p2=margin.table(freq.xz,c(1,2)), 
+           n1=nrow(quine.A), n2=nrow(quine.B))
Error in if (sum(p2) > 1) p2 <- prop.table(p2) : 
  missing value where TRUE/FALSE needed
Calls: comp.prop
Execution halted