Re: [R] Non linear regression - Von Bertalanffy Growth Function - singular gradient matrix at initial parameter estimates

2015-08-19 Thread ProfJCNash
Packages nlmrt or minpack.lm use a Marquardt method. minpack.lm won't 
proceed if the Jacobian singularity is at the starting point as far as 
I'm aware, but nlxb in nlmrt can sometimes get going. It has a policy 
that is aggressive in trying to improve the sum of squares, so will use 
more effort than nls when both work.


JN

On 15-08-18 12:08 PM, Xochitl CORMON wrote:

Dear all,

I am trying to estimate VBGF parameters K and Linf using non linear
regression and nls(). First I used a classic approach where I estimate
both parameters together as below with alkdyr being a subset per year
of my age-length-key database and running in a loop.

vbgf.par - nls(Lgtcm ~  Linf *(1 - exp(-K * (Age - tzero))), start =
c(K= 0.07, Linf = 177.1), data=alkdyr)

I obtain an estimation of both parameters that are strongly correlated.
Indeed after plotting Linf ~ K and fitting a linear regression I obtain
a function (Linf = a + b*K) with R2= 0.8 and a = 215, b = -763.

In this context, to take into account explicitly correlation between
parameters, I decided to fit a new non linear regression derivate from
VBGF but where Linf is expressed depending on K (I am most interested in
K). To do so, I tried this model:
vbgf.par - nls(Lgtcm ~  (a + (b*k)) *(1 - exp(-k * (Age - tzero))),
start = c(k= 0.07, a= 215, b=-763), data=alkdyr)

Unfortunately at this point I cannot go further as I get the error
message singular gradient matrix at initial parameter estimates.

I tried to use alg= plinear (which I am not sure I understand properly
yet). If I give a starting value for a and b only, I have an error
message stating step factor below minFactor (even when minFactor is
set to 1000).

Any help will be more than welcome as this is quite urgent

Best,

Xochitl C.






__
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.


Re: [R] Confussion matrix in tree clasiffication

2015-08-19 Thread David L Carlson
Use predict.tree() with type=class on the object returned by tree(). Then use 
that to construct a cross tabulation against the original data. If you provide 
a reproducible example with data, I could be more specific.

-
David L Carlson
Department of Anthropology
Texas AM University
College Station, TX 77840-4352

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of jpara3
Sent: Wednesday, August 19, 2015 4:09 AM
To: r-help@r-project.org
Subject: [R] Confussion matrix in tree clasiffication

Hi there!

I want to create a confussion matrix after using the tree package to create
a clasiffication tree, but I´m not sure of how to create this matrix.

Can anyone please help me?

Thanks
Jesús



-

Guided Tours Basque Country 

Guided tours in the three capitals of the Basque Country: Bilbao, 
Vitoria-Gasteiz and San Sebastian, as well as in their provinces. Available 
languages.

Travel planners for groups and design of tourist routes across the Basque 
Country.
--
View this message in context: 
http://r.789695.n4.nabble.com/Confussion-matrix-in-tree-clasiffication-tp4711269.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-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.

Re: [R] data format

2015-08-19 Thread Erich Neuwirth
This is the kind of problem the package tidyR has been designed for.

 On 19 Aug 2015, at 16:29, minikg min...@cmfri.org.in wrote:
 
 Hi,
 
 I have a dataset consisting of landmarks of each sample's  coordinates as
 given below.
 
 landmark  X   Y   X   Y   X   Y
 P1   534  7   26  7   32
 P2 46 45  48  42  44  48
 P3 73 45  72  44  71  46
 P4 92 43  90  43  89  42
 
 
 please help me to change my data format to
 
 samplep1x1p1y1p2x2p2y2p3x3p3y3p4x4p4y4
 1534  46  45  73  45  92  43
 2726  48  42  72  44  90  43
 3732  44  48  71  46  89  42
 
 Thanks
 
 
 
 
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/data-format-tp4711278.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.



signature.asc
Description: Message signed with OpenPGP using GPGMail
__
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.

Re: [R] Running R in Server

2015-08-19 Thread Swagato Chatterjee
Dear all,

Thenks for replying to my query.

*@Amaud: If I understand correctly what you want to do, you might be able
to create a HTML report using RMarkdown and host that on the website.  If
you really need a web app, I suggest looking into Shiny.  You can make a
shiny app, host it for free on the cloud.  You will have a lot to learn,
but it will be time well spent.  https://www.rstudio.com/
https://www.rstudio.com/*

Obviously I have shiny as an option.But I was thinking PHP based GUI is a
better fit for me as I have very limited resources in my team who can
create a Shiny app and implement it with the all the functionalities of a
PHP based GUI.

*Have a look at deployR on Revolutioanalytic website. There is a free
open-source solution for windows.*

I'll check this.

*@John: Statement: You have a Windows desktop and have used R on it, so you
are familiar with R in a Windows environment.​*
*Statement: You are not Linux (Ubuntu) trained.*
*Statement: You wrote an R script on Windows, which works, but you need to
run it on Ubuntu.*

*The above is my starting point. Now I have some questions.*

*Can you connect to the Ubuntu server from your Windows desktop? If so,
how? If not, I'm confused about how you could get anything to run on the
Ubuntu server.*

My developer has given me an username and password which I can use to
connect the server using Putty. The GUI is being developed in Ubuntu server
only using PHP and my the results of my RScript (figures and tables) will
be the input of the GUI. Having said that, I have limited knowledge how to
implement the R and run the script in server after loggin in to the server.

*Where does this dataset reside? On you desktop? On a Windows shared
folder? On the Ubuntu server? Other?*

Right now, on my desktop. But soon the dataset will be residing on a server.

*Who or what edits the dataset? That is, is it always yourself? Some one
in your group? Some other human? Some automated process?*

The input data of my Rscript again comes from another app and the database
is also residing on the same server. The update of the dataset is being
done by the app automatically.

*Why can't you run the R script as you do now, then deploy the results to
the Ubuntu server? Since I don't know the environment that the Ubuntu
server runs in, I can't address how to deploy an updated file into it. I
assume you have some sort of deployment software. It could be as easy as
being able to ftp the results from your desktop to the proper places on the
Ubuntu server.*

I cannot run the R script as I do now because the Rscript will also be
called for automatically so that the results of the Rscript go as an input
to the end app. PFA the architecture picture.

*@Loris: However, you'll probably have to make sure that all the packages
you*
*need are installed on the server.*

This is where I need a help.​

Thanks and Regards,

Swagato
__
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.

Re: [R] Error message from allEffects(model) / effect(model) ‘range’ not meaningful for factors

2015-08-19 Thread John Fox
Hi,

 m - lm(y~x) # no problem

 allEffects(m)# also no problem
 model: y ~ x

 x effect
x
   abc 
3.322448 3.830997 4.969154

 effect(x, m) # ditto

 x effect
x
   abc 
3.322448 3.830997 4.969154 

 Effect(x, m) # ditto

 x effect
x
   abc 
3.322448 3.830997 4.969154

Best,
 John

---
John Fox, Professor
McMaster University
Hamilton, Ontario, Canada
http://socserv.socsci.mcmaster.ca/jfox/




 -Original Message-
 From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Robert
 Zimbardo
 Sent: Tuesday, August 18, 2015 8:50 PM
 To: r-help@r-project.org
 Subject: [R] Error message from allEffects(model) / effect(model)
 ‘range’ not meaningful for factors
 
 Hi
 
 I cannot figure out why the effects package throws me error messages
 with the following simple code:
 
 
 rm(list=ls(all=TRUE)); set.seed(1); library(effects)
 # set up data
 x - factor(rep(letters[1:3], each=100))
 y - c(rnorm(100, 3, 3), rnorm(100, 4, 3), rnorm(100, 5, 3))
 
 
 # fit linear model
 m - summary(lm(y~x)) # no problem
 
 # now the problem
 plot(allEffects(m))
 # Error in Summary.factor(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
 :
 #   ‘range’ not meaningful for factors
 plot(effect(x, m))
 # Error in Summary.factor(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
 :
 #   ‘range’ not meaningful for factors
 
 
 Any ideas? It's go to be something superobvious, but I don't get it.
 Thanks,
 RZ
 
 __
 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-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.

Re: [R] Output In R

2015-08-19 Thread jim holtman
At least provide a sample of the data and then the desired output.  All we
get from your email is that it does not show the desired result and we
are at a lost to understand what that is.  I know it was suggested that you
write it out as a CSV file and then you can use EXCEL to page through the
data.


Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

On Wed, Aug 19, 2015 at 1:20 AM, Shivi82 shivibha...@ymail.com wrote:

 Hi Loris,

 I have already tried options(max.print=99) but does not show the
 desired
 result.
 As posted above it want to share the outcome with the business owner where
 there could be multiple entries.





 --
 View this message in context:
 http://r.789695.n4.nabble.com/Output-In-R-tp4711227p4711264.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.


[[alternative HTML version deleted]]

__
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.


Re: [R] Rodbc retrieve data

2015-08-19 Thread Mark Sharp
Diaz,

paste() and paste0() will work here. paste0() defaults to  between character 
vector elements and paste() defaults to   (single blank character) between 
character vector elements. See ?paste.

I do not recall, but you may have to escape the  symbol, but that is another 
topic.

Try this.

title (main = paste0(Mapa de los dblinks del entorno: , dbName),sub=Luis 
Diaz -
Emergencies  improvments)

