Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Revision ae99bafc369d70069d8b0dba6c4ca3bcb30e0800 authored by Wayne Zhang on 10 August 2011, 00:00:00 UTC, committed by Gabor Csardi on 10 August 2011, 00:00:00 UTC
version 0.1-1
0 parent
  • Files
  • Changes
  • 97f8ca8
  • /
  • R
  • /
  • classMethods.R
Raw File Download
Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • directory
  • content
revision badge
swh:1:rev:ae99bafc369d70069d8b0dba6c4ca3bcb30e0800
directory badge Iframe embedding
swh:1:dir:11bcdc05d09a5204a48ea39467507532a4fc3c6a
content badge Iframe embedding
swh:1:cnt:f94093e1c7149526fe114eaa9ce43f19f9bbad95
Citations

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • revision
  • directory
  • content
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
classMethods.R

################################################
# classes defined in the cplm package
################################################

setClassUnion("NullNum",c("NULL","numeric"))
setClassUnion("NullList",c("NULL","list"))	

# class of "cpglm" 
setClass("cpglm", 
 representation(
  coefficients="numeric",
  residuals="numeric",
  fitted.values="numeric",
  weights="NullNum",
  df.residual="integer",
  df.null="integer",
  y="numeric",
  call="call",
  formula="formula",
  #terms="terms",
  data="data.frame",
  offset="NullNum",
  control="list",
  contrasts="NullList",
  theta="matrix",
  vcov="matrix",
  iter="numeric"),
 contains="list" 
)

################################################
# methods defined for cpglm
################################################

# extraction of slots using $
setMethod("$",
    signature(x = "cpglm"),
    function (x, name) 
    {
        slot(x,name)
    }
)

# names to get slot names
setMethod("names",
    signature(x = "cpglm"),
    function (x) 
    {
        return(slotNames(x))
    }
)

# extraction of slots using "[["
setMethod("[[",
    signature(x = "cpglm",i="numeric",j="missing"),
    function (x, i, j, ...) 
    {
	output <- lapply(i, function(y) slot(x,names(x)[y]))
        names(output) <- names(x)[i]
	return(output)
    }
)

setMethod("[[",
    signature(x = "cpglm",i="character",j="missing"),
    function (x, i, j, ...) 
    {
      output <- lapply(1:length(i), function(y) slot(x,i[y]))
      names(output) <- i
      return(output)
    }
)


setMethod("coef",
          signature(object = "cpglm"),
    function (object,...) 
    {
	return(object@coefficients)
    }
)

# variance-covariance matrix as returned by systemfit.
setMethod("vcov",
	signature(object = "cpglm"),
    function (object,...) 
    {
	return(object@vcov)
    }
)


setMethod("residuals",
    signature(object = "cpglm"),
    function (object, ...) 
    {
      return(object@residuals)
    }
)

setMethod("resid",
    signature(object = "cpglm"),
    function (object, ...) 
    {
	return(residuals(object))
    }
)

# generate fitted values on the original scale
setMethod("fitted",
    signature(object = "cpglm"),
    function (object,...) 
    {
      return(object@fitted.values)
    }
)
		
setMethod("fitted.values",
    signature(object = "cpglm"),
    function (object,...) 
    {
      fitted(object)
    }
)


setMethod("show",signature(object = "cpglm"),
	function(object){
		print(summary(object)) 
	}
)

setMethod("summary", signature(object="cpglm"),
	function(object,portfolio=NULL,...){
          
          coef.beta <- coef(object)
          s.err <- sqrt(diag(object@vcov))
          err.beta <- s.err[1:(length(s.err)-2)] 
          tvalue <- coef.beta/err.beta
          dn <- c("Estimate", "Std. Error")             
          pvalue <- 2 * pnorm(-abs(tvalue))
          coef.table <- cbind(coef.beta, err.beta, tvalue, pvalue)  
          dimnames(coef.table) <- list(names(coef.beta), c(dn, 
                "z value", "Pr(>|z|)"))
 
          coef.other <- cbind(object$theta[nrow(object$theta),],s.err)[-(1:length(coef.beta)),]
          dimnames(coef.other) <- list(c("phi","p"),dn) 

          return(list(coef.table,coef.other))

        }
)    
The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Contact— JavaScript license information— Web API

back to top