search for: sweight

Displaying 5 results from an estimated 5 matches for "sweight".

Did you mean: weight
2012 Jun 21
4
crosstable and regression for survey data (weighted)
I have survey data that I am working on. I need to make some multi-way tables and regression analyses on the data. After attaching the data, this is the code I use for tables for four variables (sweight is the weight variable): > a <- xtabs(sweight~research.area + gender + a2n2 + age) > tmp <- ftable(a) Is this correct? I don't think I need to use the strata and cluster variables, right? And, below is the logistic regression code that I use for randomly sampled, or unweighted,...
2008 Dec 03
1
help on tapply using sample with differing sample-sizes
...out getting what I want. if so what would all you strong programmers reccommend instead. I am thinking that perhaps loops may be the only way to go. raoboot <- function (datavar, statavar, weight, nboot, ciqntl, ciqntu) { i <- 1 sdatavar <- sort(datavar) sstratavar <- sort(statavar) sweight <- sort(weight) sdatavarwght <- sdatavar*sweight # stramn <- tapply(sdatavar, sstratavar, mean) meanvect <- rep(0, times = nboot) stratasize <- tapply(sdatavarwght, sstratavar, length) stratasizemone <- stratasize -1 while (i < nboot) { #vector of resampled observat...
2012 Jan 24
2
sampling weights in package lme4
...ultilavel regression analysis using packege lme4 using following codes print(fm1 &lt;- lmer(DC~sex+age+smoker+alcohol+fruits(1|setting), dataset,REML = FALSE), corr = FALSE) print(fm2 &lt;- lmer(DC~sex+age+smoker+alcohol+fruits(1|setting), dataset,REML = FALSE), corr = FALSE,weights=sweight) The problem is both the codes&nbsp;giving&nbsp;me exactly the same results.is this "weights" not meant for sampling weights?if not, how can i include sampling weights in lme4? thanks a lotmasood Follow&nbsp;Rediff Deal ho jaye!&nbsp;to get exciting offers in your city e...
2009 Jan 26
2
R crashes when using the RODBC Package
...tblName <- "qryDataMonthly_Crosstab" } prices <- sqlFetch(channel, tblName, colnames = FALSE, rownames = TRUE) # Get Weightings sql <- "SELECT BbSecurity, Weighting FROM qryWeightingsUse" sWeights <- sqlQuery(channel, sql) # ==== Copy Data to Database ==== if ( bWeekly ) { tblName <- "tblIndexWeekly" } else { tblName <- "tblIndexMonthly" } sqlQue...
2012 Oct 12
0
goodness of fit for logistic regression with survey package
...ey package. Could you help me how to see the goodness of fit for the model below? Should I use AIC, BIC, ROC, or what? What code would let me run a goodness of fit test for the model? Here are my codes: #incorporating design effects# > mydesign <- svydesign(id=~clust, strata=~strat, weights=~sweight, > data=mydata) #logistic regression model# > model1 <- svyglm(y ~ x1 + x2+ x3 + x4 + x5, design = mydesign, > data=(mydata),family=quasibinomial()) #I tried loglik function, but didn't work# > logLik(model1) [1] 8753.057 Warning message: In logLik.svyglm(model1) : svyglm not fit...