Mark
P.S. Spelling correction - improvements

R. Mark Sharp, Ph.D.
Director of Primate Records Database
Southwest National Primate Research Center
Texas Biomedical Research Institute
P.O. Box 760549
San Antonio, TX 78245-0549
Telephone: (210)258-9476
e-mail: msh...@txbiomed.org







 On Aug 19, 2015, at 7:11 AM, Diaz Garcia, Luis Carlos luis.d...@tecnocom.es 
 wrote:
 
 Hi every one
 first I would like to introduce myself, as I'm new here.
 I'm Luis from Barcelona, I'm Oracle dba and I need to create some nice
 graphs.
 So, I was looking for a solution and I saw R...
 
 I think it's a good tool to make the task I need.
 
 So here is the task: I need to get all the dblink from one database and draw
 the result of the query.
 The dblink will have the origin database name, the destination, the name of
 the link the type too.
 So I look into the R doc and I saw the way to get the data from my database:
 
 library(RODBC)
 con - odbcConnect(DPL03, uid=myuser, pwd=mypass,believeNRows=FALSE )
 dbName - sqlQuery(con, SELECT instance_name from v$instance,errors=FALSE)
 
 Now I have dbName with one value, the name of my instance, but I don't know
 how to insert this data into this:
 
 plot.new()
 title (main =Map of the dbLinks of the database,sub=Luis Diaz -
 Emergencies  improvments)
 
 
 As you see, I create a screen to plot where I'll draw shapes and lines but
 the first issue is to insert here the name of my instance, but I can't.
 I try to concatenate like this:
 
 title (main =Mapa de los dblinks del entorno:  + dbName ,sub=Luis Diaz -
 Emergencies  improvments)
 
 
 But I have an error, and if I use print(dbName) the value is printed but
 outside of the plot.new() screen.
 Some one can help ?
 Thanks in advance !
 
 Cheers
 
 __
 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-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.


Re: [R] match.arg: how to prevent users from not specifying a value

2015-08-19 Thread William Dunlap
If you want to force the user to enter the 'type' argument,
move the vector of choices out of the argument list
and into the call to match.arg():

   f1 - function(type, ...) {
   match.arg(type, c(A, B, C))
   }
   f1()
   #Error in match.arg(type, c(A, B, C)) :
   #  argument type is missing, with no default
   f1(X)
   #Error in match.arg(type, c(A, B, C)) :
   #  'arg' should be one of “A”, “B”, “C”
   f1(B)
   #[1] B


Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Tue, Aug 18, 2015 at 5:42 PM, Youyi Fong yf...@fhcrc.org wrote:

 Hello, I have a function that looks like

 f=function( type=c(dummy,A,B,C), ... ) {
 type-match.arg(type)
 if (type==dummy) stop(Please choose a type that is not dummy.)
 ...
 }

 I put a dummy in the list of choices as a mechanism to prevent users
 from not specifying a value for type when calling the function. My
 question is whether there is a better way to achieve it that does not
 need dummy.

 Thanks,
 Youyi

 __
 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.


[[alternative HTML version deleted]]

__
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] match.arg: how to prevent users from not specifying a value

2015-08-19 Thread Youyi Fong
Hello, I have a function that looks like

f=function( type=c(dummy,A,B,C), ... ) {
type-match.arg(type)
if (type==dummy) stop(Please choose a type that is not dummy.)
...
}

I put a dummy in the list of choices as a mechanism to prevent users
from not specifying a value for type when calling the function. My
question is whether there is a better way to achieve it that does not
need dummy.

Thanks,
Youyi

__
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] equivalent of repeated measures anova using lmer

2015-08-19 Thread asudar
I am trying to run a linear mixed effects model similar to the 2*2*2 anova
design. My DV is reaction time and fixed factors are time (pre vs.
post:within-subject), condition (congruent vs. incongruent: within subject)
and stimulation (vertex vs. DLPFC: between subject)
My concerns are:
a)I have very few participants: 7 in the vertex condition and 7 in the
DLPFC condition.
b)2 out of the 7 participants participated in both vertex and DLPFC
condition.
 How do I compute a nested lmer model with reaction time as DV and time,
condition and stimulation as factors? and how do i account for random
intercepts and slopes with few number of participants?
Thanks for all the help




--
View this message in context: 
http://r.789695.n4.nabble.com/equivalent-of-repeated-measures-anova-using-lmer-tp4711265.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]

__
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.


Re: [R] Output In R

2015-08-19 Thread Shivi82
HI Boris,

The reason i want to see or show 3 million rows in console is that i need to
present it to a business user. 

