[R] prune in rpart: choose number terminal nodes

2012-09-21 Thread agent dunham
Dear community, I've an rpart object, and I know the CP I want. I'd like to know if it's possible also to fix the number of terminal nodes I want. Thanks in advance, u...@host.com as u...@host.com -- View this message in context:

[R] when to use I, as is caret

2012-09-14 Thread agent dunham
Dear community, I've check it while working, but just to reassure myself. Let's say we have 2 models: model1 - lm(vdep ~ log(v1) + v2 + v3 + I(v4^2) , data = mydata) model2 - lm(vdep ~ log(v1) + v2 + v3 + v4^2, data = mydata) So in model1 you really square v4; and in model2, v4*^2

[R] predict rpart newdata - introduce only values variables used in the tree

2012-09-04 Thread agent dunham
Dear community, I've a tree which included at first 23 variables. Then I've pruned this tree, and there are only 8 variables involved. I'd like to predict and only introduce in newdata the values of these 8 variables involved. However, as the tree was built with the 23, it asked me for 15

[R] prune rpart - select option with less splits when 2 cp's are the same

2012-09-04 Thread agent dunham
Dear community, I want to prune a rpart object and select the one that has 13 splits: object.rpart$cptable CP nsplit rel errorxerror xstd 1 0.09489173 0 1.000 1.0006465 0.05641905 2 0.05053897 1 0.9051083 0.9234187 0.05427033 . . . 10 0.01279452 12

[R] which R version to connect with .net?

2012-08-08 Thread agent dunham
Dear community, I want to call R from .net. I've been reading this article: http://www.codeproject.com/Articles/25819/The-R-Statistical-Language-and-C-NET-Foundations. It says that first I need to download the COM server. When I do this, I see that the COM server is from 2008;

[R] how to call R commands from .net

