Skip to content

Commit

Permalink
version 0.3-1
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuergin authored and cran-robot committed Jan 4, 2015
1 parent 47ea32b commit 1f851fc
Show file tree
Hide file tree
Showing 30 changed files with 511 additions and 347 deletions.
11 changes: 6 additions & 5 deletions DESCRIPTION
Expand Up @@ -2,8 +2,8 @@ Package: vcrpart
Type: Package
Title: Tree-Based Varying Coefficient Regression for Generalized Linear
and Ordinal Mixed Models
Version: 0.2-3
Date: 2014-11-24
Version: 0.3-1
Date: 2015-01-04
Authors@R: c(
person("Reto", "Buergin", role = c("aut", "cre", "cph"), email = "rbuergin@gmx.ch"),
person("Gilbert", "Ritschard", role = c("ctb", "ths"),
Expand All @@ -14,11 +14,12 @@ License: GPL (>= 2)
Depends: R (>= 3.1.0), parallel, partykit
Imports: stats, grid, graphics, methods, nlme, rpart, numDeriv, ucminf,
zoo, sandwich, strucchange
URL: http://vcrpart.wordpress.com
URL: http://vcrpart.wordpress.com,
https://r-forge.r-project.org/projects/traminer/
LazyLoad: yes
NeedsCompilation: yes
Packaged: 2014-11-25 07:26:37 UTC; reto
Packaged: 2015-01-04 10:34:57 UTC; reto
Author: Reto Buergin [aut, cre, cph],
Gilbert Ritschard [ctb, ths]
Repository: CRAN
Date/Publication: 2014-11-25 09:24:41
Date/Publication: 2015-01-04 12:46:23
57 changes: 29 additions & 28 deletions MD5
@@ -1,20 +1,21 @@
d9422ace5f5ef22d494ef37fbf19f831 *DESCRIPTION
929438bed344b7ec2fc1864a751ff373 *DESCRIPTION
adcba7e46ec21c27cfea94b0454d05f9 *NAMESPACE
dc7c790c64c073850f833738ae0a4f59 *NEWS
0b853ff955861ffa43fd11c9e4785172 *NEWS
8b40e51cf24df0eb99503a7070b84a93 *R/AAA.R
b70bc37834d2f3b8c94d9d1c0020c614 *R/AllGeneric.R
91d50efd23854dea04fca307a8c9ce97 *R/fvcm.R
80b84163397dcda539b20d9ab51c56e7 *R/import.R
0801b64fedea58af67c400f8b0e15bd2 *R/olmm-methods.R
7e4d28175b9184bf3a0992401f277072 *R/olmm-utils.R
5658d937bde2aabee0e4493cdc76e85f *R/olmm-methods.R
8057fd21604296b718055bd3dbb4f370 *R/olmm-utils.R
ecdcf046dcbb466c4cf29bc7e9efaf8a *R/olmm.R
f4e45051571cc6994e06109412d540af *R/otsplot.R
2af1d39305eedf8fc4128b14307e1317 *R/tvcm-cv.R
32a6d478af156ed579d5909795d5cc98 *R/tvcm-methods.R
c1191337d41d4dc145e7ec221acd6ae0 *R/tvcm-methods.R
d7de761ae5514253233d0540ddd85ec5 *R/tvcm-plot.R
cd08110234d8f5bbcb6833bab79abad8 *R/tvcm-utils.R
efa265167aaa866b67a1acd78df5a859 *R/tvcm.R
a19aaa41484d924fb4aeeed7588d851c *R/tvcm-utils.R
282d16856de0ec13cfbbbac8b57cf091 *R/tvcm.R
645eb28d9f7e8259dfb5edf34edbb34b *R/utils.R
dcc3606dae744cc31c166c3895363003 *ToDo
8562fccdfc9dc113b72f8eb8df66bf57 *data/PL.RData
a2c9a87cf50549fd5802cbb6a88d281a *data/movie.RData
72890e1f368da6d42d9cf9414c5396e0 *data/poverty.RData
Expand All @@ -23,31 +24,31 @@ ea62be4e5d10df5bc683725a7f7935f6 *data/schizo.RData
80e2db657049956161e19e3e3c2bdd32 *data/vcrpart_1.RData
cb803decf95c39567f648e1e5e0ddb45 *data/vcrpart_2.RData
3ddf5ac69dc37253946b83c5bfd5fca7 *data/vcrpart_3.RData
3cd9ba9d0476859aa2f24592acd9629b *inst/CITATION
3bc5b4abcf89156967fbf807a9125ee6 *man/PL.Rd
7141810b94046f0dbfa66fd3e0477a6a *man/contr-wsum.Rd
02a3675b72ff9f699d45dab0183780b8 *man/fvcm-methods.Rd
9b47db74c740a7be156dce5564cf350f *man/fvcm.Rd
edb080c605c0dacb43ae037d6199abd4 *man/movie.Rd
c957bcc9e1c02457a3e2c0a3b3434c7c *inst/CITATION
2d7f2b0ce2324e387983211e19ac55cc *man/PL.Rd
79349138eb3456f71d2b2f9d1121d572 *man/contr-wsum.Rd
1e6b881c70bc9464f3f870ebd929be25 *man/fvcm-methods.Rd
a10e2af8c56ccd80e774c45b625fbbbb *man/fvcm.Rd
c5210f80a7291c066c5cb99d430c306f *man/movie.Rd
01062811412189130594c3983d1868ee *man/olmm-control.Rd
85658aad587f90ada41ff1808c725904 *man/olmm-gefp.Rd
82d6b519900b895e47ac8bb7fe83971f *man/olmm-methods.Rd
e58a118afbf3ff05498f9e5bbc73e893 *man/olmm-predict.Rd
dc2431d8c17e61515d75bd86c800cbda *man/olmm-gefp.Rd
3ab54e39ac59254729fe58ceac548a8b *man/olmm-methods.Rd
23e05ccd57e17ad0c231caad41210365 *man/olmm-predict.Rd
c914ee5c769aacd190558f0b967f1072 *man/olmm-summary.Rd
99fd9612846185c8b253368ad62640bc *man/olmm.Rd
79da070b250ee6646ecbda2e4d33fcb3 *man/otsplot.Rd
b5d023f2e25d796fc013667de0bf0c2b *man/poverty.Rd
198b4f1a33689dc49700c02f14e42510 *man/schizo.Rd
830a40f120259f6c1e30cce2f06a224e *man/tvcglm.Rd
fc4d871d97b9315c31c720307d4b481c *man/tvcm-control.Rd
5b0157aea2925e83c7325814864fad14 *man/tvcm-cv.Rd
c2434053aa241bce6f70d969bf385e25 *man/tvcm-methods.Rd
0fa2459d031af80f1b4dbd7d3d1da797 *man/tvcm-plot.Rd
395961700e672d7ba7f7901564e83892 *man/tvcm.Rd
81b709a611fe8b1ac9d3d6ebb806bab2 *man/tvcolmm.Rd
5a0c35b431a537a976ff45eb197c7be9 *man/olmm.Rd
1d5c9b3c457d06bf33220267be476307 *man/otsplot.Rd
fe34790a447d3e5e8245fb0c0669c51c *man/poverty.Rd
bce49a4bfca2f33530e20dcb8adf800b *man/schizo.Rd
b1a8ea0cfa6a3e1e62435be8ce9f405e *man/tvcglm.Rd
7dfdeb548a05ed57530085f9718d6464 *man/tvcm-control.Rd
7d2b4dc5887bb05c129579f2a28021a3 *man/tvcm-cv.Rd
0320ab676aaf77e818adc0ff4fa92c37 *man/tvcm-methods.Rd
41720b3b0902b0340e55b55495d7311d *man/tvcm-plot.Rd
e7e5e2934a4d2214baa75e89f6002b48 *man/tvcm.Rd
c9e55e6137afe94e96cbf08c9eda6a69 *man/tvcolmm.Rd
158d7c7045232f33bd35bf5c39dcedcf *man/vcrpart-demo.Rd
a14ef1287c994bf09c716cc21d50517f *man/vcrpart-formula.Rd
1e0af65b11fb043bd18f7982291d076f *src/Makevars
8d46d69896a1f1d31ed76035a0e49d67 *src/Makevars
e0ee3aca34161fb42f8fffa717fc6c3e *src/init.c
62783432fffd5da456a3bb3e61c2be35 *src/olmm.c
1e5f560c59e4ea73b51fa72c057166ec *src/olmm.h
Expand Down
35 changes: 28 additions & 7 deletions NEWS
@@ -1,12 +1,33 @@
Changes in Version 0.3-1

o Improvements for 'prunepath' method.

o Moved documentation of 'prunepath' to 'tvcm-assessment'.

o Added example for 'prune'.

o Internal changes in 'estfun.olmm' and new argument 'center' for
the function 'predecor_control'.

o New argument 'fast' for 'tvcm_control' to control whether an
approximative or the accurate model is used at exhaustive search.

o Corrected bugs in 'tvcm_exsearch_nomToOrd' and 'tvcm_getNumSplits'
which appeared in in special cases.

o Improved help manual for 'tvcglm' and 'tvcolmm'.

o Revised references.

Changes in Version 0.2-3

o Added contr.wsum function
o Added contr.wsum function.

o Added 'seed' argument to 'otsplot_control'
o Added 'seed' argument to 'otsplot_control'.

o Internal changes for exhaustive search of 'tvcm'
o Internal changes for exhaustive search of 'tvcm'.

o Improved documentation
o Improved documentation.


Changes in Version 0.2-2
Expand All @@ -31,7 +52,7 @@ Changes in Version 0.2-2

o Added 'nimpute' argument for 'tvcm_control'.

o Added detail section to the help page of 'tvcm_control'
o Added detail section to the help page of 'tvcm_control'.

o Removed AIC table from 'print.tvcm' (AIC and BIC seem not
relevant measures for models fitted by 'tvcm').
Expand All @@ -49,7 +70,7 @@ Changes in Version 0.2-1
o First CRAN release.

o 'tvcm' and 'fvcm' allow for multiple 'vc' terms, i.e.
coefficient-specific partitions
coefficient-specific partitions.

o Complete revision of syntaxes, argument names and default
parameters. R commands for the former version 0.1-14 are
Expand All @@ -60,7 +81,7 @@ Changes in Version 0.2-1
(old) coefficient constancy tests combined with greedy loss
minimization to (new) exhaustive greedy loss minimization. Splitting
based on the (old) requires to set the argument 'sctest = TRUE' in
'tvcm_control'
'tvcm_control'.

o The greedy loss reduction minimization stage of 'tvcm' does now
fixate coefficients which are not splitted at the estimates of
Expand Down
47 changes: 25 additions & 22 deletions R/olmm-methods.R
@@ -1,6 +1,6 @@
##' -------------------------------------------------------- #
##' Author: Reto Buergin, rbuergin@gmx.ch
##' Date: 2014-10-24
##' Date: 2014-12-08
##'
##' Description:
##' methods for olmm objects.
Expand Down Expand Up @@ -40,6 +40,7 @@
##' weights: Weights
##'
##' Modifications:
##' 2014-12-07: - add argument 'center' to 'predecor_control'
##' 2014-10-24: - improve simulate.olmm
##' - improved 'estfun.olmm' call in 'gefp.olmm'
##' 2014-10-23: - fix bug in predict.olmm
Expand Down Expand Up @@ -157,20 +158,21 @@ deviance.olmm <- function(object, ...) return(-as.numeric(2.0 * logLik(object)))


predecor_control <- function(impute = TRUE, seed = NULL,
symmetric = TRUE, reltol = 1e-6,
maxit = 250L, minsize = 1L,
symmetric = TRUE, center = FALSE,
reltol = 1e-6, maxit = 250L, minsize = 1L,
verbose = FALSE, silent = FALSE) {
stopifnot(is.logical(impute) && length(impute) == 1L)
stopifnot(is.null(seed) | is.numeric(seed) && length(seed) == 1L)
stopifnot(is.logical(symmetric) && length(symmetric) == 1L)
stopifnot(is.logical(center) && length(center) == 1L)
stopifnot(is.numeric(reltol) && reltol > 0 && length(reltol) == 1L)
stopifnot(is.numeric(maxit) && maxit > 0 && length(maxit) == 1L)
stopifnot(is.numeric(minsize) && minsize > 0 && length(minsize) == 1L)
stopifnot(is.logical(verbose) && length(verbose) == 1L)
stopifnot(is.logical(silent) && length(silent) == 1L)
return(structure(list(impute = impute, seed = seed,
symmetric = symmetric, reltol = reltol,
maxit = maxit, minsize = minsize,
symmetric = symmetric, center = center,
reltol = reltol, maxit = maxit, minsize = minsize,
verbose = verbose, silent = silent),
class = "predecor_control"))
}
Expand Down Expand Up @@ -214,12 +216,12 @@ estfun.olmm <- function(x, predecor = FALSE, control = predecor_control(),
attr <- list() # default attributes

scores <- x$score_obs
subsImp <- rep.int(FALSE, nrow(scores))

if (control$verbose) cat("OK")

## impute data


subsImp <- rep.int(FALSE, nrow(scores))
if (predecor && any(Ni != Nmax)) {

Nimpute <- Nmax - Ni
Expand Down Expand Up @@ -251,21 +253,21 @@ estfun.olmm <- function(x, predecor = FALSE, control = predecor_control(),
x$eta <- rbind(x$eta, matrix(0.0, sum(Nimpute), x$dims["nEta"]))
x$score_obs <- rbind(x$score_obs, matrix(0.0, sum(Nimpute), x$dims["nPar"]))

## simulate responses
if (control$impute) {

if (control$verbose) cat("\n* impute scores ... ")

## set seed
if (!is.null(control$seed)) set.seed(control$seed)
## simulate responses
if (control$verbose) cat("\n* impute scores ... ")

## set seed
if (!is.null(control$seed)) set.seed(control$seed)

if (control$impute) {

## impute predictors
times <- Nimpute[x$subject[!subsImp]]
rows <- unlist(tapply(1:sum(Ni), x$subject[!subsImp], function(x) sample(x, times[x[1L]], replace = TRUE)))
x$frame[subsImp,] <- x$frame[rows,,drop=FALSE]
x$X[subsImp, ] <- x$X[rows,,drop=FALSE]
x$W[subsImp, ] <- x$W[rows,,drop=FALSE]

## draw responses
subsW <- c(rep(which(attr(xOld$W, "merge") == 1L), x$dims["nEta"]),
which(attr(xOld$W, "merge") == 2L))
Expand All @@ -280,15 +282,16 @@ estfun.olmm <- function(x, predecor = FALSE, control = predecor_control(),
ordered(apply(probs, 1L, function(x) sample(yLevs, 1L, prob = x)), yLevs)

## recompute scores
.Call("olmm_update_marg", x, x$coefficients, PACKAGE = "vcrpart")

scores <- 0.0 * x$score_obs
scores[!subsImp, ] <- x$score_obs[!subsImp,,drop=FALSE]

if (control$verbose) cat("OK")
.Call("olmm_update_marg", x, x$coefficients, PACKAGE = "vcrpart")
}
}

scores <- x$score_obs

if (control$center && max(abs(cSums <- colSums(scores))) > 1e-6)
scores <- scores -
matrix(cSums / nrow(scores), nrow(scores), ncol(scores), byrow = TRUE)
}

## drop the nuisance coefficients
scores <- scores[, parm, drop = FALSE]

Expand Down
3 changes: 2 additions & 1 deletion R/olmm-utils.R
Expand Up @@ -543,9 +543,10 @@ olmm_rename <- function(x, levels, family, etalab = c("int", "char", "eta")) {
##' -------------------------------------------------------- #

olmm_decormat <- function(scores, subject, control = predecor_control()) {

stopifnot(inherits(control, "predecor_control"))
Nmax <- max(table(subject))

## estimate variances and covariances
sVar <- olmm_scoreVar(scores, subject)
sCovWin <- olmm_scoreCovWin(scores, subject)
Expand Down
1 change: 1 addition & 0 deletions R/tvcm-methods.R
Expand Up @@ -632,6 +632,7 @@ prune.tvcm <- function(tree, cp = NULL, alpha = NULL, maxstep = NULL,


prunepath.tvcm <- function(tree, steps = 1L, ...) {
steps <- intersect(steps, seq_along(tree$info$prunepath))
rval <- tree$info$prunepath[steps]
rval <- lapply(rval, function(x) {
x$tab <- as.data.frame(x$tab)
Expand Down

0 comments on commit 1f851fc

Please sign in to comment.