So here my end objective is to present the final output to the business
user. So lets say when i write a code:
select(june,waybill:type,contains(sfxcode)) so here there could be
multiple instances where sfx code could appear which will not accommodate in
console. I tried using max print option and increased to (max.print=99)
but still only shows few rows of data. 

What other option to i have. Thanks. 



--
View this message in context: 
http://r.789695.n4.nabble.com/Output-In-R-tp4711227p4711263.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] Plot z=f(x,y) analytically

2015-08-19 Thread chappo007
Hi,

I've been led to believe that in R  it is possible to produce a 3d
analytical plot of a function.  I've been pointed in the direction of
plot3d(), so the command is something like
plot3d(x^2+y^2,(x,-3,3),(y,-3,3)).  And a smart person out there is going to
tell me where this syntax comes from (or belongs to), there is also a R
package called MapleSoft ( I believe) which is commercial, and there is
always Mathematica.  So is there a R function to plot z=f(x,y) without
obtain or generating data.

Cheers,
Mike



--
View this message in context: 
http://r.789695.n4.nabble.com/Plot-z-f-x-y-analytically-tp4711272.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] repeated measures anova equivalent using lmer

2015-08-19 Thread aruna sudarshan
I am trying to run a linear mixed effects model similar to the 2*2*2 anova
design. My DV is reaction time and fixed factors are time (pre vs.
post:within-subject), condition (congruent vs. incongruent: within subject)
and stimulation (vertex vs. DLPFC: between subject)
My concerns are:
a)I have very few participants: 7 in the vertex condition and 7 in the
DLPFC condition.
b)2 out of the 7 participants participated in both vertex and DLPFC
condition.
 How do I compute a nested lmer model with reaction time as DV and time,
condition and stimulation as factors? and how do i account for random
intercepts and slopes with few number of participants?
Thanks for all the help

[[alternative HTML version deleted]]

__
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] data format

2015-08-19 Thread minikg
Hi,

I have a dataset consisting of landmarks of each sample's  coordinates as
given below. 

landmarkX   Y   X   Y   X   Y
P1 534  7   26  7   32
P2   46 45  48  42  44  48
P3   73 45  72  44  71  46
P4   92 43  90  43  89  42


please help me to change my data format to

sample  p1x1p1y1p2x2p2y2p3x3p3y3p4x4p4y4
1  534  46  45  73  45  92  43
2  726  48  42  72  44  90  43
3  732  44  48  71  46  89  42

Thanks 




--
View this message in context: 
http://r.789695.n4.nabble.com/data-format-tp4711278.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] Error message from allEffects(model) / effect(model) ‘range’ not meaningful for factors

2015-08-19 Thread Robert Zimbardo
Hi

I cannot figure out why the effects package throws me error messages
with the following simple code:


rm(list=ls(all=TRUE)); set.seed(1); library(effects)
# set up data
x - factor(rep(letters[1:3], each=100))
y - c(rnorm(100, 3, 3), rnorm(100, 4, 3), rnorm(100, 5, 3))


# fit linear model
m - summary(lm(y~x)) # no problem

# now the problem
plot(allEffects(m))
# Error in Summary.factor(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,  :
#   ‘range’ not meaningful for factors
plot(effect(x, m))
# Error in Summary.factor(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,  :
#   ‘range’ not meaningful for factors


Any ideas? It's go to be something superobvious, but I don't get it. Thanks,
RZ

__
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.

Re: [R] Output In R

2015-08-19 Thread Shivi82
Hi Loris,

I have already tried options(max.print=99) but does not show the desired
result. 
As posted above it want to share the outcome with the business owner where
there could be multiple entries. 





--
View this message in context: 
http://r.789695.n4.nabble.com/Output-In-R-tp4711227p4711264.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] Rodbc retrieve data

2015-08-19 Thread Diaz Garcia, Luis Carlos
Hi every one
first I would like to introduce myself, as I'm new here.
I'm Luis from Barcelona, I'm Oracle dba and I need to create some nice
graphs.
So, I was looking for a solution and I saw R...

I think it's a good tool to make the task I need.

So here is the task: I need to get all the dblink from one database and draw
the result of the query.
The dblink will have the origin database name, the destination, the name of
the link the type too.
So I look into the R doc and I saw the way to get the data from my database:

library(RODBC)
con - odbcConnect(DPL03, uid=myuser, pwd=mypass,believeNRows=FALSE )
dbName - sqlQuery(con, SELECT instance_name from v$instance,errors=FALSE)

Now I have dbName with one value, the name of my instance, but I don't know
how to insert this data into this:

plot.new()
title (main =Map of the dbLinks of the database,sub=Luis Diaz -
Emergencies  improvments)


As you see, I create a screen to plot where I'll draw shapes and lines but
the first issue is to insert here the name of my instance, but I can't.
I try to concatenate like this:

