Last updated on 2019-03-14 00:46:59 CET.
Flavor | Version | Tinstall | Tcheck | Ttotal | Status | Flags |
---|---|---|---|---|---|---|
r-devel-linux-x86_64-debian-clang | 1.2.5 | 8.41 | 96.84 | 105.25 | ERROR | |
r-devel-linux-x86_64-debian-gcc | 1.2.5 | 7.96 | 75.53 | 83.49 | ERROR | |
r-devel-linux-x86_64-fedora-clang | 1.2.5 | 129.03 | ERROR | |||
r-devel-linux-x86_64-fedora-gcc | 1.2.5 | 124.02 | ERROR | |||
r-devel-windows-ix86+x86_64 | 1.2.5 | 15.00 | 148.00 | 163.00 | ERROR | |
r-patched-linux-x86_64 | 1.2.5 | 6.82 | 95.27 | 102.09 | OK | |
r-patched-solaris-x86 | 1.2.5 | 221.40 | OK | |||
r-release-linux-x86_64 | OK | |||||
r-release-windows-ix86+x86_64 | 1.2.5 | 14.00 | 156.00 | 170.00 | OK | |
r-release-osx-x86_64 | 1.2.5 | OK | ||||
r-oldrel-windows-ix86+x86_64 | 1.2.5 | 11.00 | 164.00 | 175.00 | OK | |
r-oldrel-osx-x86_64 | 1.2.5 | OK |
Version: 1.2.5
Check: examples
Result: ERROR
Running examples in 'StatMatch-Ex.R' failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: harmonize.x
> ### Title: Harmonizes the marginal (joint) distribution of a set of
> ### variables observed independently in two sample surveys referred to
> ### the same target population
> ### Aliases: harmonize.x
> ### Keywords: survey
>
> ### ** 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, c("Eth","Sex","Age","Lrn")]
> quine.B <- quine[-lab.A, c("Eth","Sex","Age","Days")]
>
> # create svydesign objects
> require(survey)
> quine.A$f <- 70/nrow(quine) # sampling fraction
> quine.B$f <- (nrow(quine)-70)/nrow(quine)
> svy.qA <- svydesign(~1, fpc=~f, data=quine.A)
> svy.qB <- svydesign(~1, fpc=~f, data=quine.B)
>
> #------------------------------------------------------
> # example (1)
> # Harmonizazion of the distr. of Sex vs. Age
> # usign poststratification
>
> # (1.a) known population totals
> # the population toatal are computed on the full data frame
> tot.sex.age <- xtabs(~Sex+Age, data=quine)
> tot.sex.age
Age
Sex F0 F1 F2 F3
F 10 32 19 19
M 17 14 21 14
>
> out.hz <- harmonize.x(svy.A=svy.qA, svy.B=svy.qB, form.x=~Sex+Age,
+ x.tot=tot.sex.age, cal.method="poststratify")
>
> tot.A <- xtabs(out.hz$weights.A~Sex+Age, data=quine.A)
> tot.B <- xtabs(out.hz$weights.B~Sex+Age, data=quine.B)
>
> tot.sex.age-tot.A
Age
Sex F0 F1 F2 F3
F 0.000000e+00 0.000000e+00 0.000000e+00 3.552714e-15
M 0.000000e+00 1.776357e-15 0.000000e+00 1.776357e-15
> tot.sex.age-tot.B
Age
Sex F0 F1 F2 F3
F 1.776357e-15 7.105427e-15 3.552714e-15 0.000000e+00
M 0.000000e+00 1.776357e-15 0.000000e+00 1.776357e-15
>
> # (1.b) unknown population totals (x.tot=NULL)
> # the population total is estimated by combining totals from the
> # two surveys
>
> out.hz <- harmonize.x(svy.A=svy.qA, svy.B=svy.qB, form.x=~Sex+Age,
+ x.tot=NULL, cal.method="poststratify")
>
> tot.A <- xtabs(out.hz$weights.A~Sex+Age, data=quine.A)
> tot.B <- xtabs(out.hz$weights.B~Sex+Age, data=quine.B)
>
> tot.A
Age
Sex F0 F1 F2 F3
F 10.28186 34.20440 21.01076 20.40665
M 18.23188 14.74015 25.91609 15.18719
> tot.A-tot.B
Age
Sex F0 F1 F2 F3
F 0.000000e+00 7.105427e-15 3.552714e-15 0.000000e+00
M 3.552714e-15 -1.776357e-15 3.552714e-15 1.776357e-15
>
> #-----------------------------------------------------
> # example (2)
> # Harmonizazion wrt the maginal distribution
> # of 'Eth', 'Sex' and 'Age'
> # using linear calibration
>
> # (2.a) vector of population total known
> # estimated from the full data set
> # note the formula! only marginal distribution of the
> # variables are considered
> tot.m <- colSums(model.matrix(~Eth+Sex+Age-1, data=quine))
> tot.m
EthA EthN SexM AgeF1 AgeF2 AgeF3
69 77 66 46 40 33
>
> out.hz <- harmonize.x(svy.A=svy.qA, svy.B=svy.qB, x.tot=tot.m,
+ form.x=~Eth+Sex+Age-1, cal.method="linear")
>
> summary(out.hz$weights.A) #check for negative weights
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.568 1.702 1.783 2.086 2.582 2.756
> summary(out.hz$weights.B) #check for negative weights
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.382 1.496 1.534 1.640 1.666 2.362
>
> tot.m
EthA EthN SexM AgeF1 AgeF2 AgeF3
69 77 66 46 40 33
> svytable(formula=~Eth, design=out.hz$cal.A)
Eth
A N
69 77
> svytable(formula=~Eth, design=out.hz$cal.B)
Eth
A N
69 77
>
> svytable(formula=~Sex, design=out.hz$cal.A)
Sex
F M
80 66
> svytable(formula=~Sex, design=out.hz$cal.B)
Sex
F M
80 66
>
> # Note: margins are equal but joint distributions are not!
> svytable(formula=~Sex+Age, design=out.hz$cal.A)
Age
Sex F0 F1 F2 F3
F 4.705437 40.527446 17.099963 17.667154
M 22.294563 5.472554 22.900037 15.332846
> svytable(formula=~Sex+Age, design=out.hz$cal.B)
Age
Sex F0 F1 F2 F3
F 15.59309 27.73043 17.54011 19.13637
M 11.40691 18.26957 22.45989 13.86363
>
> # (2.b) vector of population total unknown
> out.hz <- harmonize.x(svy.A=svy.qA, svy.B=svy.qB, x.tot=NULL,
+ form.x=~Eth+Sex+Age-1, cal.method="linear")
> svytable(formula=~Eth, design=out.hz$cal.A)
Eth
A N
74.23237 85.74661
> svytable(formula=~Eth, design=out.hz$cal.B)
Eth
A N
74.23237 85.74661
>
> svytable(formula=~Sex, design=out.hz$cal.A)
Sex
F M
85.90367 74.07531
> svytable(formula=~Sex, design=out.hz$cal.B)
Sex
F M
85.90367 74.07531
>
> #-----------------------------------------------------
> # example (3)
> # Harmonizazion wrt the joint distribution of 'Sex' vs. 'Age'
> # and the marginal distribution of 'Eth'
> # using raking
>
> # vector of population total known
> # estimated from the full data set
> # note the formula!
> tot.m <- colSums(model.matrix(~Eth+(Sex:Age-1)-1, data=quine))
> tot.m
EthA EthN SexF:AgeF0 SexM:AgeF0 SexF:AgeF1 SexM:AgeF1 SexF:AgeF2
69 77 10 17 32 14 19
SexM:AgeF2 SexF:AgeF3 SexM:AgeF3
21 19 14
>
> out.hz <- harmonize.x(svy.A=svy.qA, svy.B=svy.qB, x.tot=tot.m,
+ form.x=~Eth+(Sex:Age)-1, cal.method="raking")
>
> summary(out.hz$weights.A) #check for negative weights
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.213 1.614 1.901 2.086 2.282 7.007
> summary(out.hz$weights.B) #check for negative weights
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.121 1.475 1.539 1.640 1.716 3.638
>
> tot.m
EthA EthN SexF:AgeF0 SexM:AgeF0 SexF:AgeF1 SexM:AgeF1 SexF:AgeF2
69 77 10 17 32 14 19
SexM:AgeF2 SexF:AgeF3 SexM:AgeF3
21 19 14
> svytable(formula=~Eth, design=out.hz$cal.A)
Eth
A N
69 77
> svytable(formula=~Eth, design=out.hz$cal.B)
Eth
A N
69 77
>
> svytable(formula=~Sex+Age, design=out.hz$cal.A)
Age
Sex F0 F1 F2 F3
F 10 32 19 19
M 17 14 21 14
> svytable(formula=~Sex+Age, design=out.hz$cal.B)
Age
Sex F0 F1 F2 F3
F 10 32 19 19
M 17 14 21 14
>
> #-----------------------------------------------------
> # example (4)
> # Harmonizazion wrt the joint distribution
> # of ('Sex' x 'Age' x 'Eth')
>
> # vector of population total known
> # estimated from the full data set
> # note the formula!
> tot.m <- colSums(model.matrix(~Eth:Sex:Age-1, data=quine))
> tot.m
EthA:SexF:AgeF0 EthN:SexF:AgeF0 EthA:SexM:AgeF0 EthN:SexM:AgeF0 EthA:SexF:AgeF1
5 5 8 9 15
EthN:SexF:AgeF1 EthA:SexM:AgeF1 EthN:SexM:AgeF1 EthA:SexF:AgeF2 EthN:SexF:AgeF2
17 5 9 9 10
EthA:SexM:AgeF2 EthN:SexM:AgeF2 EthA:SexF:AgeF3 EthN:SexF:AgeF3 EthA:SexM:AgeF3
11 10 9 10 7
EthN:SexM:AgeF3
7
>
> out.hz <- harmonize.x(svy.A=svy.qA, svy.B=svy.qB, x.tot=tot.m,
+ form.x=~Eth:Sex:Age-1, cal.method="linear")
Error in solve.default(Tmat, population - sample.total) :
Lapack routine dgesv: system is exactly singular: U[1,1] = 0
Calls: harmonize.x ... regcalibrate.survey.design2 -> solve -> solve -> solve.default
Execution halted
Flavors: r-devel-linux-x86_64-debian-clang, r-devel-linux-x86_64-debian-gcc
Version: 1.2.5
Check: examples
Result: ERROR
Running examples in ‘StatMatch-Ex.R’ failed
The error most likely occurred in:
> ### Name: harmonize.x
> ### Title: Harmonizes the marginal (joint) distribution of a set of
> ### variables observed independently in two sample surveys referred to
> ### the same target population
> ### Aliases: harmonize.x
> ### Keywords: survey
>
> ### ** 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, c("Eth","Sex","Age","Lrn")]
> quine.B <- quine[-lab.A, c("Eth","Sex","Age","Days")]
>
> # create svydesign objects
> require(survey)
> quine.A$f <- 70/nrow(quine) # sampling fraction
> quine.B$f <- (nrow(quine)-70)/nrow(quine)
> svy.qA <- svydesign(~1, fpc=~f, data=quine.A)
> svy.qB <- svydesign(~1, fpc=~f, data=quine.B)
>
> #------------------------------------------------------
> # example (1)
> # Harmonizazion of the distr. of Sex vs. Age
> # usign poststratification
>
> # (1.a) known population totals
> # the population toatal are computed on the full data frame
> tot.sex.age <- xtabs(~Sex+Age, data=quine)
> tot.sex.age
Age
Sex F0 F1 F2 F3
F 10 32 19 19
M 17 14 21 14
>
> out.hz <- harmonize.x(svy.A=svy.qA, svy.B=svy.qB, form.x=~Sex+Age,
+ x.tot=tot.sex.age, cal.method="poststratify")
>
> tot.A <- xtabs(out.hz$weights.A~Sex+Age, data=quine.A)
> tot.B <- xtabs(out.hz$weights.B~Sex+Age, data=quine.B)
>
> tot.sex.age-tot.A
Age
Sex F0 F1 F2 F3
F 0.000000e+00 0.000000e+00 0.000000e+00 3.552714e-15
M 0.000000e+00 1.776357e-15 0.000000e+00 1.776357e-15
> tot.sex.age-tot.B
Age
Sex F0 F1 F2 F3
F 1.776357e-15 7.105427e-15 3.552714e-15 0.000000e+00
M 0.000000e+00 1.776357e-15 0.000000e+00 1.776357e-15
>
> # (1.b) unknown population totals (x.tot=NULL)
> # the population total is estimated by combining totals from the
> # two surveys
>
> out.hz <- harmonize.x(svy.A=svy.qA, svy.B=svy.qB, form.x=~Sex+Age,
+ x.tot=NULL, cal.method="poststratify")
>
> tot.A <- xtabs(out.hz$weights.A~Sex+Age, data=quine.A)
> tot.B <- xtabs(out.hz$weights.B~Sex+Age, data=quine.B)
>
> tot.A
Age
Sex F0 F1 F2 F3
F 10.28186 34.20440 21.01076 20.40665
M 18.23188 14.74015 25.91609 15.18719
> tot.A-tot.B
Age
Sex F0 F1 F2 F3
F 0.000000e+00 7.105427e-15 3.552714e-15 0.000000e+00
M 3.552714e-15 -1.776357e-15 3.552714e-15 1.776357e-15
>
> #-----------------------------------------------------
> # example (2)
> # Harmonizazion wrt the maginal distribution
> # of 'Eth', 'Sex' and 'Age'
> # using linear calibration
>
> # (2.a) vector of population total known
> # estimated from the full data set
> # note the formula! only marginal distribution of the
> # variables are considered
> tot.m <- colSums(model.matrix(~Eth+Sex+Age-1, data=quine))
> tot.m
EthA EthN SexM AgeF1 AgeF2 AgeF3
69 77 66 46 40 33
>
> out.hz <- harmonize.x(svy.A=svy.qA, svy.B=svy.qB, x.tot=tot.m,
+ form.x=~Eth+Sex+Age-1, cal.method="linear")
>
> summary(out.hz$weights.A) #check for negative weights
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.568 1.702 1.783 2.086 2.582 2.756
> summary(out.hz$weights.B) #check for negative weights
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.382 1.496 1.534 1.640 1.666 2.362
>
> tot.m
EthA EthN SexM AgeF1 AgeF2 AgeF3
69 77 66 46 40 33
> svytable(formula=~Eth, design=out.hz$cal.A)
Eth
A N
69 77
> svytable(formula=~Eth, design=out.hz$cal.B)
Eth
A N
69 77
>
> svytable(formula=~Sex, design=out.hz$cal.A)
Sex
F M
80 66
> svytable(formula=~Sex, design=out.hz$cal.B)
Sex
F M
80 66
>
> # Note: margins are equal but joint distributions are not!
> svytable(formula=~Sex+Age, design=out.hz$cal.A)
Age
Sex F0 F1 F2 F3
F 4.705437 40.527446 17.099963 17.667154
M 22.294563 5.472554 22.900037 15.332846
> svytable(formula=~Sex+Age, design=out.hz$cal.B)
Age
Sex F0 F1 F2 F3
F 15.59309 27.73043 17.54011 19.13637
M 11.40691 18.26957 22.45989 13.86363
>
> # (2.b) vector of population total unknown
> out.hz <- harmonize.x(svy.A=svy.qA, svy.B=svy.qB, x.tot=NULL,
+ form.x=~Eth+Sex+Age-1, cal.method="linear")
> svytable(formula=~Eth, design=out.hz$cal.A)
Eth
A N
74.23237 85.74661
> svytable(formula=~Eth, design=out.hz$cal.B)
Eth
A N
74.23237 85.74661
>
> svytable(formula=~Sex, design=out.hz$cal.A)
Sex
F M
85.90367 74.07531
> svytable(formula=~Sex, design=out.hz$cal.B)
Sex
F M
85.90367 74.07531
>
> #-----------------------------------------------------
> # example (3)
> # Harmonizazion wrt the joint distribution of 'Sex' vs. 'Age'
> # and the marginal distribution of 'Eth'
> # using raking
>
> # vector of population total known
> # estimated from the full data set
> # note the formula!
> tot.m <- colSums(model.matrix(~Eth+(Sex:Age-1)-1, data=quine))
> tot.m
EthA EthN SexF:AgeF0 SexM:AgeF0 SexF:AgeF1 SexM:AgeF1 SexF:AgeF2
69 77 10 17 32 14 19
SexM:AgeF2 SexF:AgeF3 SexM:AgeF3
21 19 14
>
> out.hz <- harmonize.x(svy.A=svy.qA, svy.B=svy.qB, x.tot=tot.m,
+ form.x=~Eth+(Sex:Age)-1, cal.method="raking")
>
> summary(out.hz$weights.A) #check for negative weights
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.213 1.614 1.901 2.086 2.282 7.007
> summary(out.hz$weights.B) #check for negative weights
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.121 1.475 1.539 1.640 1.716 3.638
>
> tot.m
EthA EthN SexF:AgeF0 SexM:AgeF0 SexF:AgeF1 SexM:AgeF1 SexF:AgeF2
69 77 10 17 32 14 19
SexM:AgeF2 SexF:AgeF3 SexM:AgeF3
21 19 14
> svytable(formula=~Eth, design=out.hz$cal.A)
Eth
A N
69 77
> svytable(formula=~Eth, design=out.hz$cal.B)
Eth
A N
69 77
>
> svytable(formula=~Sex+Age, design=out.hz$cal.A)
Age
Sex F0 F1 F2 F3
F 10 32 19 19
M 17 14 21 14
> svytable(formula=~Sex+Age, design=out.hz$cal.B)
Age
Sex F0 F1 F2 F3
F 10 32 19 19
M 17 14 21 14
>
> #-----------------------------------------------------
> # example (4)
> # Harmonizazion wrt the joint distribution
> # of ('Sex' x 'Age' x 'Eth')
>
> # vector of population total known
> # estimated from the full data set
> # note the formula!
> tot.m <- colSums(model.matrix(~Eth:Sex:Age-1, data=quine))
> tot.m
EthA:SexF:AgeF0 EthN:SexF:AgeF0 EthA:SexM:AgeF0 EthN:SexM:AgeF0 EthA:SexF:AgeF1
5 5 8 9 15
EthN:SexF:AgeF1 EthA:SexM:AgeF1 EthN:SexM:AgeF1 EthA:SexF:AgeF2 EthN:SexF:AgeF2
17 5 9 9 10
EthA:SexM:AgeF2 EthN:SexM:AgeF2 EthA:SexF:AgeF3 EthN:SexF:AgeF3 EthA:SexM:AgeF3
11 10 9 10 7
EthN:SexM:AgeF3
7
>
> out.hz <- harmonize.x(svy.A=svy.qA, svy.B=svy.qB, x.tot=tot.m,
+ form.x=~Eth:Sex:Age-1, cal.method="linear")
Error in solve.default(Tmat, population - sample.total) :
Lapack routine dgesv: system is exactly singular: U[1,1] = 0
Calls: harmonize.x ... regcalibrate.survey.design2 -> solve -> solve -> solve.default
Execution halted
Flavors: r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-devel-windows-ix86+x86_64