-
-
Save akbertram/1f22728f17cf29ed061f1abb9f3162d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function(beta, X, y, offset, theta, lambda, S, fact = c(1,1)){ | |
n <- dim(X)[1] | |
eta <- offset + X%*%beta | |
mu <- exp(eta) | |
aux1 <- theta + y | |
aux2 <- theta + mu | |
## pull the log inside to use gamma and factorial in log space due to | |
## possibly very high numbers | |
l <- sum(lgamma(aux1) - (lfactorial(y) + lgamma(theta))) + t(y) %*% eta + n*theta*log(theta) - t(aux1) %*% log(aux2) | |
pen <- t(beta) %*% S %*% beta | |
return((-1/fact[1] * l[1]) + (1/fact[2] * lambda*pen[1,1])) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> resetProfiler() | |
> | |
> do.call(f, fargs) | |
[1] 13436.764099638114 | |
> | |
> Completed in 0.0 minutes | |
TOP-LEVEL FUNCTION CALLS | |
================== | |
Function Count Time Own Time % kb Alloc | |
R do.call 1 337 27 8% 201.0 kb | |
R print 1 0 0 0% | |
B resetProfiler 1 0 0 0% | |
FUNCTION CALLS BY OWN TIME | |
========================== | |
Function Count Time Own Time % kb Alloc | |
R selectMethod 7 98 97 29% 1.3 mb | |
C Csparse_dense_prod 1 49 48 14% 173.4 kb | |
C dgeMatrix_matrix_mm 3 29 28 8% 848.5 kb | |
R do.call 1 337 27 8% 201.0 kb | |
R .M.vectorSub 1 21 20 6% | |
B return 600 44 17 5% 95.1 kb | |
B .Call 443 122 6 2% 11.7 kb | |
B length 305 5 5 2% 39.3 kb | |
C Csparse_dense_crossprod 2 5 4 1% 18.8 kb | |
B exp 2 5 4 1% 10.3 kb | |
R identical 851 27 3 1% | |
B dim 3 3 3 1% 12.8 kb | |
B standardGeneric 22 418 3 1% 2.8 kb | |
R eval 15 9 3 1% | |
R .findInheritedMethods 1 13 3 1% 15.2 kb | |
R t.default 8 3 3 1% | |
B lgamma 3 2 2 1% | |
B names 209 2 2 1% 24.8 kb | |
R deparse 5 3 2 1% | |
R topenv 95 8 2 1% | |
R getClassDef 211 15 2 1% | |
B as.character 356 2 2 1% 6.5 kb | |
B @<- 44 10 1 1% | |
B dimnames 2 1 1 0% 9.2 kb | |
R .requirePackage 87 3 1 0% | |
B log 5 3 1 0% | |
B c 93 19 1 0% 2.8 kb | |
B sum 6 4 1 0% | |
R match 181 2 1 0% | |
B UseMethod 42 7 1 0% | |
R el 89 1 1 0% | |
R exists 144 1 0 0% 1.1 kb | |
R is 63 13 0 0% | |
R mget 1 0 0 0% | |
R callGeneric 10 11 0 0% | |
R possibleExtends 46 2 0 0% 9.8 kb | |
R print.default 1 0 0 0% | |
B attr 245 0 0 0% | |
R get 51 0 0 0% | |
R .identC 300 2 0 0% | |
R options 97 0 0 0% | |
R as 17 115 0 0% | |
R nchar 99 0 0 0% 19.7 kb | |
R getOption 97 1 0 0% | |
R getClass 88 5 0 0% | |
R nzchar 99 1 0 0% | |
R structure 6 2 0 0% 1.3 kb | |
R .asCoerceMethod 5 15 0 0% | |
R .mergeAttrs 11 1 0 0% | |
R parent.frame 133 0 0 0% | |
R .classEnv 37 3 0 0% | |
R callNextMethod 1 158 0 0% | |
B @ 339 0 0 0% | |
R .findNextFromTable 1 136 0 0% | |
R .makeAsMethod 4 4 0 0% | |
B is.na 187 0 0 0% 1.6 kb | |
R packageSlot 244 1 0 0% | |
R checkAtAssignment 44 4 0 0% | |
R validObject 2 20 0 0% | |
R as<- 1 14 0 0% | |
R .getClassFromCache 88 1 0 0% | |
B is.null 500 0 0 0% | |
B is.character 345 0 0 0% | |
R paste 20 0 0 0% | |
R asS4 12 2 0 0% | |
R as.list.default 10 0 0 0% | |
R elNamed 66 2 0 0% | |
B getNamespace 87 0 0 0% | |
B missing 220 0 0 0% | |
R getGenericFromCall 10 0 0 0% | |
B attributes 220 2 0 0% | |
B class 173 0 0 0% | |
R parent.env 95 0 0 0% | |
R sys.call 31 0 0 0% | |
B attributes<- 19 0 0 0% | |
B isNamespace 190 0 0 0% | |
R .getGeneric 9 1 0 0% | |
R seq.default 8 0 0 0% | |
B is.environment 103 0 0 0% | |
R .getMethodsTable 25 0 0 0% | |
R %in% 25 0 0 0% | |
R environment 51 0 0 0% | |
R .dataSlot 11 0 0 0% | |
R sys.parent 21 0 0 0% | |
B list 70 0 0 0% | |
B names<- 17 0 0 0% | |
R setDataPart 11 4 0 0% | |
B any 16 0 0 0% | |
R typeof 36 0 0 0% | |
R .matchSigLength 11 0 0 0% | |
B is.object 64 0 0 0% | |
R initialize 12 278 0 0% | |
R inherits 14 0 0 0% | |
B rep 2 0 0 0% | |
R extends 3 1 0 0% | |
R mode 13 0 0 0% | |
R tryCatch 10 0 0 0% | |
R as.function.default 9 0 0 0% | |
B dim<- 3 0 0 0% | |
R seq_along 8 0 0 0% | |
C Dim_validate 1 0 0 0% | |
B dimnames<- 2 0 0 0% | |
R .classDefEnv 63 2 0 0% | |
R .nextMethod 1 19 0 0% | |
B attr<- 16 0 0 0% | |
B nargs 37 0 0 0% | |
R .ChangeFormals 4 1 0 0% | |
R .class1 19 0 0 0% | |
R pmatch 5 0 0 0% 1.0 kb | |
R array 2 0 0 0% | |
R doTryCatch 10 0 0 0% | |
B resetProfiler 1 0 0 0% | |
R .cacheMethodInTable 11 1 0 0% | |
B is.numeric 1 4 0 0% | |
B substitute 2 0 0 0% | |
B prod 2 0 0 0% | |
R new 12 279 0 0% | |
B min 1 0 0 0% | |
R as.name 11 0 0 0% | |
R formals 21 0 0 0% | |
B is.list 108 0 0 0% | |
B is.logical 48 0 0 0% | |
B baseenv 205 0 0 0% | |
R as.vector 6 0 0 0% | |
R character 7 0 0 0% | |
C dgeMatrix_validate 1 0 0 0% | |
R unique.default 1 0 0 0% | |
R packageSlot<- 11 0 0 0% | |
R getGeneric 9 2 0 0% | |
R assign 13 0 0 0% | |
R .sigLabel 20 0 0 0% | |
R rev.default 3 0 0 0% | |
R .local 5 0 0 0% | |
R vapply 1 0 0 0% | |
R getSlots 11 2 0 0% | |
B is.function 28 0 0 0% | |
R .eligibleSuperClasses 1 0 0 0% | |
R tryCatchList 10 0 0 0% | |
B is.expression 22 0 0 0% | |
R .quickCoerceSelect 7 2 0 0% | |
R body 14 0 0 0% | |
R .duplicateClassesExist 12 0 0 0% | |
C dMatrix_validate 1 0 0 0% | |
R anyDuplicated.default 2 0 0 0% | |
R .findMethodInTable 7 2 0 0% | |
R cacheMethod 6 1 0 0% | |
B emptyenv 190 0 0 0% | |
R .inheritedArgsExpression 1 3 0 0% | |
R .getGenericSigLength 11 0 0 0% | |
R tryCatchOne 10 0 0 0% | |
R .asS4 12 2 0 0% | |
R slot<- 9 0 0 0% | |
R .methodPackageSlots 11 0 0 0% | |
R as.function 9 1 0 0% | |
R seq 8 0 0 0% | |
R asMethod 7 1 0 0% | |
R getDataPart 2 0 0 0% | |
B as.logical 1 0 0 0% | |
B isS4 31 0 0 0% | |
C dimNames_validate 1 0 0 0% | |
R checkSlotAssignment 4 0 0 0% | |
R body<- 9 2 0 0% | |
R as.list 10 0 0 0% | |
B is.pairlist 15 0 0 0% | |
R .deparseOpts 5 0 0 0% | |
B as.integer 2 0 0 0% | |
R t 8 3 0 0% | |
R dimNamesCheck 1 1 0 0% | |
B quote 29 0 0 0% | |
R Matrix.msg 2 0 0 0% | |
R .getGenericFromCacheTable 2 0 0 0% | |
R slot 14 0 0 0% | |
R getMethodsForDispatch 7 0 0 0% | |
R fromNextMethod 10 0 0 0% | |
R .newSignature 1 2 0 0% | |
R ncol 1 0 0 0% | |
R try 10 0 0 0% | |
B as.environment 7 0 0 0% | |
R anyStrings 4 14 0 0% | |
R .allowPrimitiveMethods 2 0 0 0% | |
R .getGenericFromCache 2 0 0 0% | |
R match.call 1 0 0 0% | |
B is.name 13 0 0 0% | |
R validityMethod 4 14 0 0% | |
R is.vector 1 0 0 0% | |
R formalArgs 12 0 0 0% | |
R isClassDef 11 2 0 0% | |
R vector 1 0 0 0% | |
B is.call 13 0 0 0% | |
R unique 1 0 0 0% | |
B on.exit 1 0 0 0% | |
R .fixupDimnames 1 0 0 0% | |
R is.factor 1 0 0 0% | |
R match.fun 1 0 0 0% | |
R print 1 0 0 0% | |
R addNextMethod 1 137 0 0% | |
R anyDuplicated 2 0 0 0% | |
R lfactorial 1 0 0 0% | |
B seq_len 1 0 0 0% | |
R sys.function 1 0 0 0% | |
R allNames 2 0 0 0% | |
R .simpleInheritanceGeneric 1 0 0 0% | |
R rev 3 0 0 0% | |
R isTRUE 1 4 0 0% | |
LONG RUNNING LOOPS | |
================== | |
Function Iterations Time | |
VECTOR PIPELINER | |
================ | |
Materialization count: 0 | |
Materialization time (ms): 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment