Re: [R] I don't understand the result of `svyboxplot` function from the Survey package

2022-08-03 Thread Thomas Lumley
It's a bug resulting from the new svyquantile() implementation. It's fixed in the development version, which you can get from r-forge here: https://r-forge.r-project.org/R/?group_id=1788 -thomas Thomas Lumley Professor of Biostatistics Fro

Re: [R] Can you get the DEFT from svyratio?

2016-12-07 Thread Thomas Lumley
No, you can't (at the moment), though it shouldn't be too hard to extend. I can't run your example, though. I get: Error in eval(expr, envir, enclos) : object 'M' not found -thomas Thomas Lumley Professor of Biostatistics University of Auckland ___

Re: [R] problem when I Call C subfunction in void function

2014-08-27 Thread Thomas Lumley
gt; $Px > [1] 4 10 10 8 > > $tailleP > [1] 4 > > $res > [1] 4 0 0 0 > > I haven't problem in "essai" function but I can't correctly return "Px" > vector. > I d'ont understand why I get only the first number (number 4 in my exemp

Re: [R] Weighted Mann-Whitney-Wilcoxon-Test

2014-08-19 Thread Thomas Lumley
nder complex sampling. Biometrika, 100, 831-842. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] rake() error message

2014-06-09 Thread Thomas Lumley
.m12, pop.m13, pop.m14, pop.m15, >> pop.m16)) >> >> >> -Original Message- >> From: Michael Willmorth >> Sent: Saturday, June 07, 2014 9:23 AM >> To: r-help@R-project.org >> Subject: rake() error message >> >> I'm tea

Re: [R] Understanding survey design (svydesign)

2014-06-05 Thread Thomas Lumley
> R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Thomas Lum

Re: [R] Understanding svymean

2014-06-05 Thread Thomas Lumley
ion sizes, those are used to compute probabilities, which are then used to compute weights. The code works in terms of probabilities because that's fairly standard in textbooks. It makes it easier for me to get the formulas right. -thomas -- Thomas Lumley Professo

Re: [R] SQL vs R

2014-05-06 Thread Thomas Lumley
on > the database backend part of the process. You might try MonetDB and its R interface -- it is fast for aggregation operations, and either the current version or the upcoming version has dplyr support. -thomas -- Thomas Lumley Professor of Biostatistics University

Re: [R] problem on package "survey" , function svyglm,

2014-04-16 Thread Thomas Lumley
another > stratum. See 3.2.1 in http://books.google.fr/books?id=L96ludyhFBsC > (look for "single" in the whole book to find it). > > Or set options(survey.lonely.psu) to one of the other values. But merging strata is probably better. -thomas -- Thomas Lumley Professo

Re: [R] Survey

2014-04-02 Thread Thomas Lumley
bles in a given analysis but not for all the variables in your dataset is to use the database-backed designs and put the data in something like SQLite. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland [[alternative HTML version deleted]] ___

Re: [R] Problem with do.call().

2014-03-27 Thread Thomas Lumley
> R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/ > posting-guide.html > and provide commented, minimal, self-

Re: [R] automatically replacing the third period with a break

2014-03-18 Thread Thomas Lumley
pse=".") > > Backreferences cat( gsub("(([[:alnum:]]+\\.){3})([[:alnum:]]+)\\.", "\\1\\2\n", fake ) ) That is, match three word/period sequences, match a word, match a period, and output the first two things. -thomas --

Re: [R] Overriding predict based on newdata...

2014-03-18 Thread Thomas Lumley
the same name, and too many people would have to understand how they are scoped. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://s

Re: [R] Survfit Error

2014-03-06 Thread Thomas Lumley
test. > > This was a recent (well, 2007) change in behaviour. Previously the function did some tricks to make either approach work, which could be described as 'clever' or 'too clever by half'. -thomas -- Thomas Lumley Professor of Biostatistics University of

Re: [R] SEs rms cph vs survey svycoxph

2014-02-26 Thread Thomas Lumley
-0.5810 0.1741 -3.34 0.0008 > stage=ib -0.4394 0.1899 -2.31 0.0207 > stage=iia 1.6565 0.2097 7.90 <0.0001 > stage=iib 1.6928 0.1979 8.55 <0.0001 > stage=iii 1.8211 0.2411 7.55 <0.0001 > sta

Re: [R] SEs rms cph vs survey svycoxph

2014-02-25 Thread Thomas Lumley
s "The standard errors agree closely with survfit.coxph for independent sampling when the model fits well, but are larger when the model fits poorly. " That is, the note is for the survival curve rather than the coefficients. It's still surprising that there's a big difference,

Re: [R] Discrepant lm() and survreg() standard errors with weighted fits

2014-02-25 Thread Thomas Lumley
something? Here is what I'm doing: >> > > Survreg treats weights as case weights, and lm treats them as sampling > weights. > Actually, lm() treats them as precision weights, not sampling weights, but that's still the explanation. -thomas -

Re: [R] NextMethod in boxcox

2014-02-14 Thread Thomas Lumley
t; >> Bert Gunter > >>> >> Genentech Nonclinical Biostatistics > >>> >> (650) 467-7374 > >>> >> > >>> >> "Data is not information. Information is not knowledge. And > knowledge > >>> >> is certainly not

Re: [R] svyglm error message

2014-02-11 Thread Thomas Lumley
LSE > needed > > Thanks for reading my post, and thanks in advance for any help! > Sincerely, > Claire > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help >

Re: [R] Weibull selfStart

2014-01-15 Thread Thomas Lumley
e)-sigma))) > You can fit this accelerated-failure parametrisation of the Weibull with survreg() in the survival package. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland [[alternative HTML version deleted]] __ R-hel

Re: [R] Percentiles for unequal probability sample

2013-11-21 Thread Thomas Lumley
iles) for unequal-probability samples. -- Thomas Lumley Professor of Biostatistics University of Auckland [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read th

Re: [R] Inserting 17M entries into env took 18h, inserting 34M entries taking 5+ days

2013-11-04 Thread Thomas Lumley
og(longest chain) and copying can be reduced by using an index > i and subsetting the original vector on each iteration. I think you could > test for circularity by checking that the updated x are not a permutation > of the kept x, all(x[y_idx[keep]] %in% x[keep])) > > Martin > &

Re: [R] Hierarchical Cluster Analysis with large dataset

2013-11-03 Thread Thomas Lumley
e number of dimensions is not small I don't think there are any algorithms taking less than n^2 time even on average. In applications where I have seen large-n clustering it has mostly been variants of k-means, which take kn time and space, not n^2. Look at the Bioconductor flow-cytometry package

Re: [R] probability weights in multilevel models

2013-06-05 Thread Thomas Lumley
http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Thomas Lumley Professor of Biostatistics University of Auckland [[alternative HTML version deleted]] __ R-help@r-project.org m

Re: [R] Goodness-of-fit tests for Complex Survey Logistic Regression

2013-05-29 Thread Thomas Lumley
a spline) I'm not generally a fan of global goodness-of-fit tests, but this is straightforward enough that I might add it to the survey package (though that's not going to happen for a month or so). -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland

Re: [R] Sampling Weights and lmer() update?

2013-05-14 Thread Thomas Lumley
urvey package to use sampling weights in the past, > but according to post I found online from Thomas Lumley in mid-2012, R is > currently not equipped to be able to do this. > > His post is here: > > http://r.789695.n4.nabble.com/sampling-weights-for-multilevel-models-tp4632947p4632

Re: [R] Package survey: singularities in linear regression models

2013-05-05 Thread Thomas Lumley
gaussian(link = "identity")) > > Thanks again, > Sebastian > > -- > Sebastian Weirich, Dipl.-Psych. > > Institut zur Qualitätsentwicklung im Bildungswesen > Humboldt-Universität zu Berlin > Sitz: Hannoversche Straße 19, 10115 Berlin > Postadresse: Unte

Re: [R] Package survey: singularities in linear regression models

2013-05-02 Thread Thomas Lumley
000 AIC: 2599 So, perhaps you could show us what you actually did, and what actually happened, as the posting guidelines request. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland [[alternative HTML version deleted]]

Re: [R] significantly different from one (not zero) using lm

2013-04-30 Thread Thomas Lumley
; > and provide commented, minimal, self-contained, reproducible code. > > > > > > -- > Paul E. Johnson > Professor, Political Science Assoc. Director > 1541 Lilac Lane, Room 504 Center for Research Methods > University of Kansas

Re: [R] Stratified Random Sampling Proportional to Size

2013-04-28 Thread Thomas Lumley
[[alternative HTML version deleted]] >> >> __**________ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help> >> PLEASE do read the posting guide htt

[R] advert: courses in R use, programming in Seattle

2013-04-25 Thread Thomas Lumley
information at http://www.biostat.washington.edu/suminst/sisg/schedule -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch

Re: [R] t-statistic for independent samples

2013-04-17 Thread Thomas Lumley
> R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Thomas Lumley Professo

Re: [R] Strange error with log-normal models

2013-04-16 Thread Thomas Lumley
will just point out that this 'simple model' is not lognormal. It is a model with normal errors and log link, ie. y ~ N(mu, sigma^2) log(mu) = x \beta -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland [[alternative HTML version deleted]] _

Re: [R] Solving an integral in R gives the error “The integral is probably divergent”

2013-04-12 Thread Thomas Lumley
uld reproduce the reported error. -thomas > -pd > > On Apr 12, 2013, at 04:51 , Thomas Lumley wrote: > > > I don't get an error message (after I correct the missing line break > after > > the comment > > > >> b<- sapply(a, Cfun, upper=1) >

Re: [R] Solving an integral in R gives the error “The integral is probably divergent”

2013-04-11 Thread Thomas Lumley
_ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Thomas Lumley

Re: [R] Weighted Kaplan-Meier estimates with R

2013-03-27 Thread Thomas Lumley
ling -- to save memory it computes the standard errors only at event times. It shouldn't be too hard to get it to extend that to the last censoring time, but the reason it isn't too hard is that the curve and standard error estimates don't change after the last failure tim

Re: [R] Cluster analysis on weighted survey data with continuous and categorical variables

2013-03-19 Thread Thomas Lumley
hand, if it is very large, you can thin it out to a uniform sample by sampling from it with probability inversely proportional to the original sampling probability. - thomas -- Thomas Lumley Professor of Biostatistics University of Auckland [[alternative HTML version deleted]] _

Re: [R] Superscript followed by number then superscript in text

2013-03-18 Thread Thomas Lumley
uot;, srt=90) > > I would like the text to read: > > capacity 10^3 m^3 > > (with ^ denoting superscript (i.e. each '3' as superscript). > What did you try? Anyhow, this works text(1,1,expression("capacity"~10^3~m^3)) -thomas -- Thomas Lumley Profe

Re: [R] error: object of type 'closure' is not subsettable

2013-03-14 Thread Thomas Lumley
; The classical exact distribution for the Wilcoxon signed-rank test is derived by assuming the data are from a continuous distribution, which implies that there cannot be any ties in the differences. If there are ties, the function uses a Normal approximation. -thomas -- Thomas Lumley Professo

Re: [R] (no subject)

2013-03-10 Thread Thomas Lumley
andard errors for a linear model whose coefficients have the same interpretation as those from lmer. If you need to estimate variance components, you currently need to use some other software. Mixed-model estimation based on composite likelihood is on my list of things to do, but not terribly high up.

Re: [R] Zelig package: Coxph model problems

2013-03-05 Thread Thomas Lumley
z.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help> > PLEASE do read the posting guide http://www.R-project.org/** > posting-guide.html <http://www.R-project.org/posting-guide.html> > and provide commented, minimal, self-contained, rep

Re: [R] weighted factor analysis

2013-01-09 Thread Thomas Lumley
r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Thomas Lumley Professor of Biostatistics University of Auckland [[alternative HTML version deleted]]

Re: [R] R encrypt/decrypt

2013-01-09 Thread Thomas Lumley
> > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproduci

Re: [R] pROC and ROCR give different values for AUC

2012-12-19 Thread Thomas Lumley
AUC were identical in all three cases. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] interfacing with .Call