title (main =Mapa de los dblinks del entorno:  + dbName ,sub=Luis Diaz -
Emergencies  improvments)


But I have an error, and if I use print(dbName) the value is printed but
outside of the plot.new() screen.
Some one can help ?
Thanks in advance !

Cheers

__
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.


Re: [R] Error message from allEffects(model) / effect(model) ‘range’ not meaningful for factors

2015-08-19 Thread Michael Dewey

You rm is of class summary.lm
Is that what allEffects is expecting?

On 19/08/2015 01:49, Robert Zimbardo wrote:

Hi

I cannot figure out why the effects package throws me error messages
with the following simple code:


rm(list=ls(all=TRUE)); set.seed(1); library(effects)
# set up data
x - factor(rep(letters[1:3], each=100))
y - c(rnorm(100, 3, 3), rnorm(100, 4, 3), rnorm(100, 5, 3))


# fit linear model
m - summary(lm(y~x)) # no problem

# now the problem
plot(allEffects(m))
# Error in Summary.factor(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,  :
#   ‘range’ not meaningful for factors
plot(effect(x, m))
# Error in Summary.factor(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,  :
#   ‘range’ not meaningful for factors


Any ideas? It's go to be something superobvious, but I don't get it. Thanks,
RZ

__
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.



--
Michael
http://www.dewey.myzen.co.uk/home.html

__
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] html posts tags remove home page

2015-08-19 Thread Valentin Cojocaru
In html,
How to remove posts from one category displaying on the home page by using tags.
Thanks,Valentin   
[[alternative HTML version deleted]]

__
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.


Re: [R] html posts tags remove home page

2015-08-19 Thread Jeff Newmiller
This is a mailing list on the topic of R. Your email does not appear to be 
related to that topic, so either look for a different mailing list/web forum 
where your question would be on topic, or provide a concrete example of your 
problem. If you do post here again, please use plain text format since the HTML 
formatting produced by default from your email program corrupts most examples.
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On August 19, 2015 12:23:42 AM PDT, Valentin Cojocaru 
valentin.cojoc...@hotmail.com wrote:
In html,
How to remove posts from one category displaying on the home page by
using tags.
Thanks,Valentin  
   [[alternative HTML version deleted]]

__
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-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] glm help

2015-08-19 Thread Joaquín Aldabe
Dear All, I´m running a glm with poisson errors and have a doubt when
ploting the predicted values. One of my variables has a positive slope in
the summary output, but when I plot the predicted values on the original
plot it draws a line with negative slope. I appreciate your comments on
this and any other aspect of the analysis.

Attached is the script and data in different formats just in case.

Thanks in advanced,

Joaquín.


-- 
*Joaquín Aldabe*

*Grupo Biodiversidad, Ambiente y Sociedad*
Centro Universitario de la Región Este, Universidad de la República
Ruta 15 (y Ruta 9), Km 28.500, Departamento de Rocha

*Departamento de Conservación*
Aves Uruguay
BirdLife International
Canelones 1164, Montevideo

https://sites.google.com/site/joaquin.aldabe
https://sites.google.com/site/perfilprofesionaljoaquinaldabe
my4-read.table(file.choose(), header=T, dec=,)
my4s-as.data.frame(scale(my4[,c(6,10,12,13,16)], center=T, scale=T))
my4S-cbind(BBSA=my4$BBSA, 
Field_name=my4$Field_name,Grassland_type=my4$Grassland_type, Flood=my4$Flood, 
Year=my4$Year,my4s)

