similar to: help with as.numeric

Displaying 20 results from an estimated 30000 matches similar to: "help with as.numeric"

2006 Aug 03
2
run self written functions
Hello, I'm not sure if I'm in the right place with my question... I'm running R on Windows and wrote a function and saved it as .R file. It looks like this: bmi <- function(weight, height) { bmi <- weight / height^2 bmi } If I want to use this function, I have to mark everything and then press Ctrl-R. But then everything single line is executed on the command line,
2012 Nov 19
9
Stepwise analysis with fixed variables
Hello, How can I run a backward stepwise regression with part of the variables fixed, while the others participate in the backward stepwise analysis? Thank you, Einat -- View this message in context: http://r.789695.n4.nabble.com/Stepwise-analysis-with-fixed-variables-tp4650015.html Sent from the R help mailing list archive at Nabble.com.
2008 Mar 17
1
Std errors in glm models w/ and w/o intercept
I am doing a reanalysis of results that have previously been published. My hope was to demonstrate the value of adoption of more modern regression methods in preference to the traditional approach of univariate stratification. I have encountered a puzzle regarding differences between I thought would be two equivalent analyses. Using a single factor, I compare poisson models with and without
2005 Nov 29
2
permutation test for linear models with continuous covariates
Hi I was wondering if there is a permutation test available in R for linear models with continuous dependent covariates. I want to do a test like the one shown here. bmi<-rnorm(100,25) x<-c(rep(0,75),rep(1,25)) y<-rnorm(100)+bmi^(1/2)+rnorm(100,2)*x+bmi*x H0<-lm(y~1+x+bmi) H1<-lm(y~1+x+bmi+x*bmi) anova(H0,H1) summary(lm(y~1+x+bmi)) But I want to use permutation testing to
2011 Oct 06
1
error messages
Im doing a project using Rcommander. I have a dataset with 5 variables, BMI being one of them. I would like to find the variance, standard deviation, range, median, etc of BMI. However, everytime I type a command into the script window, (such as var(BMI$BMI,na.rm=TRUE) )an error message pops up saying Object "BMI" not found. I can graph it, work it, do t-test, etc,. It's listed as
2011 Jan 23
2
Creating subsets of a matrix
Hello, Say I have 2 columns, bmi and gender, the first being all the values and the second being male or female. How would I subset this into males only and females only? I have searched these fora and read endlessly about select[] and split() functions but to no avail. Also the table is not ordered. bmi gender -> bmi gender + bmi gender 1 24.78 male
2005 Jun 02
3
How to change all name of variables
Dear R-helpers, First I apologize if my question is quite simple I have a large datasets which more 100 variables. For a research I need to change all name of variables with add one or more letters on each variables. For example, > data(Pima.tr) > Pima.tr[1:5,] npreg glu bp skin bmi ped age type 1 5 86 68 28 30.2 0.364 24 No 2 7 195 70 33 25.1 0.163 55 Yes 3 5
2015 Aug 02
3
ayuda con análisis de supervivencia
Hola a todos, -Estoy estudiando el efecto de dos genotipos (~tratamientos) en la aparición de síndrome metabólico (MetS) con datos longitudinales recogidos a tiempo 0,7,10,15,20 y 25 años. -He hecho un dataframe con las siguientes variables MetS: Síndrome Metabólico (Si=1,No=0) bmi: Indice de masa corporal (IMC) cuando se produce la conversión a MetS+ . Para los que permancen MetS-, esta variable
2006 Jun 27
1
change the class of an object within with()
Hello, Can anyone explain me what is wrong in the following code? and in particular why it is not possible to change the class of an object thanks to the function with(). Does an alternative exist? xxx <- data.frame(x = c("a","b","c","d","e"), y = c("1","2","3","4","5")) str(xxx) with(xxx, {
2008 Jan 01
3
if statement problem
Hi All, I have a small dataset named das (43 cases) in which I am trying to create a binary outcome (1/0) based on the following code: if (das$age>65 && das$bmi>30) {das$danger<-1} else das$danger<-0 I am setting a flag called 'danger' to 1 of the subject is over 65 and has a BMI > 30. I find that my statement evaluates the first record in the data.frame and
2009 Dec 30
1
glm error: cannot correct step size
R 2.8.1 windows XP I am getting an error message that I don't understand when I try to run GLM. The error only occurs when I have all independent variables in the model. When I drop one independent variable, the model runs fine. Can anyone help me understand what the error means and how I can correct it? Thank you, John > fit11<-glm(AAMTCARE~BMI+BMIsq+SEX+jPHI+jMEDICAID+factor(AgeCat)+
2006 Apr 25
4
Help needed
Hi, I am trying to change a SAS macro to R. here is my code. I get an error at the last line. attach(fram) dset1<-cbind(AGE,BMI,DEATH) > BMIGRP<-cut(BMI,breaks=3,right=TRUE) > AGEGRP<-floor(AGE/10)-2 > dset<-cbind(AGEGRP,BMIGRP,DEATH) > maxage<-max(dset[,1]) > minage<-min(dset[,1]) > #maxcls<-dset[,2] > #mincls<-dset[,2] >
2010 Sep 23
1
How to pass a model formula as argument to with.mids
Hello I would like to pass a model formula as an argument to the with.mids function from the mice package. The with.mids functon fits models to multiply imputed data sets. Here's a simple example library(mice) #Create multiple imputations on the nhanes data contained in the mice package. imp <- mice(nahnes) #Fitting a linear model with each imputed data set the regular way works
2010 Oct 25
2
Question on passing the subset argument to an lm wrapper
Hello, How would you go about handling the following situation? This is on R 2.12.0 on Ubuntu 32-bit. I have a wrapper function to lm. I want to pass in a subset argument. First, I just thought I'd use "...". ## make example reproducible set.seed(123) df1 <- data.frame(age = rnorm(100, 50, 10), bmi = rnorm(100, 30, sd = 2)) ## create a wrapper using
2018 May 22
0
Bootstrap and average median squared error
Hello, If you want to bootstrap a statistic, I suggest you use base package boot. You would need the data in a data.frame, see how you could do it. library(boot) bootMedianSE <- function(data, indices){ d <- data[indices, ] fit <- rq(crp ~ bmi + glucose, tau = 0.5, data = d) ypred <- predict(fit) y <- d$crp median(y - ypred)^2 } dat <-
2012 Mar 19
2
fitted values with locfit
Dear memberships, I'm trying to estimate the following multivariate local regression model using the "locfit" package: BMI=m1(RCC)+m2(WCC) where (m1) and (m2) are unknown smooth functions. My problem is that once I get the regression done I cannot get the fitted values of each of this smooth functions (m1) and (m2). What I write is the following library(locfit) data(ais)
2008 Dec 07
1
Reading txt file in R
Hi:   I am using the following code to read a data set in txt in R and using the follwoing model. But it seems to give me an error ' expected variable name error pos 134022'. Any help is greatly appreciated.   Code: anal.data <- read.table("nausea.txt", header=T, sep="\t") list(names(anal.data)) attach(anal.data) n.samples <- dim(anal.data) [1] # number of data
2018 May 22
2
Bootstrap and average median squared error
I forgot, you should also set.seed() before calling boot() to make the results reproducible. Rui Barradas On 5/22/2018 10:00 AM, Rui Barradas wrote: > Hello, > > If you want to bootstrap a statistic, I suggest you use base package boot. > You would need the data in a data.frame, see how you could do it. > > > library(boot) > > bootMedianSE <- function(data,
2018 May 21
2
Bootstrap and average median squared error
Dear R-experts, I am trying to bootstrap (and average) the median squared error evaluation metric for a robust regression. I can't get it. What is going wrong ? Here is the reproducible example. ############################# install.packages( "quantreg" ) library(quantreg) crp <-c(12,14,13,24,25,34,45,56,25,34,47,44,35,24,53,44,55,46,36,67) bmi
2008 Jun 03
1
some problems I have met in LARS
Hi: I loaded the LARS package,and input: data(diabetes),load the embedded data then I found the varialbes are in this form: x.age,x.bmi......(10 of them),X2.age,X2.bmi....(64 of them) When I input x,R gave me all 10 varialbes,and input X2,it gave me 64 variables,but if I input x.age,it returned nothing,I wonder how to affiliate those subvariable such as x.age,x.bmi to x,since I