2012-12-16 Thread Thomas Lumley
7, 10 Lower Kent Ridge Road, > > 119076 > > > > > > > > > > > > -- > > Department of Mathematics, > > National University of Singapore, > > Blk S17, 10 Lower Kent Ridge Road, > > 119076 > > > > [[alternative

Re: [R] kruskalmc, significant differences while median values are the same

2012-12-16 Thread Thomas Lumley
really want differences in medians, look at differences in medians. A permutation test or a bootstrap confidence interval is probably the best way to do this. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland [[alternative HTML version deleted]] _

Re: [R] Problems with weight

2012-12-04 Thread Thomas Lumley
> >> > > > >> (Dispersion parameter for quasibinomial family taken to be 23.14436) > > > >> > > > >> Null deviance: 7318.5 on 246 degrees of freedom > > > >> Residual deviance: 5692.8 on 235 degrees of freedom > > > >

Re: [R] ROC Curve: negative AUC

2012-11-22 Thread Thomas Lumley
e? That should tell you whether there's some strange non-convexity going on or whether the variable is just being put into the calculations backwards. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland [[alternative HTML version deleted]] __

Re: [R] How to fix it?

2012-11-18 Thread Thomas Lumley
th 1. The fact that the variable is defined by the wrong name if yyrandom[1] is more of a problem. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland [[alternative HTML version deleted]] __ R-help@r-project.org maili

Re: [R] R-Square in WLS

2012-11-18 Thread Thomas Lumley
hts*(ReZ)^2) # SSR > Rsq <- SSR/SST > > I don't understand what is wrong with the code. The sum square regression > plus the sum square error do not add up to the sum square total in both the > Y scale and Z scale. Y is a normal distribution and Z is log normal

Re: [R] standard error for quantile

2012-11-12 Thread Thomas Lumley
With this density you can write down the density of the median or other order statistic and thus write down an integral that gives the exact variance. Better still, it's a polynomial, so you could evaluate the integral exactly. -thomas -- Thomas Lumley Professor of Bios

Re: [R] the results of the SORT function differ from Scilab/Matlab for Complex Numbers

2012-11-08 Thread Thomas Lumley
and remember where the branch cut goes on the phase coordinate. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mail

Re: [R] system is computationally singular: reciprocal condition number

2012-10-25 Thread Thomas Lumley
When I add random noise in the fourth decimal place, the matrix stops being singular. -thomas -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/

Re: [R] Question about survdiff in for-loop.

2012-10-19 Thread Thomas Lumley
ur predictor variable. Using svsv[i] rather than names[i] should work. Or you can insert the value of names[i] into the formula with survdiff(eval(bquote(Surv(survival.m, survival) ~ .(names[i]))), data=svsv) Even after you fix that, there's another problem, which is that your code do

Re: [R] how R implement qnorm()

2012-10-18 Thread Thomas Lumley
d the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org ma

Re: [R] svyplot and svysmooth with hexbin

2012-10-18 Thread Thomas Lumley
lanta, GA 30341 > 770-488-0668 > > > > > [[alternative HTML version deleted]] > > __________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-

Re: [R] svyboxplot - library (survey)

2012-10-17 Thread Thomas Lumley
gov > > vide commented, minimal, self-contained, reproducible code. > __ > R-help@r-project.org<mailto:R-help@r-project.org> mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://

Re: [R] Package survey: Compute standard deviations from complex survey designs

2012-10-16 Thread Thomas Lumley
t(diag(coef(vv))) api00api99 105.7489 112.8504 ## delta method for standard error of square root of variance > sqrt(vcov(vv)["api00","api00"]/(4*coef(vv)["api00","api00"])) [1] 6.555219 -thomas -- Thomas Lumley Professor of Biostatistics U

Re: [R] survey package question

2012-10-11 Thread Thomas Lumley
> data=sample, pps="brewer") > > svyciprop(~I(candidate1/totalVotes), design) > > ... I am assuming that the unit of analysis is the voting unit, right? > and I am estimating an average among voting units? > You want a ratio estimator svyratio(~candidate1, ~totalVotes,

Re: [R] get: problem with environments

2012-10-10 Thread Thomas Lumley
yped at the global command prompt can return anything other than 1, but maybe something is getting in between the console and the evaluator. For example: > testfun() [1] 1 > print(testfun()) [1] 2 > capture.output(testfun()) [1] "[1] 6" I don't see why a pure console prog

Re: [R] get: problem with environments

2012-10-10 Thread Thomas Lumley
ent.frame(x1))) } testfun2(x1=1); testfun1() never finds a1==1, but testfun2(3) does. Remember, actual arguments to sapply() will be evaluated in the frame sapply() is called from. It's only default arguments that are evaluated inside the function. -- Thomas Lumley Professor of Bios

