diff -Nru r-cran-gss-2.2-1/ChangeLog r-cran-gss-2.2-2/ChangeLog --- r-cran-gss-2.2-1/ChangeLog 2020-05-16 19:51:01.000000000 +0000 +++ r-cran-gss-2.2-2/ChangeLog 2020-05-26 04:21:51.000000000 +0000 @@ -1,3 +1,11 @@ +Tue May 26 00:21:21 EDT 2020, Chong Gu + + * DESCRIPTION: Version 2.2-2. + + * R: Added sscomp and sscomp2. + + * man: Added documentation for sscomp and sscomp2. + Sat May 16 15:49:33 EDT 2020, Chong Gu * DESCRIPTION: Version 2.2-1. diff -Nru r-cran-gss-2.2-1/debian/changelog r-cran-gss-2.2-2/debian/changelog --- r-cran-gss-2.2-1/debian/changelog 2020-05-21 17:17:20.000000000 +0000 +++ r-cran-gss-2.2-2/debian/changelog 2020-06-01 20:13:45.000000000 +0000 @@ -1,3 +1,9 @@ +r-cran-gss (2.2-2-1) unstable; urgency=medium + + * New upstream release + + -- Dirk Eddelbuettel Mon, 01 Jun 2020 15:13:45 -0500 + r-cran-gss (2.2-1-1) unstable; urgency=medium * New upstream release diff -Nru r-cran-gss-2.2-1/DESCRIPTION r-cran-gss-2.2-2/DESCRIPTION --- r-cran-gss-2.2-1/DESCRIPTION 2020-05-17 17:00:02.000000000 +0000 +++ r-cran-gss-2.2-2/DESCRIPTION 2020-05-26 05:20:03.000000000 +0000 @@ -1,6 +1,6 @@ Package: gss -Version: 2.2-1 -Date: 2020-05-16 +Version: 2.2-2 +Date: 2020-05-26 Title: General Smoothing Splines Author: Chong Gu Maintainer: Chong Gu @@ -8,7 +8,7 @@ Description: A comprehensive package for structural multivariate function estimation using smoothing splines. License: GPL (>= 2) -Packaged: 2020-05-16 19:52:14 UTC; chong +Packaged: 2020-05-26 04:26:48 UTC; chong NeedsCompilation: yes Repository: CRAN -Date/Publication: 2020-05-17 17:00:02 UTC +Date/Publication: 2020-05-26 05:20:03 UTC diff -Nru r-cran-gss-2.2-1/INDEX r-cran-gss-2.2-2/INDEX --- r-cran-gss-2.2-1/INDEX 2020-04-30 16:56:11.000000000 +0000 +++ r-cran-gss-2.2-2/INDEX 2020-05-26 03:45:28.000000000 +0000 @@ -42,6 +42,8 @@ cpssden Evaluating 1-D conditional cdf of ssden estimates cqssden Evaluating 1-D conditional quantiles of ssden estimates print.ssden Print function for ssden objects +sscomp Estimating composition with one sample +sscomp2 Estimating composition with multiple samples sscden Estimating conditional density using smoothing splines d.sscden Evaluating pdf of sscden estimates diff -Nru r-cran-gss-2.2-1/man/sscomp.Rd r-cran-gss-2.2-2/man/sscomp.Rd --- r-cran-gss-2.2-1/man/sscomp.Rd 1970-01-01 00:00:00.000000000 +0000 +++ r-cran-gss-2.2-2/man/sscomp.Rd 2020-05-26 04:26:40.000000000 +0000 @@ -0,0 +1,33 @@ +\name{sscomp} +\alias{sscomp} +\alias{sscomp2} +\title{Composition Estimation} +\description{ + Estimate composition using multinomial counts. +} +\usage{ +sscomp(x,wt=rep(1,length(x)),alpha=1.4) + +sscomp2(x,alpha=1.4) +} +\arguments{ + \item{x}{Numerical vector or matrix of multinomial counts.} + \item{wt}{Numerical vector of integration weights.} + \item{alpha}{Parameter defining cross-validation score for smoothing + parameter selection.} +} +\details{ + \code{sscomp} takes a vector \code{x} to estimate composition using + density estimation on a nominal discrete domain; zero counts must be + included in \code{x} to specify the domain. \code{wt} mimicking the + shape of the unknown density could improve performance. + + \code{sscomp2} takes a matrix \code{x}, collapses columns to + estimate a density using \code{sscomp}, then using that as \code{wt} + in further \code{sscomp} calls to estimate composition for each + column. +} +\references{ + Gu, C. (2020), Composition estimation via shrinkage. + \emph{manuscript}. +} diff -Nru r-cran-gss-2.2-1/MD5 r-cran-gss-2.2-2/MD5 --- r-cran-gss-2.2-1/MD5 2020-05-17 17:00:02.000000000 +0000 +++ r-cran-gss-2.2-2/MD5 2020-05-26 05:20:03.000000000 +0000 @@ -1,7 +1,7 @@ -6959f91986b55fbefdf39cd95ed4b6e3 *ChangeLog -eac28a5d66701a3fdb2d5109219e49ce *DESCRIPTION -0f6b858d42fc1e6af7774e5d4a9c3300 *INDEX -53174290c2c5d3bddfe81254c7abfa53 *NAMESPACE +22fc0985d2cc9446dd1a3c39ab6526d7 *ChangeLog +aa20d4dabee3fd8acde750d7fc5d3d43 *DESCRIPTION +24ff2b8f15521a49b59f6d19146ae6df *INDEX +20c494cb2d9aaa1a65f87cf5afd95df6 *NAMESPACE 1d00015b10d8256aaede525722621ffc *R/cdsscden.R 03873ecc380382307d04da914fb5a866 *R/cdssden.R a4cf561453300bc881519be811e6e36c *R/dsscden.R @@ -49,6 +49,7 @@ 9be84d7ff1b4e8a5922bd678ace8b40f *R/ssanova9.R edb14e97f6de2cb36d610cc02725ba3a *R/sscden.R 40ddb4f3d1511288c96182020673fa15 *R/sscden1.R +1cbca9d45e7d735cd750a1f29c8b786a *R/sscomp.R 58bfc87ec8debc40bdf3ad95f4df085e *R/sscopu.R 111d09029fc69db43413326a418fb286 *R/sscopu2.R b9fad02c0244197802cc8fd0fcdde239 *R/sscox.R @@ -136,6 +137,7 @@ e2f739c757a04a968ec837b15ed91985 *man/ssanova0.Rd e54aa57ed8c94851cb790cd9de84b871 *man/ssanova9.Rd a56a56fb459ddc58c95c27e8b9e37ef8 *man/sscden.Rd +a89272e0fa273b6524da0e23574f96bb *man/sscomp.Rd 142a1be80d200caf0cbd80218c2db7bc *man/sscopu.Rd 4df29e6fff4a4655285f24904cb212c3 *man/sscox.Rd 97f4d0c57cfa8fac287275a9588eca88 *man/ssden.Rd diff -Nru r-cran-gss-2.2-1/NAMESPACE r-cran-gss-2.2-2/NAMESPACE --- r-cran-gss-2.2-1/NAMESPACE 2020-05-02 19:09:23.000000000 +0000 +++ r-cran-gss-2.2-2/NAMESPACE 2020-05-26 03:42:50.000000000 +0000 @@ -10,7 +10,7 @@ predict1, predict9, project, psscden, pssden, qsscden, qssden, smolyak.quad, smolyak.size, ssanova, ssanova0, ssanova9, sscden, sscden1, sscox, ssden, ssden1, sshzd, sshzd1, ssllrm, - survexp.sshzd) + survexp.sshzd,sscomp,sscomp2) export(sscopu, sscopu2, dsscopu, cdsscopu, cpsscopu, cqsscopu, sshzd2d, sshzd2d1, hzdrate.sshzd2d, survexp.sshzd2d) # export internal functions used in examples diff -Nru r-cran-gss-2.2-1/R/sscomp.R r-cran-gss-2.2-2/R/sscomp.R --- r-cran-gss-2.2-1/R/sscomp.R 1970-01-01 00:00:00.000000000 +0000 +++ r-cran-gss-2.2-2/R/sscomp.R 2020-05-26 03:28:36.000000000 +0000 @@ -0,0 +1,48 @@ +## Composition estimation with one sample +sscomp <- function(x,wt=rep(1,length(x)),alpha=1.4) +{ + ## Check inputs + if ((nlvl <- length(x))<3) + stop("gss error in sscomp: length of x should be 3 or more") + if (length(x)!=length(wt)) + stop("gss error in sscomp: x and wt mismatch in lengths") + ## Generate terms + cnt <- x + x <- as.factor(1:nlvl) + mf <- model.frame(~x) + term <- mkterm(mf,NULL) + rk <- term$x$rk + x.basis <- x[-nlvl] + r <- rk$fun(x.basis,x,nu=1,env=rk$env,out=TRUE) + q <- r[,-nlvl] + qd.wt <- as.vector(wt) + ## Fit the model + nt <- b.wt <- 1 + t.wt <- matrix(1,nlvl,1) + bias0 <- list(nt=nt,wt=b.wt,qd.wt=t.wt) + z <- sspdsty(NULL,r,q,cnt,NULL,r,qd.wt,1e-7,30,alpha,bias0) + ## return fitted probabilities + fit <- exp(t(r)%*%z$c)*qd.wt + rownames(fit) <- rownames(x) + fit/sum(fit) +} +## Composition estimation with a matrix input +sscomp2 <- function(x,alpha=1.4) +{ + if (!is.matrix(x)) + stop("gss error in sscomp2: x should be a matrix") + if (min(x)<0) + stop("gss error in sscomp2: x should have non-negative entries") + if (any(apply(x,2,sum)==0)) + stop("gss error in sscomp2: column totals of x must be positive") + nlvl <- dim(x)[1] + yy <- apply(x,1,sum) + p0 <- sscomp(yy) + fit <- NULL + for (i in 1:dim(x)[2]) { + fit <- cbind(fit,sscomp(x[,i],p0,alpha)) + } + rownames(fit) <- rownames(x) + colnames(fit) <- colnames(x) + fit +}