m2.glm=glm(BBSA~AMGP+Distance_to_lagoon+Grass_height, family=quasipoisson, 
data=my4S
summary(m2.glm)
#residuales
par(mfrow=c(2,2))
plot(m2.glm)#pretty good

#predict
amgp=seq(-0.51, 5.44, length.out=100)
grass=seq(-0.85,2.83, length.out=100)
dist=seq(-1.59,1.53, length.out=100)
newdata=data.frame(AMGP=amgp, Distance_to_lagoon=dist,Grass_height=grass)
pred.m2.glm=exp(predict(m2.glm,newdata))
plot(BBSA~Grass_height, data=my4S)
lines(newdata$Grass_height,pred.m2.glm)
plot(BBSA~AMGP, data=my4S)
lines(newdata$AMGP,pred.m2.glm)#why negative slope if summary output is positive
plot(BBSA~Distance_to_lagoon, data=my4S)
lines(newdata$Distance_to_lagoon, pred.m2.glm)__
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.

Re: [R] data format

2015-08-19 Thread David L Carlson
This looks like data for a morphometrics analysis so you should know about 
package geomorph. Data like yours is often stored as a three dimensional array 
so we switch to that format and then use the two.d.array() function in package 
geomorph:

Assuming your dataset is called dat: 

 arr - array(as.matrix(dat[, -1]), dim=c(4, 2, 3))
 library(geomorph)
 mat - two.d.array(arr)
 colnames(mat) - paste0(p, rep(1:4, each=2), 
+  rep(c(x, y), 4), rep(1:4, each=2))
 mat
 p1x1 p1y1 p2x2 p2y2 p3x3 p3y3 p4x4 p4y4
[1,]5   34   46   45   73   45   92   43
[2,]7   26   48   42   72   44   90   43
[3,]7   32   44   48   71   46   89   42
 dat2 - data.frame(sample=1:3, mat)
 dat2
  sample p1x1 p1y1 p2x2 p2y2 p3x3 p3y3 p4x4 p4y4
1  15   34   46   45   73   45   92   43
2  27   26   48   42   72   44   90   43
3  37   32   44   48   71   46   89   42


-
David L Carlson
Department of Anthropology
Texas AM University
College Station, TX 77840-4352



-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of minikg
Sent: Wednesday, August 19, 2015 9:29 AM
To: r-help@r-project.org
Subject: [R] data format

Hi,

I have a dataset consisting of landmarks of each sample's  coordinates as
given below. 

landmarkX   Y   X   Y   X   Y
P1 534  7   26  7   32
P2   46 45  48  42  44  48
P3   73 45  72  44  71  46
P4   92 43  90  43  89  42


please help me to change my data format to

sample  p1x1p1y1p2x2p2y2p3x3p3y3p4x4p4y4
1  534  46  45  73  45  92  43
2  726  48  42  72  44  90  43
3  732  44  48  71  46  89  42

Thanks 




--
View this message in context: 
http://r.789695.n4.nabble.com/data-format-tp4711278.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-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.


Re: [R] Plot z=f(x,y) analytically

2015-08-19 Thread David L Carlson
You probably want function persp3d() in package rgl. You have to define the 
formula as a function and specify the limits correctly, but you were close:

 library(rgl)
 persp3d(function(x, y) x^2+y^2, xlim=c(-3, 3), ylim=c(-3, 3))

-
David L Carlson
Department of Anthropology
Texas AM University
College Station, TX 77840-4352


-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of chappo007
Sent: Wednesday, August 19, 2015 6:48 AM
To: r-help@r-project.org
Subject: [R] Plot z=f(x,y) analytically

Hi,

I've been led to believe that in R  it is possible to produce a 3d
analytical plot of a function.  I've been pointed in the direction of
plot3d(), so the command is something like
plot3d(x^2+y^2,(x,-3,3),(y,-3,3)).  And a smart person out there is going to
tell me where this syntax comes from (or belongs to), there is also a R
package called MapleSoft ( I believe) which is commercial, and there is
always Mathematica.  So is there a R function to plot z=f(x,y) without
obtain or generating data.

Cheers,
Mike



--
View this message in context: 
http://r.789695.n4.nabble.com/Plot-z-f-x-y-analytically-tp4711272.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-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.


Re: [R] Plot z=f(x,y) analytically

2015-08-19 Thread Greg Snow
R has several options for projecting a 3 dimensional plot onto a 2
dimensional plane and plotting the result.  Which is best depends on
what you want.

You mention a function plot3d but not which package it comes from.
You are more likely to receive prompt and useful help when you do your
part of the homework and tell us which package it is from (it is not
in the default packages).  In fact, with a name like that, there could
easily be more than one package with a function of that name and if we
tell you how to use the function from a different package than you are
using then the help will probably be more confusing than helpful.

In base R you can use functions like persp, image, and contour (after
using a function like outer), the help pages have examples.

If you load the lattice package then you can use wireframe, levelplot,
or contourplot, again the help pages have examples.

The TeachingDemos package has functions rotate.persp and
rotate.wireframe that create an interactive interface to the
corresponding plots.

The help page for the plot3d function in the RGL package (one likely
candidate for the function you mentioned) points to the
plot3d.function function in the See Also section which has examples
that you could plug your function into.

On Wed, Aug 19, 2015 at 5:47 AM, chappo007 consult...@logiccorp.com wrote:
 Hi,

 I've been led to believe that in R  it is possible to produce a 3d
 analytical plot of a function.  I've been pointed in the direction of
 plot3d(), so the command is something like
 plot3d(x^2+y^2,(x,-3,3),(y,-3,3)).  And a smart person out there is going to
 tell me where this syntax comes from (or belongs to), there is also a R
 package called MapleSoft ( I believe) which is commercial, and there is
 always Mathematica.  So is there a R function to plot z=f(x,y) without
 obtain or generating data.

 Cheers,
 Mike



 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Plot-z-f-x-y-analytically-tp4711272.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.



-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.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.


Re: [R] match.arg: how to prevent users from not specifying a value

2015-08-19 Thread Bert Gunter
... and you could also use missing() (?missing for details) if you
wanted to give the user more verbose instructions, e.g.

   f1 - function(type, ...) {
   if(missing(type)){
   cat(You must enter a 'type' argument that is one of etc\n)
   return(invisible())
   }
   match.arg(type, c(A, B, C))
   }
Bert Gunter

Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom.
   -- Clifford Stoll


On Wed, Aug 19, 2015 at 9:19 AM, William Dunlap wdun...@tibco.com wrote:
 If you want to force the user to enter the 'type' argument,
 move the vector of choices out of the argument list
 and into the call to match.arg():

f1 - function(type, ...) {
match.arg(type, c(A, B, C))
}
f1()
#Error in match.arg(type, c(A, B, C)) :
#  argument type is missing, with no default
f1(X)
#Error in match.arg(type, c(A, B, C)) :
#  'arg' should be one of “A”, “B”, “C”
f1(B)
#[1] B


 Bill Dunlap
 TIBCO Software
 wdunlap tibco.com

 On Tue, Aug 18, 2015 at 5:42 PM, Youyi Fong yf...@fhcrc.org wrote:

 Hello, I have a function that looks like

 f=function( type=c(dummy,A,B,C), ... ) {
 type-match.arg(type)
 if (type==dummy) stop(Please choose a type that is not dummy.)
 ...
 }

 I put a dummy in the list of choices as a mechanism to prevent users
 from not specifying a value for type when calling the function. My
 question is whether there is a better way to achieve it that does not
 need dummy.

 Thanks,
 Youyi

 __
 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.


 [[alternative HTML version deleted]]

 __
 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-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.

Re: [R] match.arg: how to prevent users from not specifying a value

2015-08-19 Thread Youyi Fong
Great. missing is what I was looking for, and it seems to also work
with interfaces like

f=function( type=c(A,B,C), ... ) {
}

Thanks!
Youyi



On Wed, Aug 19, 2015 at 9:35 AM, Bert Gunter bgunter.4...@gmail.com wrote:
 ... and you could also use missing() (?missing for details) if you
 wanted to give the user more verbose instructions, e.g.

f1 - function(type, ...) {
if(missing(type)){
cat(You must enter a 'type' argument that is one of etc\n)
return(invisible())
}
match.arg(type, c(A, B, C))
}
 Bert Gunter

 Data is not information. Information is not knowledge. And knowledge
 is certainly not wisdom.
-- Clifford Stoll


 On Wed, Aug 19, 2015 at 9:19 AM, William Dunlap wdun...@tibco.com wrote:
 If you want to force the user to enter the 'type' argument,
 move the vector of choices out of the argument list
 and into the call to match.arg():

f1 - function(type, ...) {
match.arg(type, c(A, B, C))
}
f1()
#Error in match.arg(type, c(A, B, C)) :
#  argument type is missing, with no default
f1(X)
#Error in match.arg(type, c(A, B, C)) :
#  'arg' should be one of “A”, “B”, “C”
f1(B)
#[1] B


 Bill Dunlap
 TIBCO Software
 wdunlap tibco.com

 On Tue, Aug 18, 2015 at 5:42 PM, Youyi Fong yf...@fhcrc.org wrote:

 Hello, I have a function that looks like

 f=function( type=c(dummy,A,B,C), ... ) {
 type-match.arg(type)
 if (type==dummy) stop(Please choose a type that is not dummy.)
 ...
 }

 I put a dummy in the list of choices as a mechanism to prevent users
 from not specifying a value for type when calling the function. My
 question is whether there is a better way to achieve it that does not
 need dummy.

 Thanks,
 Youyi

 __
 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.


 [[alternative HTML version deleted]]

 __
 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-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.

Re: [R-es] pregunta XLConnect

2015-08-19 Thread miguel.angel.rodriguez.muinos
Hola José.

Lo importante, para empezar es que la versión de R y la de Java sean iguales 
(de 32 o de 64 bits).
Parece que tengas el Sistema Operativo y R en 64 bits y Java en 32bits.

Es la primera comprobación que haría.

Un Saludo,
Miguel.




De: R-help-es [r-help-es-boun...@r-project.org] en nombre de Dr. José A. 
Betancourt Bethencourt [josebetancourt@infomed.sld.cu]
Enviado: miércoles, 19 de agosto de 2015 14:27
Para: r-help-es@r-project.org
Asunto: [R-es] pregunta  XLConnect

Estimados

El correo m�o   jbetanco...@iscmc.cmw.sld.cu
mailto:jbetanco...@iscmc.cmw.sld.cu   que est� en la lista de r est�
inhabilitado hasta el d�a primero, apreciar�a que me respondieran por este
si es posible





Estimados

Al tratar de instalar el paquete XLConnect me informa lo que esta abajo

�C�mo se puede superar esta deficiencia?



library(XLConnect)

Loading required package: XLConnectJars

Error : .onLoad failed in loadNamespace() for 'rJava', details:

  call: fun(libname, pkgname)

  error: JAVA_HOME cannot be determined from the Registry

Error: package �XLConnectJars� could not be loaded







sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8 x64 (build 9200)

locale:
[1] LC_COLLATE=Spanish_Spain.1252  LC_CTYPE=Spanish_Spain.1252
[3] LC_MONETARY=Spanish_Spain.1252 LC_NUMERIC=C
[5] LC_TIME=Spanish_Spain.1252

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

loaded via a namespace (and not attached):
[1] tools_3.2.1





Saludos cordials

Jos�



--
Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/




[[alternative HTML version deleted]]




Nota: A información contida nesta mensaxe e os seus posibles documentos 
adxuntos é privada e confidencial e está dirixida únicamente ó seu 
destinatario/a. Se vostede non é o/a destinatario/a orixinal desta mensaxe, por 
favor elimínea. A distribución ou copia desta mensaxe non está autorizada.

Nota: La información contenida en este mensaje y sus posibles documentos 
adjuntos es privada y confidencial y está dirigida únicamente a su 
destinatario/a. Si usted no es el/la destinatario/a original de este mensaje, 
por favor elimínelo. La distribución o copia de este mensaje no está autorizada.

See more languages: http://www.sergas.es/aviso-confidencialidad
___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] Bayesian data analysis recommendations