Re: [R] svyhist

2012-10-08 Thread Thomas Lumley
>> Division of Population Surveys >> 1 Choke Cherry Road, Room 2-1071 >> Rockville, MD 20857 >> >> Tel: 240-276-1070 >> Fax: 240-276-1260 >> e-mail: >> pradip.muh...@samhsa.hhs.gov<mailto:pradip.muh...@samhsa.hhs.gov><mailto:pradip.muh...@

Re: [R] svyboxplot - library (survey)

2012-10-01 Thread Thomas Lumley
a.gov > > vide commented, minimal, self-contained, reproducible code. > __ > R-help@r-project.org<mailto:R-help@r-project.org> mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do

Re: [R] Regsubsets model selection

2012-09-25 Thread Thomas Lumley
Why have you asked this question three times? -- Thomas Lumley Professor of Biostatistics University of Auckland __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R

Re: [R] Three Stage Sampling of categorical variable using 'survey' in R

2012-09-25 Thread Thomas Lumley
a. Total sample size 7800 > Household is the BSU and where we need to calculate information on the > individual level we are confident to be able to correct the sample weights > for that. That sounds plausible -thomas -- Thomas Lumley Professor of Biostatistics University of Au

Re: [R] Plotting of regsubsets adjr2 values not correct

2012-09-25 Thread Thomas Lumley
ree. > > Also I do not understand, which models are shown there, e.g. the simple > model just with an intercept and the variable GNI is not shown in the plot, > why? You asked for the two best models of each size, so you get the two best models of each

Re: [R] Exactly Replicating Stata's Survey Data Confidence Intervals in R

2012-09-24 Thread Thomas Lumley
male 0.5089488 0.5318942 > > ** > > use http://www.stata-press.com/data/r11/nhanes2f, clear > svyset [pweight=finalwgt] > svy: tabulate sex, percent se ci > (running tabulate on estimation sample) > > Number of strata = 1

Re: [R] Exactly Replicating Stata's Survey Data Confidence Intervals in R

2012-09-23 Thread Thomas Lumley
he Stata intervals were asymmetric, but in fact they aren't] -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the post

Re: [R] Wilcoxon Test and Mean Ratios

2012-09-20 Thread Thomas Lumley
ans who like the Wilcoxon test (Frank Harrell comes to mind) like it because they believe stochastic ordering is a reasonable assumption in the problems they work in, not because they think you can do non-parametric testing in its absence. -thomas -- Thomas Lumley Professor of Biostatistics Uni

Re: [R] Wilcoxon Test and Mean Ratios

2012-09-19 Thread Thomas Lumley
#x27; is higher. The Wilcoxon test probably isn't very useful in a setting like this, since its results really make sense only under 'stochastic ordering', where the shift is in the same direction across the whole distribution. -thomas -- Thomas Lumley Professor of Biostatistics

Re: [R] Trap an error from a function

2012-09-18 Thread Thomas Lumley
o sophisticated things with it, but actually just returns NA for all errors. tryCatch() is also quieter. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland __ R-help@r-project.org mailing list https://stat.ethz.ch/m

