A@dertechLLC m@iii@g oii proto@m@ii@com
2020-Feb-11 02:33 UTC
[R] Survey package/svyby source code help
Good day, I was looking for some help with understanding a particular portion of the svyby source code. When debugging the code I am not following the generation of values in the results object attr(*, "var")" after line 57 completes. These values are fed into line 74 (rval <- t(sapply(results, unwrap))). Alternatively I invite explanation of how the SE values are created in the rval object on line 74. the data entering svyby is from a svydesign.default object. I am especially confused by the syntax in 57 - 59, which is not the primary question, but would appreciate any input. I am new to R and this mailing list and do apologize for committing faux-pas. Thanks in advance. [[alternative HTML version deleted]]
On Tue, 11 Feb 2020 02:33:45 +0000 AndertechLLC--- via R-help <r-help at r-project.org> wrote:> When debugging the code I am not following the generation of values > in the results object attr(*, "var")" after line 57 completes. These > values are fed into line 74 (rval <- t(sapply(results, unwrap))).Which version of the survey package you have in mind? I took a look at the latest version available on CRAN (3.37 at the time of this post, [*]) and the R/surveyby.R file has somewhat different code on lines 57 and 74. In particular, attr(*, "var") is assigned much later, from variable named covmat.mat, which is also computed later than line 74. -- Best regards, Ivan [*] https://cran.r-project.org/src/contrib/survey_3.37.tar.gz
A@dertechLLC m@iii@g oii proto@m@ii@com
2020-Feb-11 15:23 UTC
[R] Survey package/svyby source code help
Thank you for responding. I am truly grateful. Apologies for omitting evident and pertinent information. I am using 3.36. I will update to 3.37. I did not notice the newer version. I realize I needed to be more specific. The attr(, "var") that I am interested in is displayed with str(results) after the results object is declared. First line of the subject code looks like: results <- (if (multicore) parallel::mcapply else lapply)(uniques, function(i){.... How that line functions without error is beyond me, but minor to my objective. Disclosing my prime goal, I am trying to produce the same values generated by the confint function, which receives the standard error values from this svyby function. I am trying to replicate the standard error calculation in R and use it in a known program called Tableau. If any other information is needed please let me know. My sincerest gratitude. ??????? Original Message ??????? On Tuesday, February 11, 2020 9:42 AM, Ivan Krylov <krylov.r00t at gmail.com> wrote:> On Tue, 11 Feb 2020 02:33:45 +0000 > AndertechLLC--- via R-help r-help at r-project.org wrote: > > > When debugging the code I am not following the generation of values > > in the results object attr(*, "var")" after line 57 completes. These > > values are fed into line 74 (rval <- t(sapply(results, unwrap))). > > Which version of the survey package you have in mind? I took a look at > the latest version available on CRAN (3.37 at the time of this post, > []) and the R/surveyby.R file has somewhat different code on lines 57 > and 74. > In particular, attr(, "var") is assigned much later, from variablenamed covmat.mat, which is also computed later than line 74. > > ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > > Best regards, > Ivan > > [*] https://cran.r-project.org/src/contrib/survey_3.37.tar.gz