Re: [R] Plot by FIPS Code using Shapefiles
Joining data the way you're doing it is dangerous, Roger Bivand and others describes a standard way to do this process here: http://r-sig-geo.2731867.n2.nabble.com/Merging-shapefiles-and-csv-td7586839.html And I do an example using US Census data here, using merge(): http://spatialdemography.org/wp-content/uploads/2013/04/9.-Sparks.pdf http://spatialdemography.org/wp-content/uploads/2013/04/9.-Sparks.pdf look at page 134 of that pdf. Hope this helps - Corey Sparks, PhD Assistant Professor Department of Demography University of Texas at San Antonio 501 West César E. Chávez Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu coreysparks.weebly.com -- View this message in context: http://r.789695.n4.nabble.com/Plot-by-FIPS-Code-using-Shapefiles-tp4706830p4706840.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
[R] Reading data from Census API into R
Dear list, I've gotten access to the US Census Bureau's developer API for accessing various datasets they maintain. Here is the link: http://www.census.gov/developers/ They say that: Data are accessible to software developers through a stateless HTTP GET request. Up to 50 variables can be requested with a single API call. I can successfully query the API in a web browser, for instance: http://api.census.gov/data/2010/sf1?key=mykeyget=P0010001,NAMEfor=county:*in=state:48 which returns the population total for each county in the state of Texas. The API returns the requested data in this structure: [[P0030001,NAME,state,county], [58458,Anderson County,48,001], [14786,Andrews County,48,003], [86771,Angelina County,48,005], [23158,Aransas County,48,007], [9054,Archer County,48,009], [1901,Armstrong County,48,011], [44911,Atascosa County,48,013], [28417,Austin County,48,015]] So my question is, how can I perform this query in R, using these types of queries? Any thoughts would be most welcome. Thanks Corey - Corey Sparks, PhD Assistant Professor Department of Demography University of Texas at San Antonio 501 West César E. Chávez Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu https://rowdyspace.utsa.edu/users/ozd504/www/index.htm -- View this message in context: http://r.789695.n4.nabble.com/Reading-data-from-Census-API-into-R-tp4684877.html Sent from the R help mailing list archive at Nabble.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, self-contained, reproducible code.
Re: [R] Reading data from Census API into R
I got it: library(rjson) library(plyr) test-fromJSON(file=url(http://api.census.gov/data/2010/sf1?key=mykeyget=P0030001,NAMEfor=county:*in=state:48;)) test2-ldply(test)[-1,] names(test2)-ldply(test)[1,] head(test2) P0030001 NAME state county 258458 Anderson County48001 314786 Andrews County48003 486771 Angelina County48005 523158 Aransas County48007 6 9054Archer County48009 7 1901 Armstrong County48011 - Corey Sparks, PhD Assistant Professor Department of Demography University of Texas at San Antonio 501 West César E. Chávez Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu coreysparks.weebly.com -- View this message in context: http://r.789695.n4.nabble.com/Reading-data-from-Census-API-into-R-tp4684877p4684881.html Sent from the R help mailing list archive at Nabble.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, self-contained, reproducible code.
Re: [R] Visualizing a dissimilarity matrix in Euclidean space
Hi, I've playd with this kind of problem before, have yoiu looked at principal coordinates? You can use the cmdscale() function in R to take the eigenstructure of your distance matrix and plot the differences in low dimensional space, it can be very instructive as to the dissimilarity between your notwork nodes. CS - Corey Sparks, PhD Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio 501 West Durango Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu https://rowdyspace.utsa.edu/users/ozd504/www/index.htm -- View this message in context: http://r.789695.n4.nabble.com/Visualizing-a-dissimilarity-matrix-in-Euclidean-space-tp3654720p3656354.html Sent from the R help mailing list archive at Nabble.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, self-contained, reproducible code.
Re: [R] Fwd: Extract element of a list based on an index value
Solved it: oldest-unlist(tapply(warmerge$birth.year, warmerge$SibID,function(x) ifelse (x==min(x, na.rm=T)|is.na(x)==T,1,0))) - Corey Sparks, PhD Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio 501 West Durango Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu https://rowdyspace.utsa.edu/users/ozd504/www/index.htm -- View this message in context: http://r.789695.n4.nabble.com/Fwd-Extract-element-of-a-list-based-on-an-index-value-tp3622601p3622714.html Sent from the R help mailing list archive at Nabble.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, self-contained, reproducible code.
[R] Openbugs and rbugs on mac with wine
Hello list, I’ve been trying to get OpenBUGS running on my mac using the wine emulator. I can run Openbugs just fine by doing: wine ~/OpenBUGS312/OpenBUGS.exe In the terminal, so OpenBUGS works. When I try to run the schools example using rbugs(), the OpenBUGS process starts in wine, but it just sits there, no log, no script, no output of any sort. The rbugs () call makes the init, data, model and script file, but there seems to be a problem with R piping the script to OpenBUGS, here is my example library(rbugs) data(schools) J - nrow(schools) y - schools$estimate y - rnorm(length(y)) sigma.y - schools$sd schools.data - list (J, y, sigma.y) ## schools.data - list(J=J, y=y, sigma.y=sigma.y) inits - function() {list (theta=rnorm(J,0,100), mu.theta=rnorm(1,0,100), sigma.theta=runif(1,0,100))} parameters - c(theta, mu.theta, sigma.theta) schools.bug - file.path(.path.package(rbugs), bugs/model, schools.bug) file.show(schools.bug) #This almost runs, it makes all files, but doesn't run the script schools.sim - rbugs(data=schools.data, inits, parameters, schools.bug, n.chains=3, n.iter=1,seed=123, workingDir=/Users/ozd504/Documents/, bugsWorkingDir=/Users/ozd504/Documents/, useWine=TRUE, wine=/opt/local/bin/wine, bugs = /Users/ozd504/OpenBUGS312/ OpenBUGS.exe,OpenBugs=T, debug=TRUE) This Returns an error saying that bugs terminated before the coda could be written I can also send a screen shot of what happens if anyone is interested. Any help would be most appreciated. Here is my sessionInfo() R version 2.12.1 (2010-12-16) Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) locale: [1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] R2WinBUGS_2.1-16 coda_0.14-2 lattice_0.19-13 rbugs_0.4-9 loaded via a namespace (and not attached): [1] grid_2.12.1 tools_2.12.1 Thanks, Corey Corey Sparks Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio 501 West Durango Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu __ 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.
[R] Openbugs and rbugs on mac with wine
Hello list, Ive been trying to get OpenBUGS running on my mac using the wine emulator. I can run Openbugs just fine by doing: wine ~/OpenBUGS312/OpenBUGS.exe In the terminal, so OpenBUGS works. When I try to run the schools example using rbugs(), the OpenBUGS process starts in wine, but it just sits there, no log, no script, no output of any sort. The rbugs() call makes the init, data, model and script file, but there seems to be a problem with R piping the script to OpenBUGS, here is my example library(rbugs) data(schools) J - nrow(schools) y - schools$estimate y - rnorm(length(y)) sigma.y - schools$sd schools.data - list (J, y, sigma.y) ## schools.data - list(J=J, y=y, sigma.y=sigma.y) inits - function() {list (theta=rnorm(J,0,100), mu.theta=rnorm(1,0,100), sigma.theta=runif(1,0,100))} parameters - c(theta, mu.theta, sigma.theta) schools.bug - file.path(.path.package(rbugs), bugs/model, schools.bug) file.show(schools.bug) #This almost runs, it makes all files, but doesn't run the script schools.sim - rbugs(data=schools.data, inits, parameters, schools.bug, n.chains=3, n.iter=1,seed=123, workingDir=/Users/ozd504/Documents/, bugsWorkingDir=/Users/ozd504/Documents/, useWine=TRUE, wine=/opt/local/bin/wine, bugs = /Users/ozd504/OpenBUGS312/OpenBUGS.exe,OpenBugs=T, debug=TRUE) This Returns an error saying that bugs terminated before the coda could be written I can also send a screen shot of what happens if anyone is interested. Any help would be most appreciated. Here is my sessionInfo() R version 2.12.1 (2010-12-16) Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) locale: [1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] R2WinBUGS_2.1-16 coda_0.14-2 lattice_0.19-13 rbugs_0.4-9 loaded via a namespace (and not attached): [1] grid_2.12.1 tools_2.12.1 Thanks, Corey Corey S. Sparks, Ph.D. Assistant Professor Department of Demography and Organization Studies University of Texas San Antonio 501 West Durango Blvd San Antonio, TX 78207 email:corey.spa...@utsa.edu web: https://rowdyspace.utsa.edu/users/ozd504/www/index.htm [[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-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] question about the chow test of poolability
Can you provide an example of your code? - Corey Sparks, PhD Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio 501 West Durango Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu https://rowdyspace.utsa.edu/users/ozd504/www/index.htm -- View this message in context: http://r.789695.n4.nabble.com/question-about-the-chow-test-of-poolability-tp3206238p3208361.html Sent from the R help mailing list archive at Nabble.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, self-contained, reproducible code.
Re: [R] R equivalent of SAS proc freq
you can use prop.tables() on a table() object to get %ages, does this do what you need? - Corey Sparks, PhD Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio 501 West Durango Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu https://rowdyspace.utsa.edu/users/ozd504/www/index.htm -- View this message in context: http://r.789695.n4.nabble.com/R-equivalent-of-SAS-proc-freq-tp2301547p2301607.html Sent from the R help mailing list archive at Nabble.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, self-contained, reproducible code.
Re: [R] Multilevel survival model
check out the coxme and the kinship packages, both have the capability to fit the Cox proportional hazard model in a multi-level setting, or you could use glmer in lme4 to fit discrete-time (logistic) models with random intercepts. CS - Corey Sparks, PhD Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio 501 West Durango Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu https://rowdyspace.utsa.edu/users/ozd504/www/index.htm -- View this message in context: http://r.789695.n4.nabble.com/Multilevel-survival-model-tp2298756p2300071.html Sent from the R help mailing list archive at Nabble.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, self-contained, reproducible code.
Re: [R] Neural Network
I'd start with the nnet library type: ?nnet CS - Corey Sparks, PhD Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio 501 West Durango Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu https://rowdyspace.utsa.edu/users/ozd504/www/index.htm -- View this message in context: http://r.789695.n4.nabble.com/Neural-Network-tp2293366p2293369.html Sent from the R help mailing list archive at Nabble.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, self-contained, reproducible code.
Re: [R] grouped logit regression
by grouped data are you saying that you have counts of outcomes and counts of trials? That is how I interpret the glogit in stata. If that is the case you can put your data into glm() like this fit-glm(nevents~xvars, weights=ntrials, family=binomial, data=yourdataset) will fit the binomial regression model summary(fit) will print the coefficients and model fit In the future could you please read the posting guide and put in a data example or some R code you have tried. CS - Corey Sparks, PhD Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio 501 West Durango Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu https://rowdyspace.utsa.edu/users/ozd504/www/index.htm -- View this message in context: http://r.789695.n4.nabble.com/grouped-logit-regression-tp2280763p2280806.html Sent from the R help mailing list archive at Nabble.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, self-contained, reproducible code.
Re: [R] Calculating Summaries for each level of a Categorical variable
the variable you want to analyze (first argument to tapply) and the variable you want to analyze by (the factor, second arg to tapply) both must have the same number of rows, that' s how I read this. CS Corey Sparks Assistant Professor Department of Demography and Organization Studies College of Public Policy 501 West Durango Blvd Monterrey Building 2.270C San Antonio, TX 78207 corey.sparks 'at' utsa.edu 210 458 3166 On Jun 26, 2010, at 11:46 PM, RaoulD [via R] wrote: Hi Corey, Thanks so much for this. However, I get this error for tapply - Error in tapply(RT, RT$R, fun=WA): arguments must have same length. Any idea how to get around this? Thanks again, Raoul View message @ http://r.789695.n4.nabble.com/Calculating-Summaries-for-each-level-of-a-Categorical-variable-tp2269349p2269815.html To unsubscribe from Re: Calculating Summaries for each level of a Categorical variable, click here. - Corey Sparks, PhD Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio 501 West Durango Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu https://rowdyspace.utsa.edu/users/ozd504/www/index.htm -- View this message in context: http://r.789695.n4.nabble.com/Calculating-Summaries-for-each-level-of-a-Categorical-variable-tp2269349p2269988.html Sent from the R help mailing list archive at Nabble.com. [[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-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Euclidean Distance Matrix Analysis (EDMA) in R?
I agree, i've seen procrustes in R, but not EDMA, R has natural support for bootstrapping via the boot() library, i'm sure others would be grateful if you wanted to write some functions.. CS Corey Sparks Assistant Professor Department of Demography and Organization Studies College of Public Policy 501 West Durango Blvd Monterrey Building 2.270C San Antonio, TX 78207 corey.sparks 'at' utsa.edu 210 458 3166 On Jun 27, 2010, at 2:46 AM, gokhanocakoglu [via R] wrote: I am using EDMA software and I have couple of papers about statistical shape analysis and you are right about bootstrapping. Wish R has an EDMA package and we could see how the results compatible with EDMA software. View message @ http://r.789695.n4.nabble.com/Euclidean-Distance-Matrix-Analysis-EDMA-in-R-tp2266797p2269845.html To unsubscribe from Re: Euclidean Distance Matrix Analysis (EDMA) in R?, click here. - Corey Sparks, PhD Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio 501 West Durango Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu https://rowdyspace.utsa.edu/users/ozd504/www/index.htm -- View this message in context: http://r.789695.n4.nabble.com/Euclidean-Distance-Matrix-Analysis-EDMA-in-R-tp2266797p2269990.html Sent from the R help mailing list archive at Nabble.com. [[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-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calculating Summaries for each level of a Categorical variable
Did you try tapply? ?tapply tapply(RT, RT$R, fun=WA) or something like that - Corey Sparks, PhD Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio 501 West Durango Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu https://rowdyspace.utsa.edu/users/ozd504/www/index.htm -- View this message in context: http://r.789695.n4.nabble.com/Calculating-Summaries-for-each-level-of-a-Categorical-variable-tp2269349p2269444.html Sent from the R help mailing list archive at Nabble.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, self-contained, reproducible code.
Re: [R] Euclidean Distance Matrix Analysis (EDMA) in R?
I think the hardest thing about true EDMA (meaning the Richtsmeier and Lele version) is the bootstrapping to get significance. Have you tried their software? http://www.getahead.psu.edu/resource_new.html - Corey Sparks, PhD Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio 501 West Durango Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu https://rowdyspace.utsa.edu/users/ozd504/www/index.htm -- View this message in context: http://r.789695.n4.nabble.com/Euclidean-Distance-Matrix-Analysis-EDMA-in-R-tp2266797p2269445.html Sent from the R help mailing list archive at Nabble.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, self-contained, reproducible code.
Re: [R] Scree diagram,
There is a screeplot() function that takes the output from prcomp. It plots the value of the eigenvalue vs. the eigenvalue's number. CS - Corey Sparks, PhD Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio 501 West Durango Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu https://rowdyspace.utsa.edu/users/ozd504/www/index.htm -- View this message in context: http://r.789695.n4.nabble.com/Scree-diagram-tp2122453p2123252.html Sent from the R help mailing list archive at Nabble.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, self-contained, reproducible code.
Re: [R] Event History Data Recoding
did you look at the survSplit() function in the survival library? you may have to recode your date variable to a zero point, i.e. Jan 1 1900 = 0, and measure your time like that. The survSplit function will split your survival duration into specified cut points. I hope this helps Corey - Corey Sparks, PhD Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio 501 West Durango Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu https://rowdyspace.utsa.edu/users/ozd504/www/index.htm -- View this message in context: http://r.789695.n4.nabble.com/Event-History-Data-Recoding-tp2062297p2063087.html Sent from the R help mailing list archive at Nabble.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, self-contained, reproducible code.
Re: [R] Multilevel modeling with count variables
have you tried using glmer? If your dependent variable is poisson distributed, you can try something like fit-glmer(y~x+(1|group), family=poisson) and if you have differential exposure, you can do fit-glmer(y~offset(log(exposure))+x+(1|group), family=poisson) Is this what you are asking? With regard to the t-statistics generated from lmer/glmer, you can get p-values by using dt(), or look at your confidence intervals for the parameters. Does this help? Corey - Corey Sparks, PhD Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio 501 West Durango Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu https://rowdyspace.utsa.edu/users/ozd504/www/index.htm -- View this message in context: http://n4.nabble.com/Multilevel-modeling-with-count-variables-tp1692632p1693037.html Sent from the R help mailing list archive at Nabble.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, self-contained, reproducible code.
Re: [R] Multilevel modeling with count variables
Whoops, sorry that's pt(), not dt() Thanks Dennis! - Corey Sparks, PhD Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio 501 West Durango Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu https://rowdyspace.utsa.edu/users/ozd504/www/index.htm -- View this message in context: http://n4.nabble.com/Multilevel-modeling-with-count-variables-tp1692632p1693051.html Sent from the R help mailing list archive at Nabble.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, self-contained, reproducible code.
Re: [R] 1 - Survival Plot
if you do: fit-survfit (Surv(DTDMRS3, DMRS3) ~ RS2540477) fit$surv will have the survival function, and fit$time will have the failure times, these should give you what you want Hope this helps Corey - Corey Sparks, PhD Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio 501 West Durango Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu https://rowdyspace.utsa.edu/users/ozd504/www/index.htm -- View this message in context: http://n4.nabble.com/1-Survival-Plot-tp1691512p1691608.html Sent from the R help mailing list archive at Nabble.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, self-contained, reproducible code.
Re: [R] Displaying political boundaries
You probably need a shapefile, or other geographic representation for the administrative boundaries, you can find a shapefile here: http://www.maplibrary.org/stacks/Africa/Mozambique/index.php?language=german use the readShapePoly () function in the maptools library to read it in, and spplot in the sp library to display your variable. Corey - Corey Sparks, PhD Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio 501 West Durango Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu https://rowdyspace.utsa.edu/users/ozd504/www/index.htm -- View this message in context: http://n4.nabble.com/Displaying-political-boundaries-tp1587265p1587400.html Sent from the R help mailing list archive at Nabble.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, self-contained, reproducible code.
[R] Strange result in survey package: svyvar
Hi R users, I'm using the survey package to calculate summary statistics for a large health survey (the Demographic and Health Survey for Honduras, 2006), and when I try to calculate the variances for several variables, I get negative numbers. I thought it may be my data, so I ran the example on the help page: data(api) ## one-stage cluster sample dclus1-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc) svyvar(~api00+enroll+api.stu+api99, dclus1) variance SE api0011182.8 1386.4 api0011516.3 1412.9 api.stu -4547.1 3164.9 api9912735.2 1450.1 If I look at the full matrix for the variances (and covariances): test-svyvar(~api00+enroll+api.stu+api99, dclus1) print(test, covariance=T) variance SE api00:api00 11182.8 1386.4 enroll:api00 -5492.4 3458.1 api.stu:api00-4547.1 3164.9 api99:api00 11516.3 1412.9 api00:enroll -5492.4 3458.1 enroll:enroll 136424.3 41377.2 api.stu:enroll 114035.7 34153.9 api99:enroll -3922.3 3589.9 api00:api.stu-4547.1 3164.9 enroll:api.stu 114035.7 34153.9 api.stu:api.stu 96218.9 28413.7 api99:api.stu-3060.0 3260.9 api00:api99 11516.3 1412.9 enroll:api99 -3922.3 3589.9 api.stu:api99-3060.0 3260.9 api99:api99 12735.2 1450.1 I see that the function is actually returning the covariance for the api.stu with the api00 variable. I can get the correct variances if I just take diag(test) But I just was wondering if anyone else was having this problem. I'm using : sessionInfo() R version 2.10.1 Patched (2009-12-20 r50794) x86_64-apple-darwin9.8.0 locale: [1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] survey_3.19 loaded via a namespace (and not attached): [1] tools_2.10.1 And have the same error on a linux server. Thanks, Corey -- Corey Sparks Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio 501 West Durango Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu https://rowdyspace.utsa.edu/users/ozd504/www/index.htm __ 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.
Re: [R] Strange result in survey package: svyvar
Fair enough. CS - Corey Sparks, PhD Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio 501 West Durango Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu https://rowdyspace.utsa.edu/users/ozd504/www/index.htm -- View this message in context: http://n4.nabble.com/Strange-result-in-survey-package-svyvar-tp1587818p1587838.html Sent from the R help mailing list archive at Nabble.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, self-contained, reproducible code.
Re: [R] logistic regression by group?
Hi, first, you should always provide some repeatable code for us to have a look at, that shows what you have tried so far. That being said, you can use the subset= option in glm to subdivide your data and run separate models like that, e.g. fit.1-glm(y~x1+x2, data=yourdat, family=binomial, subset=group==1) fit.2-glm(y~x1+x2, data=yourdat, family=binomial, subset=group==2) where group is your grouping variable. Which should give you that kind of stratified model. Hope this helps, Corey - Corey Sparks, PhD Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio 501 West Durango Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu https://rowdyspace.utsa.edu/users/ozd504/www/index.htm -- View this message in context: http://n4.nabble.com/logistic-regression-by-group-tp1577655p1577971.html Sent from the R help mailing list archive at Nabble.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, self-contained, reproducible code.
Re: [R] Three most useful R package
3 most used packages: 1)spdep (for spatial regression/statistics) 2)car 3)survival (which is recommended, so) 3.5) survey (for analysis of complex survey samples) Best to all, Corey - Corey Sparks, PhD Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio 501 West Durango Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu https://rowdyspace.utsa.edu/users/ozd504/www/index.htm -- View this message in context: http://n4.nabble.com/Three-most-useful-R-package-tp1575671p1576560.html Sent from the R help mailing list archive at Nabble.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, self-contained, reproducible code.
Re: [R] R Output and ArcGIS
Yes, R thinks the coordinates are characters, that needs to change. Also, alternatively you could use the write .dbf function in the foreign() library, ArcGis likes dbf files (just no long names) Corey - Corey Sparks, PhD Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio 501 West Durango Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu https://rowdyspace.utsa.edu/users/ozd504/www/index.htm -- View this message in context: http://n4.nabble.com/R-Output-and-ArcGIS-tp1289606p1290310.html Sent from the R help mailing list archive at Nabble.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, self-contained, reproducible code.
Re: [R] R ON Mac
Hi, it appears that your corrdinates contain commas, instead of decimal points, R sees the commas and immediatly thinks the data are text, you should replace the commas with decimal points in a text editor. Corey gedasg wrote: hello, I have strange error. gyliai-read.table(file.choose(),header=T) summary(gyliai) xy gylis 307577,08: 1 6124296,56: 1 3,00 : 59 308613,01: 1 6124353,50: 1 2,80 : 51 313800,45: 1 6124530,65: 1 3,10 : 36 313840,17: 1 6124970,20: 1 2,90 : 32 313864,05: 1 6124991,68: 1 2,70 : 22 313869,26: 1 6125009,34: 1 3,43 : 5 (Other) :393 (Other) :393 (Other):194 coordinates(gyliai)=~x+y Error in .checkNumericCoerce2double(obj) : cannot retrieve coordinates from non-numeric elements Your version of R is up to date Error in .checkNumericCoerce2double(obj) : cannot retrieve coordinates from non-numeric elements - whats is that I use Gstat, mass, and sp packages. any ideas why this error shows to me? I check it on windows couple days ago it worked fine, but not on my mac, I don't have windows pc at the moment :) so help me :) Gedas -- View this message in context: http://n4.nabble.com/R-ON-Mac-tp1013829p1013925.html Sent from the R help mailing list archive at Nabble.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, self-contained, reproducible code.
[R] Multivariate Poisson GLM??
Dear R Users, I'm working on a problem where I have a multivariate response vector of counts and a continuous predictor. I've thought about doing this the same way you would do a Multvariate regression model with normally distributed data, but since these data are counts, they are probably better modeled with a Poisson distribution. For example y1-rpois(100,3.5) y2-rpois(100,1.5) y3-rpois(100,.09) x-rnorm(100, mean=25, sd=10) dat-data.frame(y1, y2, y3, x) #Get the Multivariate linear model assuming normality fit-lm(cbind(y1,y2,y3)~x, data=dat) fit.0-update(fit, ~1) #Calculate Pillai's trace for global model test anova(fit, fit.0) But, if I try this approach with glm() instead of lm(), I get the error indicating that a multivariate response vector isn't allowed in glm fit.pois-glm(cbind(y1,y2,y3)~x, data=dat, family=poisson) Error: (subscript) logical subscript too long If anyone has experience with a multivariate Poisson response vector I would gladly appreciate any suggestions. Corey Sparks -- Corey Sparks Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio 501 West Durango Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu https://rowdyspace.utsa.edu/users/ozd504/www/index.htm __ 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.
Re: [R] Spatial Autocorrelation
Hi Paulo, if your data are distance matrices, you might consider doing a Mantel test, look at the mantel() function in package vegan. While this is not technically measuring spatial autocorrelation, it will test for correlation between the attribute distances and the geographic distances. Also, if you can coax your data back into a point shapefile (for example), you can use the tools in the spdep package which will measure actual spatial autocorrelation (such as Moran's I and Geary's C). Best, Corey silcha wrote: Hi Paulo, you may want to take a look at http://cran.r-project.org/web/views/Spatial.html there, you can find all spatial packages that can be useful for your question. There is also a a mailing list R-sig-geo that where you can ask all those kind of question. Hope that this helps. Cheers Anna Anna Freni Sterrantino Ph.D Student Department of Statistics University of Bologna, Italy via Belle Arti 41, 40124 BO. Da: P.Branco pjlbra...@yahoo.com A: r-help@r-project.org Inviato: Martedì 6 ottobre 2009, 13:28:36 Oggetto: [R] Spatial Autocorrelation Hello, I have a matrix with the distances among sites. And I have another matrix with the presence and absence of each species in each site. I would like to test the spatial autocorrelation among sites. I have tried to use the function gearymoran of the ade4 package, but error messages keep popping up. Do you know any function for me to test the spatial autocorrelation of my data? Thanks, Paulo Branco -- View this message in context: http://www.nabble.com/Spatial-Autocorrelation-tp25767010p25767010.html Sent from the R help mailing list archive at Nabble.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, self-contained, reproducible code. __ spazio gratuito per i tuoi file e i messaggi [[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-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Spatial-Autocorrelation-tp25767010p25768890.html Sent from the R help mailing list archive at Nabble.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, self-contained, reproducible code.
[R] Subsetting dataframes based on column names
Dear R users, I am interested in taking the columns from multiple dataframes, the problem is that the different dataframes have different combinations of the same variable names, here's a simple example: a-rep(1:10) b-rep(1:10) c-rep(21:30) d-rep(31:40) dat.a-data.frame(a,b,c,d) names(dat.a)-c(a, b, c, d) dat.b-data.frame(a,c,d) names(dat.b)-c(a, c, d) I would like to first see if the names in the larger dataframe match those of the smaller (they have the same variables) names(dat.a)%in%names(dat.b) Could anyone help with this problem, I would basically like to form a subset of the dat.a that matches the variable names in dat.b. If there were only a few variables, this would be easier, but I have between 4 and 5 thousand variables in each dataset Any help would be greatly appreciated. Best, Corey Corey Sparks Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio College of Public Policy 501 West Durango Blvd Monterey Building 2.270C San Antonio, TX 78207 210 458 3166 corey.sparks 'at' utsa.edu __ 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.
[R] Using gregexpr with multiple search elements
Dear list, I am trying to use gregexpr to see if entries in a dataframe have either of two possible values for a string. here's an example text-c(fat, rat, cat, dog, log, fish) If I just wanted to find if any one of the elements in text match the pattern at I would do gregexpr(\\at, text) which would match on the first three elements, you can do something like ifelse(gregexpr(\\at,text)-1, 1,0) to see if a particular entry in the data text is matched. My problem is I need to check if either of two patterns match in the data, an example that doesn't work is gregexpr(c(\\at, \\og), text) which is the basic form of what I'm looking to do, if this would work I would get a match for elements 1 through 5 of text, since either at or og occurs. If anyone might have an idea about this I would greatly appreciate it. Best, Corey Corey Sparks Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio One UTSA Circle San Antonio, TX 78249 210 458 6858 corey.spa...@utsa.edu __ 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.
[R] svyglm fit method?
Dear list, I am using svyglm in the survey library to fit a binomial logistic regression accounting for sample design. The documentation says the models are not fit by maximum likelihood, so my question is what is the fitting method? Pseudo likelihood? Generalized least squares? Thanks for any insight. Best, Corey Corey Sparks Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio One UTSA Circle San Antonio, TX 78249 210 458 6858 corey.spa...@utsa.edu __ 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.
[R] Help using tapply with multiple variables
Dear list, I have the function (as a simple example, which is actually part of a larger function) pres.test-function(N0=N0, N1=N1) { dt-5 r-log(N1/N0)/dt r } which calculates the annual growth rates in a population Where N0 is the population classified into age intervals, say 5 years, at time=1995, and N1 is the population by 5 year age classes at time=2000. For example some data like this are: country pop1995 pop2000 1 17121940 1 13291535 1 11011268 1 9111048 1 758 859 2 627 710 2 513 584 2 420 475 2 754 965 2 638 741 I want to use the tapply function to apply the pres.test function over all countries in my data table (the real data have ~150 countries and 10 age classes), but I can't seem to get tapply to take as input to FUN more than one variable, for example I tried: popdat-cbind(dat2.sub$pop1995, dat2.sub$pop2000) #try to force the two time points into a vector form tapply(popdat, dat2.sub$country, pres.test, ...=list(N0=popdat[,1], N1=popdat[,2])) #tried to pass the other arguments that pres.test needs via ... And got the error: Error in tapply(popdat, dat2.sub$Country, pres.test, ... = list(N0 = popdat[, : arguments must have same length I see that the function mapply will take multiple arguements, but I don't think it will use an INDEX like tapply. Any comments or clarification would be most appreciated. Corey -- Corey Sparks Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio One UTSA Circle San Antonio, TX 78249 210-458-6858 [EMAIL PROTECTED] https://rowdyspace.utsa.edu/users/ozd504/www/index.htm __ 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.
[R] Likelihood ratio test between glm and glmer fits
Dear list, I am fitting a logistic multi-level regression model and need to test the difference between the ordinary logistic regression from a glm() fit and the mixed effects fit from glmer(), basically I want to do a likelihood ratio test between the two fits. The data are like this: My outcome is a (1,0) for health status, I have several (1,0) dummy variables RURAL, SMOKE, DRINK, EMPLOYED, highereduc, INDIG, male, divorced, SINGLE, chronic, vigor_d and moderat_d and AGE is continuous (20 to 100). My higher level is called munid and has 581 levels. The data have 45243 observations. Here are my program statements: #GLM fit ph.fit.2-glm(poorhealth~RURAL+SMOKE+DRINK+EMPLOYED+highereduc+INDIG+AGE+male+divorced+SINGLE+chronic+vigor_d+moderat_d,family=binomial(), data=mx.merge) #GLMER fit ph.fit.3-glmer(poorhealth~RURAL+SMOKE+DRINK+EMPLOYED+INSURANCE+highereduc+INDIG+AGE+male+divorced+SINGLE+chronic+vigor_d+moderat_d+(1|munid),family=binomial(), data=mx.merge) I cannot find a method in R that will do the LR test between a glm and a glmer fit, so I try to do it using the liklihoods from both models #form the likelihood ratio test between the glm and glmer fits x2--2*(logLik(ph.fit.2)-logLik(ph.fit.3)) ML 79.60454 attr(,nobs) n 45243 attr(,nall) n 45243 attr(,df) [1] 14 attr(,REML) [1] FALSE attr(,class) [1] logLik #Get the associated p-value dchisq(x2,14) ML 5.94849e-15 Which looks like an improvement in model fit to me. Am I seeing this correctly or are the two models even able to be compared? they are both estimated via maximum likelihood, so they should be, I think. Any help would be appreciated. Corey Corey S. Sparks, Ph.D. Assistant Professor Department of Demography and Organization Studies University of Texas San Antonio One UTSA Circle San Antonio, TX 78249 email:[EMAIL PROTECTED] web: https://rowdyspace.utsa.edu/users/ozd504/www/index.htm [[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-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Use of survreg.distributions
It would seem to me that your problem is in your data. For survreg, you have to have positive durations, and if your data have y=-5 as seen in Error in survreg(Surv(y, y = -5, type = left) ~ x + : Invalid survival times for this distribution In addition: Warning messages: 1: In log(dlist$dtrans(Y[exactsurv, 1])) : NaNs produced 2: In log(y) : NaNs produced then you have negative durations in the data. I would suggest truncating your data at y0, as that would avoid taking natural logs of negative numbers. Corey Sparks Corey S. Sparks, Ph.D. Assistant Professor Department of Demography and Organization Studies University of Texas San Antonio One UTSA Circle San Antonio, TX 78249 email:[EMAIL PROTECTED] Date: Fri, 25 Apr 2008 10:02:21 -0700 (PDT) From: Abdus Sattar [EMAIL PROTECTED] Subject: Re: [R] Use of survreg.distributions To: Terry Therneau [EMAIL PROTECTED] Cc: r-help@R-project.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain Hello Dr. Therneau: Thank you for your response. Let me explain to you want I want. My y variable(time) is normal and would like to fit the model on logarithmic transformation of y (log(y)). I tried to run codes according to your suggestion: tfit=survreg(Surv(y, y=-5, type=left)~x + cluster(id), dist=lognormal, data=y.data, scale=0, weights=w) The following error message is giving: Error in survreg(Surv(y, y = -5, type = left) ~ x + : Invalid survival times for this distribution In addition: Warning messages: 1: In log(dlist$dtrans(Y[exactsurv, 1])) : NaNs produced 2: In log(y) : NaNs produced Note, the data file y.data does not contain any missing data! Do you know why it is giving me such an error message please? Thank you again for your helpful comment/suggestion. Best Regards, Abdus Sattar [EMAIL PROTECTED] - Original Message From: Terry Therneau [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: r-help@R-project.org Sent: Friday, April 25, 2008 8:46:45 AM Subject: Re: [R] Use of survreg.distributions --begin included message --- I am using survreg(Surv()) for fitting a Tobit model of left-censored longitudinal data. For logarithmic transformation of y data, I am trying use survreg.distributions in the following way: tfit=survreg(Surv(y, y=-5, type=left)~x + cluster(id), dist=gaussian, data=y.data, scale=0, weights=w) my.gaussian-survreg.distributions$gaussian my.gaussian$name=lognormal my.gaussian$dist-my.gaussian tfit=survreg(Surv(y, y=-5, type=left)~x + cluster(id), dist=my.gaussian, data=y.data, scale=0, weights=w) If I run these codes then I got the following error message, Error in survreg(Surv(y, y = -5, type = left) ~ x + : Invalid distribution object Does anybody can help me in identifying the error(s) in these code please? --- end include Can you tell us what you are trying to do? Your first model was a fit of y ~ x + eps, eps ~ Gaussian. If what you want is log(y) ~ x + eps, then all that you need do is use dist=loggaussian in the survreg call. (Or 'lognormal'; which is the same distribution.) Terry Therneau __ 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.
Re: [R] Compare mean survival time
Xing Yuan wrote: Dear List, Does anybody no how to compare mean survival times for two (more) groups in R? What test statistics should I use? You should be careful considering the mean survival time, because censoring in survival data often makes the mean less informative. The median survival time is what is generally recommended for testing (i.e. in survdiff) and the statistical test of the median survival times following the methods in Harrington and Fleming (1982) Biometrika v.69 pp553-566. Corey Corey S. Sparks, Ph.D. Assistant Professor Department of Demography and Organization Studies University of Texas San Antonio One UTSA Circle San Antonio, TX 78249 email:[EMAIL PROTECTED] [[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-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Importing Large Dataset into Excel
Did you try read.xls() in the xlsReadWrite library, I have had good success with this. Corey Corey S. Sparks, Ph.D. Assistant Professor Department of Demography and Organization Studies University of Texas San Antonio One UTSA Circle San Antonio, TX 78249 email:[EMAIL PROTECTED] [[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-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] coxme frailty model standard errors?
Hello, I am running R 2.6.1 on windows xp I am trying to fit a cox proportional hazard model with a shared Gaussian frailty term using coxme My model is specified as: nofit1-coxme(Surv(Age,cen1new)~ Sex+bo2+bo3,random=~1|isl,data=mydat) With x1-x3 being dummy variables, and isl being the community level variable with 4 levels. Does anyone know if there is a way to get the standard error for the random effect, like in nofit1$var? I would like to know if my random effect is worth writing home about. Any help would be most appreciated Corey Sparks I can get the following output nofit1-coxme(Surv(Age,cen1new)~ Sex+bo2+bo3,random=~1|isl, data=no1901) nofit1 Cox mixed-effects model fit by maximum likelihood Data: no1901 n=959 (2313 observations deleted due to missingness) Iterations= 3 69 NULL Integrated Penalized Log-likelihood -600.0795 -581.1718 -577.9682 Penalized loglik: chisq= 44.22 on 5.61 degrees of freedom, p= 4.3e-08 Integrated loglik: chisq= 37.82 on 4 degrees of freedom, p= 1.2e-07 Fixed effects: Surv(Age, cen1new) ~ Sex + bo2 + bo3 coef exp(coef) se(coef)z p Sex 0.2269214 1.254731 0.2151837 1.05 0.2900 bo2 0.5046991 1.656487 0.2510523 2.01 0.0440 bo3 1.0606144 2.888145 0.2726000 3.89 0.0001 Random effects: ~1 | isl isl Variance: 0.3876189 Corey Sparks Assistant Professor Department of Demography and Organization Studies University of Texas-San Antonio One UTSA Circle San Antonio TX 78249 Phone: 210 458 6858 [EMAIL PROTECTED] __ 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.
[R] coxme frailty model standard errors?
Hello, I am running R 2.6.1 on windows xp I am trying to fit a cox proportional hazard model with a shared Gaussian frailty term using coxme My model is specified as: nofit1-coxme(Surv(Age,cen1new)~ Sex+bo2+bo3,random=~1|isl,data=mydat) With x1-x3 being dummy variables, and isl being the community level variable with 4 levels. Does anyone know if there is a way to get the standard error for the random effect, like in nofit1$var? I would like to know if my random effect is worth writing home about. Any help would be most appreciated Corey Sparks I can get the following output nofit1-coxme(Surv(Age,cen1new)~ Sex+bo2+bo3,random=~1|isl, data=no1901) nofit1 Cox mixed-effects model fit by maximum likelihood Data: no1901 n=959 (2313 observations deleted due to missingness) Iterations= 3 69 NULL Integrated Penalized Log-likelihood -600.0795 -581.1718 -577.9682 Penalized loglik: chisq= 44.22 on 5.61 degrees of freedom, p= 4.3e-08 Integrated loglik: chisq= 37.82 on 4 degrees of freedom, p= 1.2e-07 Fixed effects: Surv(Age, cen1new) ~ Sex + bo2 + bo3 coef exp(coef) se(coef)z p Sex 0.2269214 1.254731 0.2151837 1.05 0.2900 bo2 0.5046991 1.656487 0.2510523 2.01 0.0440 bo3 1.0606144 2.888145 0.2726000 3.89 0.0001 Random effects: ~1 | isl isl Variance: 0.3876189 Corey Sparks Assistant Professor Department of Demography and Organization Studies University of Texas-San Antonio One UTSA Circle San Antonio TX 78249 Phone: 210 458 6858 [EMAIL PROTECTED] __ 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.