2012-08-08 Thread agent dunham
Dear community, I want to call R from .net. Precisely I´d really like to call rpart from .net, plot decision trees and predict with them. I have installed the COM server (http://cran.es.r-project.org/contrib/extra/dcom/). Just to note, because it is from 2008, the only way to work with this

[R] prediction interval for predicted y mean at terminal node - rpart method anova

2012-07-13 Thread agent dunham
Dear community, I'm using rpart and would like to extract 95% prediction interval at each terminal node from a regression tree (built with rpart, method= anova) Is that possible? Thanks in advance, u...@host.com as crossp...@host.com -- View this message in context:

Re: [R] outlier identify in qqplot

2012-05-10 Thread agent dunham
Sorry, but I need the same and i don't understand your help. So, after fitting my lm model, how can i identify my data? I was trying the following, but it doesn't work. /identify(qnorm(c(0.25, 0.75)),quantile(rstandard(mymodel)[!is.na(rstandard(mymodel))], c(0.25, 0.75)),row.names(mydata))

Re: [R] outlier identify in qqplot

2012-05-10 Thread agent dunham
Find the data attached, http://r.789695.n4.nabble.com/file/n4623493/mydata.txt mydata.txt The model would be /lmmodel - lm(log(vdep) ~ v1 + sqrt(v2) + v3 +v5 + v6 + v7 + v8 + v9 + v10, data = mydata)/ Thanks again, u...@host.com -- View this message in context:

[R] plot mjca lambda = adjusted

2012-05-08 Thread agent dunham
Dear community, First of all, apologies, I'm pretty newbie, and maybe have not truly understood this multiple correspondence analysis. I have 9 categorial variables with 15, 12,12,7,9,11,8 ,4 , 31 levels respectively; that is 109 levels. (*By the way, is there any problem because of having

[R] lme or lmer for unbalance data

2012-05-04 Thread agent dunham
Dear community, I'd like to fix a mixed model. I have unbalance data, what should i use: lme in nlme package , or lmer in lme4. Thanks, u...@host.com as u...@host.com -- View this message in context: http://r.789695.n4.nabble.com/lme-or-lmer-for-unbalance-data-tp4608425.html Sent from the R

[R] NA's when subset in a dataframe

2012-05-03 Thread agent dunham
Dear community, I'm having this silly problem. I've a linear model. After fixing it, I wanted to know which data had studentized residuals larger than 3, so i tried this: d1 - cooks.distance(lmmodel) r - sqrt(abs(rstandard(lmmodel))) rstu - abs(rstudent(lmmodel)) a - cbind( mydata, d1,

[R] Work -Shift Scheduling - Constraint Linear Programming

2012-03-25 Thread agent dunham
Dear Community, I've a Work -Shift Scheduling Problem I'd like to solve via constraint linear programming. Maybe something similar to http://support.sas.com/documentation/cdl/en/orcpug/63349/HTML/default/viewer.htm#orcpug_clp_sect037.htm Can anybody suggest me any package/R examples to solve

[R] equivalent from gladder and ladder from stata

2012-02-29 Thread agent dunham
Dear community, Apologies, I'm still pretty newbie. Anyway, I am performing linar regression analysis. As a common cause of non-normally distributed residuals is non-normally predictor variables, i'm interested in achieving the best transformation of the predictors. I've seen some commands at

Re: [R] assign same legend colors than in the grouped data plot

2012-02-21 Thread agent dunham
Dear all, Thanks all of u for your help. Now I've another similar problem. I want to plot within the same plot, different lines, each one in a different color depending on the factor level. I've been able to do it like this, but if i try with rainbow colors it doesn't work. Can anybody help me

[R] assign same legend colors than in the grouped data plot

2012-02-15 Thread agent dunham
Dear community, I've plotted data and coloured depending on the factor variable v3. In the legend, I'd like to assign properly the same colors than in the factor (the factor has 5 levels). I've been trying this but it doesn't work. plot(var1, var2, xlab = var1, ylab = var2, col =var3 ,

[R] examine grouped data lmList

2012-01-18 Thread agent dunham
Dear community, I'm trying to examine my grouped data following page 6 http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-mixed-models.pdf. I'm trying lmList this way: model.list - lmList(log(v.dep) ~ log(v2) +log(v4) + v3 | v5, subset = v6=0, data=data) and obtain this error

[R] plot rq lm

2012-01-04 Thread agent dunham
Dear Community, I'd like to plot an rq object the same way I do with a lm one, is it possible? Something like this plot(rqmodel , 1:4, id.labels=rownames(pga1)); where rqmodel - rq(log(vd) ~ v1 + log(v2) +log(v3) + v4 + v5 ,data =dat) Thanks in advance and apologies, I'm pretty newbie with

[R] optim - Self-Start values - growth function

2012-01-03 Thread agent dunham
Dear community, I'm trying to model growth with this function: Yi = A* exp(-k*(1/ti^m)) ; A asymptote, k rate of decrease of the relative growth rate, m shape parameter. I don't have variable time so, finally, following some papers, I try to fit Yi+a = A*exp(-k*

[R] in which package is prp function?

2011-12-20 Thread agent dunham
Dear community, I would like to try prp function, I read here: http://www.milbo.org/rpart-plot/prp.pdf, but I cannot find in which package is included, can anybody help? Thanks in advance, u...@host.com -- View this message in context:

Re: [R] SQL select ... where R variable

2011-12-14 Thread agent dunham
Thank you, I guess it didn't work for me, maybe is not possible? I've tried: con- odbcDriverConnect(Driver=SQL Server; Server=...\\...;Database=...;Uid=...;Pwd=... ;) v1=sqlQuery(con, select v1 from sqltable where v3 =cte and v2 in (select v2 from R_dataframe) order by (select v2 from

[R] SQL select ... where R variable

2011-12-13 Thread agent dunham
Before loading sql packages, i was wondering, once all packages required are installed, if it's possible to do from R console sth like this: SQL select v1 from sql_table where v2 in (R_variable) # being R_variable a vector Thanks in advance, u...@host.com -- View this message in

Re: [R] Replace columns in a data.frame randomly splitted

2011-12-01 Thread agent dunham
The thing is that I've already been working with df1, and I was looking for a function that could replace values knowing rows and columns. Does it exist? Thank you, u...@host.com -- View this message in context:

[R] Replace columns in a data.frame randomly splitted

2011-11-30 Thread agent dunham
Dear community, I'm working with the data.frame attached ( http://r.789695.n4.nabble.com/file/n4122926/df1.xls df1.xls ), let's call it df1. I typed: df1- read.xls(C:/... dir .../df1.xls,colNames= TRUE, rowNames= TRUE) Then I splited randomly df1 using splitdf function

Re: [R] how to keep row name if there is only one row selected from a data frame

2011-11-29 Thread agent dunham
Dear Community: Thank you Michael, I did it as you said. However I still have a little problem with this staff. I try my lm's in my df1's variables. Let's say: lm1 - lm( df1$vi) ~ df1$v1 + df1$v2) Then I usally type: plot(lm1, 1:4) I'd like to see in the plots obtained the name of the

Re: [R] how to keep row name if there is only one row selected from a data frame

2011-11-23 Thread agent dunham
Dear Community, I'm having a similar problem. I'm working with the data.frame attached ( http://r.789695.n4.nabble.com/file/n4099139/df1.xls df1.xls ), let's call it df1 (and when I type str(df1) it answers data.frame) df1 has its own rownames (In the .xls the column id, not 1,2,3, ...), and

Re: [R] how to keep row name if there is only one row selected from a data frame

2011-11-23 Thread agent dunham
I've manged this way: df2 - df1[-match(784, row.names(df1)), ] Isn't there any other way?? How can I retrieve/delete three rows with the same command line?u...@host.com -- View this message in context:

[R] aq.plot outcome

2011-11-21 Thread agent dunham
Dear Community, I would like to know if the outliers from the outcome of aq.plot are the ones with probability associated with D2 is .001. Thanks in advance, u...@host.com -- View this message in context: http://r.789695.n4.nabble.com/aq-plot-outcome-tp4092210p4092210.html Sent from the R

[R] outlier identify in qqplot

2011-11-16 Thread agent dunham
Dear Community, I want to identify outliers in my data. I don't know how to use identify command in the plots obtained. I've gone through help files and use mahalanobis example for my purpose: NormalMultivarianteComparefunc - function(x) { Sx - cov(x) D2 - mahalanobis(x,

Re: [R] iplots problem

2011-11-08 Thread agent dunham
I also have the same problem. Can you send me the link to download a proper Sun Java application (I have Microsot Windows XP Profesional V.2002)? Anyway, this is what I tried: library(JGR) Loading required package: JavaGD Loading required package: iplots Error : .onLoad failed in

[R] lm weight adj r-sq

2011-05-05 Thread agent dunham
Dear all, First of all apologies, I'm pretty newbie, and secondly I know this is not a question for the forum but I'd be very grateful if you'd help me. I had problems with normality assumptions, and I tried with weights in the linear regression this way: modelw

[R] delete excel id automatically generated

2011-05-03 Thread agent dunham
Dear community, I uploaded an excel with read.xls. My xls file actually have a column which is an id, (plot is the id) : plot height area 347.6 5.4 853.2 4.1 895.4 8.4 121 6.76.2 ... 1325 2.11.5 However R uses another id, this way: r id plot height area

Re: [R] graphics: 3D regression plane

2011-04-27 Thread agent dunham
Dear community, Thanks for regr2.plot. I've another question. When fixing OLS I used training data and test data. I'd like to know if it's possible to draw the plane I've fixed with the training data, and draw the observed and predicted points achieved with the test data. If so any help or

Re: [R] graphics: 3D regression plane

2011-04-27 Thread agent dunham
Hi, thanks, I think I've changed the previous as you told me but I'm having this error, what does it mean? model- lm(log(v1)~log(v2)+v3, data=dat) newax- expand.grid( v2 = seq(min(log(dat$v2)), max(log(dat$v2)), length=100), v3= seq(min(dat$v3), max(dat$v3), length=100)) fit -

Re: [R] graphics: 3D regression plane

2011-04-26 Thread agent dunham
Dear community, As it's explained I've tried the following: model- lm(log(v1)~log(v2)+v3, data=dat) newax- expand.grid( v2 = seq(min(log(dat$v2)), max(log(dat$v2)), length=100), v3= seq(min(dat$v3), max(dat$v3), length=100) ) fit - predict(model,newax) graph -

[R] area under roc curve

2011-04-14 Thread agent dunham
Dear all, I want to measure the goodness of prediction of my linear model. That's why I was thinking about the area under roc curve. I'm trying the following, but I don't know how to avoid the error. Any help would be appreciated. library(ROCR) model.lm -

[R] plot.correlogram

2011-04-08 Thread agent dunham
Dear all, I've tried an lm model. I want to check indepence of the residuals, so I was trying the following: library(ape) plot.correlogram(residuals(model1)) I obtain this error: Error en x$p.values : $ operator is invalid for atomic vectors Any idea? Thanks in advance, u...@host.com

Re: [R] factor with numeric names

2011-03-25 Thread agent dunham
Dear all, According to the post I was trying: factorA = c(2,2,3,3,4,4,3,4,2,2) levels(factor - c(lv1,lv2,lv3) ) But this returns NULL and doesn't change factor names. Actually, my factor is included in a data.frame, so I also tried: levels(df$factorA)[levels(df$factorA)==2] - lv1 Also

Re: [R] factor with numeric names

2011-03-25 Thread agent dunham
Dear all, According to the post I was trying: factorA = c(2,2,3,3,4,4,3,4,2,2) levels(factorA - c(lv1,lv2,lv3) ) But this returns NULL and doesn't change factor names. Actually, my factor is included in a data.frame, so I also tried: levels(df$factorA)[levels(df$factorA)==2] - lv1 Also

[R] predict.lm How to introduce new data?

2011-03-23 Thread agent dunham
Dear all, I've fitted a lm using 61 data (training data), and I'left 10 as test data. Training data and test data are stored in an excell. training - read.xls(C:/./training.xls) , the same for test. That is: v1 v2 ... v15 When I type str(training) and str(test), both sets have the same

[R] what's interesting to plot after predict.lm?

2011-03-23 Thread agent dunham
Dear all, I've fitted this model with train data lms - lm(vd ~ log(v1) + fv2+ fv5+ fv7 ) and predicted over test data using plms - predict.lm(lmsub, new=test,interval=predict, level=0.95,se.fit=TRUE) I've two questions: q1: what's the difference between writing interval predict or

[R] lm ~ v1 + log(v1) + ... improve adj Rsq ¿any sense?

2011-03-22 Thread agent dunham
Dear all, I want to improve my adj - R sq. I 've chequed some established models and they introduce two times the same variable, one transformed, and the other not. It also improves my adj - R sq. But, isn't this bad for the collinearity? Do I interpret coefficients as usual?

Re: [R] cv.lm syntax error

2011-03-17 Thread agent dunham
I rewrite my previous comand, CVlm works now. It was related to having the same names in the df than in the formula included at CVlm . Now I'd like to know if the seed is of any special importance, or I can type just seed=29 like in the example. Thanks in advance, u...@host.com -- View this

Re: [R] cv.lm syntax error

2011-03-17 Thread agent dunham
I rewrite my previous comand, CVlm works now. It was related to having the same names in the df than in the formula included at CVlm . Now I'd like to know: Q1: if the seed is of any special importance, or I can type just seed=29 like in the example? Q2: I typed: CVlm(df = mydf, form.lm =

[R] cross validation? when rlm, lmrob or lmRob

2011-03-16 Thread agent dunham
Dear community, I have fitted a model using comands above, (rlm, lmrob or lmRob). I don't have new data to validate de models obtained. I was wondering if exists something similar to CVlm in robust regression. In case there isn't, any suggestion for validation would be appreciated. Thanks,

Re: [R] regsubsets() [leaps package] - please share some good examples of use

2011-03-15 Thread agent dunham
Does it mean that regsubsets doesn't work with categorical variables? It's because I'm trying the following and I don't know what happens. Any help would be appreciated. varin - data.frame(v1,v2,...,v7, factor1,..., factor4) Dependent variable: height Then: eu.subsets - regsubsets(varinc ,

Re: [R] Goodness of fit with robust regression

2011-03-14 Thread agent dunham
I also have the same problem, can anybody help? and I would also like to see the p-values associated with the t-value of the coefficients. At present I type summary (mod1.rlm) and neither of these things appear. Thanks, u...@host.com -- View this message in context:

Re: [R] cv.lm syntax error

2011-03-09 Thread agent dunham
Yea, sorry, that's what I mean, and v1,...,v5 and factor have the same length, that's why I don't understand the error dfmod.1 - data.frame(v1,v2,v3,v4, v5,factor) CVlm(df= dfmod.1, form.lm = formula(v1 ~ v2+v3+ v4+ v5+ factor), m=3, seed=29, plotit=TRUE, printit =TRUE) Error en

[R] lm - interaction factors - same number of items per level in factors?

2011-03-08 Thread agent dunham
Dear community, Apologies for my questions, I´m pretty newbie. The thing is, I was trying this lm: mod.lm - lm(df$res ~ df$var1+ df$var2 + df$var3 +fact1:fact2) And factors are like this: table(fact1) a b c 3 90 83 table(fact2) a b c 4 87 85 Because of the interaction, i

Re: [R] cv.lm syntax error

2011-03-08 Thread agent dunham
Thanks for your answer, but I type the following: dfmod.1 - data.frame(dat$v1,dat$v2,dat$v3,dat$v4, dat$v5,factor) CVlm(df= dfmod.1, form.lm = formula(dat$v1 ~ dat$v2+dat$v3+ dat$v4+ dat$v5+ factor), m=3, seed=29, plotit=TRUE, printit =TRUE) Error en `[.data.frame`(df, , ynam) : undefined

Re: [R] cv.lm syntax error

2011-03-08 Thread agent dunham
But I read in the forum that cv.lm is not for multiple regression, that's why i change it ti CVlm, however i fell to the same error u...@host.com -- View this message in context: http://r.789695.n4.nabble.com/cv-lm-syntax-error-tp3334889p3342333.html Sent from the R help mailing list

[R] cv.lm syntax error

2011-03-04 Thread agent dunham
Dear all, I've tried a multiple regression, and now I want to try a cross-validation. I obtain this error (it must be sth related to df) that I don't understand, any help would be appreciated. cv.lm(df= dat, lm2.52f, m=3) Error en `[.data.frame`(df, , ynam) : undefined columns selected

[R] Recodifying a factor due to results in lm

2011-03-03 Thread agent dunham
Dear community, I'm doing a lm. In the independent variables I've got a categorical one. Here is its histogram: http://r.789695.n4.nabble.com/file/n638/altitude.png I did this regression: lmeo2.52f - lm(dat82$IncAltuDom ~ dat82$hdom2+log(dat82$CV)+ dat82$CA+ dat82$FCC+

[R] how many records for suitable regression

2011-03-02 Thread agent dunham
Dear community, I was wondering if it's possible to know if you have enough data for a regression study. I remember you must have more data than parameters to obtain, but I'd like to know if there was something more sophisticated. Thanks, u...@host.com -- View this message in context:

[R] lm - log(variable) - skip log(0)

2011-02-25 Thread agent dunham
I want to do a lm regression, some of the variables are going to be affected with log, I would like not no take into account the values which imply doing log(0) for just one variable I have done the following but it doesn't work: lmod1.lm -

Re: [R] lm - log(variable) - skip log(0)

2011-02-25 Thread agent dunham
Apologies, I'm really new with R, Can you help me with the syntax? here is my data.frame in which I introduce independent variables: varind - data.frame(datpos$hdom2,datpos$NumPies,datpos$InHart,datpos$CV,datpos$CA,datpos$FCC) varind has dimensions(194, 6), in case that's necessary. Then I

Re: [R] lm - log(variable) - skip log(0)

2011-02-25 Thread agent dunham
Apologies, I'm really new with R, Can you help me with the syntax? here is my data.frame in which I introduce independent variables: varind - data.frame(datpos$hdom2,datpos$NumPies,datpos$InHart,datpos$CV,datpos$CA,datpos$FCC) varind has dimensions(194, 6), in case that's necessary. Then I

Re: [R] Returning NA from lm

2011-02-16 Thread agent dunham
Hi, thanks for your post, I tried what you said, and it runs, however when I type summary ... I obtain the following: What's happening? How can I solve it? lmod1.lm - tryCatch(lm(log(dat$inaltu)~log(dat$indiam),na.action=na.fail),error=function(err){NA}) summary(lmod1.lm,

Re: [R] How to ignore data

2011-02-16 Thread agent dunham
Hi, I have tried what you suggest here, and it seems not to work, can you help me? I want to do a lm regression, some of the variables are going to be affected with log, I would like not no take into account those rows which imply doing log(0) for just one variable I have done the following

[R] Error en lm.fit NA/NaN/Inf en llamada a una función externa

2011-02-14 Thread agent dunham
Hello, I am new with R, and I'm trying to fit a linear model, I did the following and obtein this result, can anybody help? Thanks, logdftodos7925vi - log(dftodos7925vi) logALTURA7925- log(dftodos7925$ALTURA7917) logtodos7925.lm - lm (logALTURA7925~., data= logdftodos7925vi) Error en

Re: [R] Calling R from .net environment

2011-02-09 Thread agent dunham
I'm going to work with R and .NET in a few weeks, I read that I need R version 11 to be able to call R from .NET, is it true, or is it possible with version 2.12.1? -- View this message in context: http://r.789695.n4.nabble.com/Calling-R-from-net-environment-tp880419p3297585.html Sent

[R] read.xls counts more rows than I really have in my Excel file

2011-02-08 Thread agent dunham
Hi, i'm using read.xls, and it counts more rows in my Excel than I really have. i've used both: especie26 - read.xls(especie26cargar.xls) datos26 - read.xls(especie26cargar.xls, header = TRUE, as.is = FALSE, na.strings = NA, skip = 0, check.names = TRUE, fill = FALSE,