2015-08-19 Thread David Winsemius
If you need the link to the latest email address of a package maintainer just 
use the maintainer function:

?maintainer


 On Aug 15, 2015, at 10:59 AM, Jeff Slagle jeffrey.sla...@gmail.com wrote:
 
 I have a question about AtelieR out on stackoverflow.com.  Perhaps you could 
 forward the link to:
 
 Yvonnick Noel
 University of Brittany
 Department of Psychology
 Rennes, France
 
 Here is the link:
 
 AtelieR GTK GUI
 http://stackoverflow.com/q/32023277/5229811?sem=2
 
 Thank you,
 Jeff
   [[alternative HTML version deleted]]
 
 __
 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-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] Confussion matrix in tree clasiffication

2015-08-19 Thread jpara3
Hi there!

I want to create a confussion matrix after using the tree package to create
a clasiffication tree, but I´m not sure of how to create this matrix.

Can anyone please help me?

Thanks
Jesús



-

Guided Tours Basque Country 

Guided tours in the three capitals of the Basque Country: Bilbao, 
Vitoria-Gasteiz and San Sebastian, as well as in their provinces. Available 
languages.

Travel planners for groups and design of tourist routes across the Basque 
Country.
--
View this message in context: 
http://r.789695.n4.nabble.com/Confussion-matrix-in-tree-clasiffication-tp4711269.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] Response Variable Coding

