]> code.communitydata.science - ml_measurement_error_public.git/commitdiff
Merge branch 'master' of code:ml_measurement_error_public
authorNathan TeBlunthuis <nathante@uw.edu>
Sat, 12 Aug 2023 20:10:19 +0000 (13:10 -0700)
committerNathan TeBlunthuis <nathante@uw.edu>
Sat, 12 Aug 2023 20:10:19 +0000 (13:10 -0700)
.gitmodules
misclassificationmodels [new submodule]
overleaf [new submodule]
simulations/measerr_methods.R

index f2d69ab8f26de2440be8b4f03c5348b4fe25b991..9c801ba9863c403162bc32a7a11c24cf37ab7cd1 100644 (file)
@@ -1,3 +1,9 @@
 [submodule "paper"]
        path = paper
        url = git@github.com:chainsawriot/measure.git
+[submodule "overleaf"]
+       path = overleaf
+       url = https://git.overleaf.com/62a956eb9b9254783cc84c82
+[submodule "misclassificationmodels"]
+       path = misclassificationmodels
+       url = https://github.com/chainsawriot/misclassificationmodels.git
diff --git a/misclassificationmodels b/misclassificationmodels
new file mode 160000 (submodule)
index 0000000..1dc39a1
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 1dc39a1af5698e409c7c1d997a8b2fbc06faa6eb
diff --git a/overleaf b/overleaf
new file mode 160000 (submodule)
index 0000000..c5e0a01
--- /dev/null
+++ b/overleaf
@@ -0,0 +1 @@
+Subproject commit c5e0a0171397981e8f6a0ad1ad1ee3ce8e0fa15f
index 92309edaab1bde2e4928cb0cc008fda6725a4b91..98ab28d77aa36a78f484768242f3eba608712e5d 100644 (file)
@@ -23,7 +23,7 @@ likelihood.logistic <- function(model.params, outcome, model.matrix){
 }
 
 ## outcome_formula <- y ~ x + z; proxy_formula <- w_pred ~ y + x + z + x:z + x:y + z:y 
-measerr_mle_dv <- function(df, outcome_formula, outcome_family=binomial(link='logit'), proxy_formula, proxy_family=binomial(link='logit'),method='optim'){
+measerr_mle_dv <- function(df, outcome_formula, outcome_family=binomial(link='logit'), proxy_formula, proxy_family=binomial(link='logit'),maxit=1e6, method='optim'){
     df.obs <- model.frame(outcome_formula, df)
     proxy.model.matrix <- model.matrix(proxy_formula, df)
     proxy.variable <- all.vars(proxy_formula)[1]
@@ -106,7 +106,7 @@ measerr_mle_dv <- function(df, outcome_formula, outcome_family=binomial(link='lo
     names(start) <- params
     
     if(method=='optim'){
-        fit <- optim(start, fn = nll, lower=lower, method='L-BFGS-B', hessian=TRUE, control=list(maxit=1e6))
+        fit <- optim(start, fn = nll, lower=lower, method=optim_method, hessian=TRUE, control=list(maxit=maxit))
     } else {
         quoted.names <- gsub("[\\(\\)]",'',names(start))
         print(quoted.names)
@@ -115,13 +115,13 @@ measerr_mle_dv <- function(df, outcome_formula, outcome_family=binomial(link='lo
         measerr_mle_nll <- eval(parse(text=text))
         names(start) <- quoted.names
         names(lower) <- quoted.names
-        fit <- mle2(minuslogl=measerr_mle_nll, start=start, lower=lower, parnames=params,control=list(maxit=1e6),method='L-BFGS-B')
+        fit <- mle2(minuslogl=measerr_mle_nll, start=start, lower=lower, parnames=params,control=list(maxit=maxit),method=optim_method)
     }
     return(fit)
 }
 
 
-measerr_mle <- function(df, outcome_formula, outcome_family=gaussian(), proxy_formula, proxy_family=binomial(link='logit'), truth_formula, truth_family=binomial(link='logit'),method='optim'){
+measerr_mle <- function(df, outcome_formula, outcome_family=gaussian(), proxy_formula, proxy_family=binomial(link='logit'), truth_formula, truth_family=binomial(link='logit'),method='optim', maxit=1e6, optim_method='L-BFGS-B'){
 
     df.obs <- model.frame(outcome_formula, df)
     response.var <- all.vars(outcome_formula)[1]
@@ -240,7 +240,7 @@ measerr_mle <- function(df, outcome_formula, outcome_family=gaussian(), proxy_fo
     names(start) <- params
 
     if(method=='optim'){
-        fit <- optim(start, fn = measerr_mle_nll, lower=lower, method='L-BFGS-B', hessian=TRUE, control=list(maxit=1e6))
+        fit <- optim(start, fn = measerr_mle_nll, lower=lower, method=optim_method, hessian=TRUE, control=list(maxit=maxit))
     } else { # method='mle2'
                 
         quoted.names <- gsub("[\\(\\)]",'',names(start))
@@ -250,7 +250,7 @@ measerr_mle <- function(df, outcome_formula, outcome_family=gaussian(), proxy_fo
         measerr_mle_nll_mle <- eval(parse(text=text))
         names(start) <- quoted.names
         names(lower) <- quoted.names
-        fit <- mle2(minuslogl=measerr_mle_nll_mle, start=start, lower=lower, parnames=params,control=list(maxit=1e6),method='L-BFGS-B')
+        fit <- mle2(minuslogl=measerr_mle_nll_mle, start=start, lower=lower, parnames=params,control=list(maxit=maxit),method=optim_method)
     }
 
     return(fit)

Community Data Science Collective || Want to submit a patch?