search for: birthwt

Displaying 20 results from an estimated 20 matches for "birthwt".

2015 Jul 21
2
glm com etiquetas en las variables
Hola: Si aún hay alguien que no está de vacaciones, igual me pueden ayudar. Quiero ajustar unos modelos: REG_LOG <- glm (low ~ X, family = "binomial", data = DATOS) Ejemplo: library(MASS) data(birthwt, package="MASS") birthwt$low <- factor(birthwt$low) birthwt$race <- factor(birthwt$smoke) REG_LOG <- glm (low ~ smoke, family = "binomial", data = birthwt) summary (REG_LOG) Se pueden colocar etiquetas en las variable de la fórmula de manera que en los resulta...
2008 Oct 11
1
step() and stepAIC()
The birth weight example from ?stepAIC in package MASS runs well as indeed it should. However when I change stepAIC() calls to step() calls I get warning messages that I don't understand, although the output is similar. Warning messages: 1: In model.response(m, "numeric") : using type="numeric" with a factor response will be ignored (and three more the same.) Checked
2015 Jul 14
4
Conservar el nombre de la variable entre varias funciones: ejemplos de resultados
Hola Carlos: Te adjunto un ejemplo de aplicación: las funciones (he borrado los path de las funciones y las ordenes "source()" que las carga ) y un ejemplo para ejecutarlas para las opciones que tengo implementadas con la tabla de datos birthwt del paquete"MASS": - Descriptiva de todas las variables de una tabla. - Análisis univariado de todas las variables de una tabla cruzadas con una variable dependiente cualitativa. =Inicio funciones ======================================== ##------------------------------------------------...
2015 Jul 27
2
Error sql en función
...: ======================== > library(MASS) > library (sqldf) # Per SQL > data(Aids2, package="MASS") > SQL_PROVA = function (XDADES, XWHE) + { + XDADES_SQL = sqldf ("select * from $XDADES $XWHE") + return(XDADES_SQL) + } > DADES_SEL = SQL_PROVA (XDADES = birthwt, XWHE = "where age < '40'") Error in sqliteSendQuery(con, statement, bind.data) : error in statement: near "$XDADES": syntax error ======================== Evidentemente da error. Tampoco funcionaba si introducía \"age\" en el agumento del where: =====...
2004 Jul 28
1
automating sequence of multinomial regressions
Disclaimer first: I only heard about R fairly recently, so I apologize if this is either a simple or impossible request, but R looked like it might be a good framework for this sort of thing... Is it possible to write a script to run stepwise multinomial regressions on many *dependent* variables, and then compare results to a validation data set (e.g., Chow test)? Essentially, automate the
2015 Jul 27
2
Error sql en función
...una función no se como pasarle los argumentos para que funcione: ========================== > SQL_PROVA = function (XDADES, XWHE) + { + XDADES_SQL = sqldf (paste ("select * from", XDADES, XWHE, sep = " ")) + return(XDADES_SQL) + } > DADES_SEL = SQL_PROVA (XDADES = birthwt, XWHE = "where age < '40'") Error in sqliteSendQuery(con, statement, bind.data) : error in statement: near "fromc": syntax error ========================== Alguien puede ayudarme y decir que estoy haciendo mal? El problema debe estar en el "paste" ya que...
2000 Dec 12
1
smoothing binary data
...to be the "sm.logit" function in library "sm", but I haven't had success with it. Below, is some code illustrating what I've come up with so far, but I'm hoping there is a better approach. I'm using R 1.2 (development) under Windows 98. -Bill library(MASS) data(birthwt) attach(birthwt) # This doesn't work for me, no matter what h equals # Maybe I'm doing something wrong library(sm) sm.logit(age,low,h=3) # This "works", but controlling the degree of smoothing # is problematic library(gss) logit.fit <- gssanova(low ~ age,family="binomia...
2009 Jul 02
0
MCMCpack: Selecting a better model using BayesFactor
...ther models. 3. Overall, by looking at the values for PostProbMod(BF), one can say that higher posterior probability indicates the better model. Once again, thank you very much for the time you have given. I am looking forward for your reply. Regards, Deb R Code: library(MCMCpack) data(birthwt) model1 <- MCMCregress(bwt~age+lwt+as.factor(race) + smoke + ht, data=birthwt, b0=c(2700, 0, 0, -500, -500, -500, -500), B0=c(1e-6, .01, .01, 1.6e-5, 1.6e-5, 1.6e-5, 1.6e-5), c0=10, d0=4500000, marginal.likelihood="Chib95", mcmc=50000) model2 <- MCMCregress(bwt~age+lwt+as.factor(rac...
2006 May 11
3
Now another question regarding the Foreign package
...understand reads in various datasets from programs such as SPSS and SAS. There isn't much documentation that I can find regarding the specifics of this in the online docs, but I assume that it is like read.table. So, here is what I wrote and here is what I got. bw2 <- read.spss("c:\birthwt.sav") Error: couldn't find function "read.spss" Any thoughts? Thanks again for your help. David [[alternative HTML version deleted]]
1999 Jan 07
2
errores
...* ordered(Time), random = ~1, cluster = ~tree, : unused argument to function The example listed on the help for LME worked without problem. I don't know if my last error reports got out of Mexico or not so here they are again. 3. The following code on page 236 of Venables and Ripley 1997 birthwt.step2 <- step(birthwt.glm,~.^2+I(scale(age)^2)+I(scale(lwt)^2),trace=F) produced the following warning message 8 times Warning: ignored non function "scale" 4. The following code on page 358 of Venables and Venables 1997 plot(survfit(leuk.coxs),lty=2:3,lwd=3,add=T,log=T) produce...
2009 Aug 10
1
(sin asunto)
Tengo un problema que me dice: La libreria MASS de R contiene el fichero birthwt.Trabajando sobre estos datos: 1.-Recodifica las variables tal y como aparece en la ayuda sobre este fichero en R. 2.-Analiza e interpreta la posible asociacion estadistica entre las variables low y smoke. ¿Alguien me podria explicar como hacerlo? Ademas, si alguien puede, no entiendo la validac...
2003 May 05
1
Error in library(MASS) : package/namespace load failed
Dear all, I have installed 1.7.0 on my Win XP and want to use MASS. But I get this error message: > library(MASS) Error in namespaceExport(ns, exports) : undefined exports: abbey, accdeaths, Aids2, Animals, anorexia, austres, bacteria, beav1, beav2, biopsy, birthwt, ... Error in library(MASS) : package/namespace load failed I therefore again downloaded VR.zip. When I extracted the files I always answered yes to the question of "Would you like to replace the existing file?" I also "Skip File" MASS.dll because password is needed....? I...
2010 Oct 12
1
Help with function writing
...doing this? Example: #define function involving regression model with several covariates custom <- function(outcome, exposure, covar1, covar2, covar3){ model <- lm(outcome ~ exposure + covar1 + covar2 + covar3) expected <- predict(model) summary(expected) } library(MASS) attach(birthwt) custom(bwt, lwt, low, age, race) #Works when 3 covariates are specified custom(bwt,lwt,low,age) # Does not work with < or > 3 covariates varlist <- list(low,age,race) custom(bwt,lwt, varlist) #Does not work if covariates are included as a list Thanks very much for your help Tim --...
2010 Feb 12
1
validate (rms package) using step instead of fastbw
...to use step instead of fastbw. I think this can be done by hacking predab.resample in a couple of places but I am wondering if this is a bad idea (why?) or if I am reinventing the wheel. Best, R. P.S. Simple example of fastbw compared to step: library(MASS) ## for stepAIC and bwt data example(birthwt) library(rms) bwt.glm <- glm(low ~ ., family = binomial, data = bwt) bwt.lrm <- lrm(low ~ ., data = bwt) step(bwt.glm) ## same as stepAIC(bwt.glm) fastbw(bwt.lrm) -- Ramon Diaz-Uriarte Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.or...
2006 Aug 03
1
how to use the EV AND condEV from BMA's results?
...coefficient conditional on the variable being included in the model), But it's still unclear about the results explanations, and the artile of Rnews in 2005 on BMA still don't give more detail on it. Suppose my results of logistic regression analyzed by bic.glm (BMA) as follows:(dataset is birthwt(MASS) and i include the interaction) p!=0 EV SD condEV cond SD model 1 model 2 model 3 model 4 model 5 Intercept 100 0.1841 1.2204 0.184 1.220 1.017 1.175 -0.853 -1.057 0.532 age 17.8 -0.0113 0.02...
2008 Mar 18
1
glm poisson, method='ML' (PR#10985)
Full_Name: saraux Version: 2.6.1 OS: Windows vista Submission from: (NULL) (193.157.180.37) I would like to compute a glm with a distribution of poisson, using a maximum of likelihood method. But it seems not to work with a distribution of poisson. The same code with another distrubution (binomial for example) works. Here is the command I typed:
2008 Dec 19
0
"parm" argument in confint.multinom () nnet package
...package accepts the "parm" argument, it doesn't appear to offer this functionality if there are more than two response categories. Since this method isn't documented, maybe I shouldn't expect it to, but there seems to be a simple solution. Compare: library(MASS) example(birthwt) (bwt.mu <- multinom(low ~ ., bwt)) confint(bwt.mu,"age") with (bwt.mu2 <- multinom(race ~ ., bwt)) confint(bwt.mu2,"age") It looks like John Fox has something going on R-Forge regarding another version of the confint.multinom() function (http://r-forge.r-project...
2003 May 03
1
expand.grid
...ingency table as for example, > ft <- ftable(low ~ race + smoke, bwt) > ft low 0 1 race smoke white FALSE 40 4 TRUE 33 19 black FALSE 11 5 TRUE 4 6 other FALSE 35 20 TRUE 7 5 (here bwt is a transformation of the dataframe birthwt in library(MASS)). I wanted to analyse this table by a logistic model with low as response. So it seems useful to have a function that extracts the factors race and smoke from the table: > row.factors(ft) race smoke 1 white FALSE 2 white TRUE 3 black FALSE 4 black TRUE 5 other FALSE 6...
2003 Apr 09
1
'Apparently' trouble with name spaces and Sweave...
...ing the latest MASS package (which was my first thought). I am not having problems building other packages. Any thoughts? * creating vignettes ... ERROR Error in namespaceExport(ns, exports) : undefined exports: abbey, accdeaths, Aids2, Animals, anorexia, austres, bacteria, beav1, beav2, biopsy, birthwt, Boston, cabbages, caith, Cars93, cats, cement, chem, coop, cpus, crabs, Cushings, DDT, deaths, drivers, eagles, epil, farms, fdeaths, fgl, forbes, GAGurine, galaxies, gehan, genotype, geyser, gilgais, hills, housing, immer, Insurance, leuk, lh, mammals, MASS.data.load, mcycle, mdeaths, Melanoma, m...
2007 Dec 11
2
the observed "log odds" in logistic regression
Dear list: After reading the following two links: http://luna.cas.usf.edu/~mbrannic/files/regression/Logistic.html http://www.tufts.edu/~gdallal/logistic.htm I've known the mathematical basis for logistic regression.However I am still not so sure about the "logit " For a categorical independent variable, It is easy to understand the procedures how "log