Skip to content

Commit

Permalink
Correcting documentation in nobs
Browse files Browse the repository at this point in the history
  • Loading branch information
gvegayon committed Aug 10, 2023
1 parent ef29e2a commit de180d6
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 10 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: defm
Type: Package
Title: Estimation and Simulation of Multi-Binary Response Models
Version: 0.1-0
Version: 0.1-1
Authors@R: c(
person("George", "Vega Yon", role=c("aut", "cre"),
email="[email protected]", comment = c(ORCID = "0000-0002-3171-0844")),
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ README.md: README.Rmd
Rscript --vanilla -e 'rmarkdown::render("README.Rmd")'

.PHONY: build update clean

inst/NEWS: NEWS.md
Rscript -e "rmarkdown::pandoc_convert('NEWS.md', 'plain', output='inst/NEWS')" && \
head -n 80 inst/NEWS
7 changes: 6 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
S3method("+",DEFM)
S3method(as.data.frame,defm_motif_census)
S3method(names,defm_motif_census)
S3method(nobs,DEFM)
S3method(print,DEFM)
S3method(print,defm_motif_census)
export(defm_mle)
Expand All @@ -17,7 +18,6 @@ export(motif_census)
export(ncol_defm_x)
export(ncol_defm_y)
export(new_defm)
export(nobs.DEFM)
export(nobs_defm)
export(nrow_defm)
export(nterms_defm)
Expand All @@ -32,5 +32,10 @@ export(term_defm_transition)
export(term_defm_transition_formula)
import(stats4)
importFrom(Rcpp,sourceCpp)
importFrom(stats,AIC)
importFrom(stats,BIC)
importFrom(stats,coef)
importFrom(stats,nobs)
importFrom(stats,pnorm)
importFrom(stats,vcov)
useDynLib(defm, .registration = TRUE)
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# defm 0.1-1

* Added a `NEWS.md` file to track changes to the package.

* Change how `nobs.DEFM` is documented (per CRAN)

4 changes: 3 additions & 1 deletion R/defm-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,13 @@ new_defm <- function(

}

#' @export
#' @rdname DEFM
#' @param object An object of class [DEFM].
#' @return - `nobs` is an alias for `nobs_defm()`.
#' @param ... Not used.
#' @importFrom stats nobs
#' @export
#' @exportS3Method stats4::nobs
nobs.DEFM <- function(object, ...) {
nobs_defm(object)
}
Expand Down
12 changes: 6 additions & 6 deletions R/defm_mle.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ defm_mle <- function(
}

pval_calc <- function(obj) {
pvals <- -abs(coef(obj)/sqrt(diag(vcov(obj)))) |> pnorm()
pvals * 2
stats::pnorm(-abs(stats::coef(obj)/sqrt(diag(vcov(obj))))) * 2
}

#' @export
Expand All @@ -121,15 +120,16 @@ pval_calc <- function(obj) {
#' with the estimates, se, and pvalues. If `as_texreg = TRUE`, then it will
#' return a texreg object.
#' @rdname defm_mle
#' @importFrom stats AIC BIC coef vcov
summary_table <- function(object, as_texreg = FALSE, ...) {

# Generating the output table
tab <- list(
coef.names = names(coef(object)),
coef = coef(object),
se = sqrt(diag(vcov(object))),
coef.names = names(stats::coef(object)),
coef = stats::coef(object),
se = sqrt(diag(stats::vcov(object))),
gof.names = c("AIC", "BIC", "N"),
gof = c(AIC(object), BIC(object), nobs(object)),
gof = c(stats::AIC(object), stats::BIC(object), stats::nobs(object)),
gof.decimal = c(T,T,F),
pvalues = pval_calc(object)
)
Expand Down
5 changes: 5 additions & 0 deletions inst/NEWS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
defm 0.1-1

- Added a NEWS.md file to track changes to the package.

- Change how nobs.DEFM is documented (per CRAN)
2 changes: 1 addition & 1 deletion man/DEFM.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit de180d6

Please sign in to comment.