Re: [R] eval(parse(...)) only once in a function

2012-09-17 Thread Thomas Lumley
tr==12")[[1]] > e df$str == 12 > bquote(function(df) b<-.(e)) function(df) b <- df$str == 12 > eval(bquote(function(df) b<-.(e))) function (df) b <- df$str == 12 This saves more time than I expected, about 100ms per evaluation on my computer. -thomas -- Thomas

Re: [R] loglogistic survreg

2012-09-17 Thread Thomas Lumley
etrisation. In a model with only an intercept, that would be exp(intercept). -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] simulate from conditional distribution

2012-09-13 Thread Thomas Lumley
m numbers from such a distribution? Not directly, as far as I know, but you can easily simulate X|X>c by transforming uniform random numbers using the inverse CDF, and Y|X=x is univariate Normal with mean linear in x and variance independent of x. -thomas -- Thomas Lumley Professor of

Re: [R] Paasing values to sqlQuery like SAS macro

2012-09-13 Thread Thomas Lumley
m the_appropriate_table where firm=", firms," and date>=", begindts, " and date <=", enddts) lapply(queries, sqlQuery, channel=my.database.connection) will return a list of data frames, one for each set of values. -t

Re: [R] test Breslow-Day for svytable??

2012-08-31 Thread Thomas Lumley
18.82551 5 0.00207139 > > Using svydesign and svytable I _think_ this is how one would go about > constructing a 2 x 2 table: > > tbl2<-svydesign( ~ Gender + Admit+Dept, weights=~Freq, data=DF) > summary(dclus1) > (tbl2by2 <- svytable(~ Gender + Admit+Dept,

Re: [R] sensitivity and specificity in svyglm??

2012-08-16 Thread Thomas Lumley
n't be appropriate for the survey design. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://ww

Re: [R] Direct Method Age-Adjustment to Complex Survey Data

2012-08-12 Thread Thomas Lumley
by(~HI_CHOL,~race+RIAGENDR,design=subset(postStratify(design1,~race+RIAGENDR+agecat,racegenderage),RIDAGEYR>=20),svymean,na.rm=TRUE) -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland __ R-help@r-project.org mailing list https://st

Re: [R] coxph weirdness

2012-07-26 Thread Thomas Lumley
advance for all replies! > > Peter > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, mini

Re: [R] stepwise in svyglm???

2012-07-25 Thread Thomas Lumley
by hand. The function step() uses AIC. As far as I know, no-one has yet constructed valid analogues of AIC,BIC,CIC, ... under complex sampling (Alastair Scott and I are looking into it), so p-values are the only option, making the process even less useful. - thomas -- Thomas Lumley Professor of

Re: [R] Threshold Quantile Regression code CRASHES in R

2012-07-17 Thread Thomas Lumley
lled "rqbr", which looks like it's part of rq(), called from rq.fit.br() Since the problem seems to be data-dependent, and happens with fairly high frequency, you might want to use trace() to stick some sort of data summary in before the call to rqbr, to see if anything obvious is wrong w

Re: [R] rgamma function

2012-07-16 Thread Thomas Lumley
SEXP a; PROTECT(a=allocVector(REALSXP,1)); GetRNGstate(); REAL(a)[0]=rgamma(5000,1); PutRNGstate(); UNPROTECT(1); return (a); } - thomas -- Thomas Lumley Professor of Biostatistics University of Auckland __ R-help@r-project.org mailin

Re: [R] rgamma function

2012-07-15 Thread Thomas Lumley
ror: incompatible types in return I thought the ANSI standard actually *required* a diagnostic for the incompatible return types. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland __ R-help@r-project.org mailing list https://s

Re: [R] test parallel slopes with svyolr

2012-07-08 Thread Thomas Lumley
'd be prepared to implement it anyway. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www

Re: [R] Help with multinomial regression to "survey"

2012-07-06 Thread Thomas Lumley
t package. The example on the withReplicates() help page shows how to do this for quantile regression, and it should be similar. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland __ R-help@r-project.org mailing list ht

Re: [R] GEE with Inverse Probability Weights

2012-07-05 Thread Thomas Lumley
ngeles > https://joshuawiley.com/ > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal,

Re: [R] a problem about WLS

2012-07-04 Thread Thomas Lumley
They influence the results more than observations with low weight. Your code does the opposite. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-h

Re: [R] turning R expressions into functions?

2012-06-29 Thread Thomas Lumley
.R") >  function() { for (funcit.i in 1:k) { expr } } >   >  function() { for (funcit.i in 1:k) { expr } } >   > > This is on the same machine using (as far as I can tell) the > same R engine.  So why is the output different? The "ugl

Re: [R] GEE with Inverse Probability Weights

2012-06-13 Thread Thomas Lumley
;- svydesign(id=~sib.pair.id, weights=~sampling.weights, data=mydataset) svyglm( response~predictor, family=quasibinomial(), design=mydesign) -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland __ R-help@r-project.org mailing

Re: [R] V-Cramer in svy

2012-06-10 Thread Thomas Lumley
with the package vcd assocstats but > without considering the survey package. You can use svytable() to generate an estimated population table and then feed that to assocstats(). -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland ___

Re: [R] sampling weights for multilevel models

2012-06-10 Thread Thomas Lumley
the variance components for their own sake, you need some other software. I do have longer-term plans to add multilevel modelling capabilities to the survey package, but it's harder than it may appear. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland ___

Re: [R] regsubsets (Leaps)

2012-06-03 Thread Thomas Lumley
d as a way of viewing a large collection of best models, as in the example for the plot() method, by setting nbest fairly large -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland __ R-help@r-project.org mailing list https:

Re: [R] svychisq??

2012-05-31 Thread Thomas Lumley
11_AUTOPERCEPCIONSALUDGENERAL,Muestra.comp) or if you want shorter names, create renamed variables in the design object: Muestra.comp <- update(Muestra.comp, ocupacion = M1_19_OCUPACIONPRINCIPALACTUAL, APES= M3_11_AUTOPERCEPCIONSALUDGENERAL) -thomas -- Thomas Lumley Professor of Biostatistics Univ