2015-08-19 Thread Abraham Mathew
Very simple question that I want confirm.

Let's say that I have a response variable. What are the appropriate ways
that it can be coded for a logistic regression model?

1. It can be 0/1 and a factor
2. It can be 1/2 and a factor
3. It can be characters and a factor, where the second letter takes on the
1. (bad/good becomes 0/1).
4. ?
5. ?


My question isare 1, 2, and 3 all correct, and are there other coding
schemes that glm can take.



Thanks!

[[alternative HTML version deleted]]

__
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.


Re: [R] [FORGED] Response Variable Coding

2015-08-19 Thread Rolf Turner

On 20/08/15 09:43, Abraham Mathew wrote:

Very simple question that I want confirm.

Let's say that I have a response variable. What are the appropriate ways
that it can be coded for a logistic regression model?

1. It can be 0/1 and a factor
2. It can be 1/2 and a factor
3. It can be characters and a factor, where the second letter takes on the
1. (bad/good becomes 0/1).
4. ?
5. ?


My question isare 1, 2, and 3 all correct, and are there other coding
schemes that glm can take.


When in doubt, RTFM! :-)

From ?binomial:


For the binomial and quasibinomial families the response can be
specified in one of three ways:

As a factor: ‘success’ is interpreted as the factor not having the first
level (and hence usually of having the second level).

As a numerical vector with values between 0 and 1, interpreted as the
proportion of successful cases (with the total number of cases given by
the weights).

As a two-column integer matrix: the first column gives the number of
successes and the second the number of failures.


That pretty well says it all.  One thing to note:  If the response is a 
*numeric* vector of 0's and 1's it will produce the same result as it 
would if it were converted to a factor.  (This is because the default 
weights are all 1.)


HTH

cheers,

Rolf Turner


--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

__
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.