Re: [R] bigglm binomial negative fitted value

2012-05-31 Thread Thomas Lumley
;  - attr(*, "dimnames")=List of 2 >  ..$ : chr [1:260617] "1" "2" "3" "4" ... >  ..$ : NULL > As the help says, the default is predictions of the linear predictor. To get predictions of the probability, use type="response"

Re: [R] svychisq using two frames

2012-05-24 Thread Thomas Lumley
Chisq”, na.rm= TRUE) > > > (I feel like I may be overthinking this and the answer is much simpler) > > You don't need to create two new variables; you just need a year variable svychisq(~MyVar+Year, BothYears, statistic=”Chisq”, na.rm= TRUE) tests whether MyVar is indep

Re: [R] Post stratification weights in survey package in R

2012-05-14 Thread Thomas Lumley
been > assigned separately for each of the variable. My question is: Is it > possible to get 1 weight for each subject instead of 3 weights as shown in > the package? There *is* only one weight for each subject. You are misinterpreting the internal structures of the

Re: [R] Replicate weights in R?

2012-05-11 Thread Thomas Lumley
.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Thomas Lumley Professor of Biostatistics University of Auckland __

Re: [R] Very small random effect estimation in lmer but not in stata xtmixed

2012-05-03 Thread Thomas Lumley
You're not fitting the same model. Like SAS, Stata by default assumes that random effects are independent of each other, so your Stata model has correlation between the random effects forced to zero. The R model estimates the correlation, and finds it to be far from zero (-0.69).

Re: [R] deparse(substitute(x)) on an object with S3 class

2012-05-03 Thread Thomas Lumley
rgument has been evaluated." -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org

Re: [R] Forestplot question

2012-05-02 Thread Thomas Lumley
info/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Thomas Lumley Professor of Biostatistics University of Auckland __ R-help@r-proj

  1   2   3   4   5   6   >