Re: [R] Fixed effects regression and robust regression

2015-05-20 Thread S Ellison
> since the OLS and robust regressions have the same number of DFs, looking
>  at the residual standard error is insightful.  

Sadly not. The residual scale in a robust model is only partly indicative of 
goodness of fit; robust models intentionally downweight outliers. Much of the 
difference in scale can be due to downweighting, rather than change in model, 
especially where outliers are roughly symmetricaly distributed. And the degrees 
of freedom are not, strictly, the same. You have the same numbers of 
observations, but once you throw in different weights, it's debatable whether 
the effective df are really equal to the classical df. In any case degrees of 
freedom mostly matters as a distribution parameter - if you could trust the 
distribution to be normal, chi-squared etc you would not need robust statistics.

What you can do, to an extent, is use something like lmRob in the robustbase 
package to test your fixed effects; comparing the different inferences will 
tell you something about which effects in OLS are simply artefacts caused by 
outliers. lmRob uses comparatively recent developments in wald-type inference 
tests to put the tests on a firmer footing.

S Ellison

***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
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] deSolve ODE Output Question

2015-05-20 Thread walke554
Hello,

I am working on a simple ODE problem with the deSolve package, and I was
hoping that someone could answer a question about how the deSolve package
does integration.  

Here is my program:

#The function
STDMod<-function(t,y,p){
IH = y[1];
IL = y[2];
with(as.list(p), {
dIH.dt = Beta[1,1]*(nH-IH)*IH + Beta[1,2]*(nH-IH)*IL - gamma*IH;
dIL.dt = Beta[2,1]*(nL-IL)*IH + Beta[2,2]*(nL-IL)*IL - gamma*IL;
return(list(c(dIH.dt,dIL.dt)));
})
}

#giving the parameters

Beta = matrix(data=c(10, 0.1, 0.1, 1.0), ncol=2, nrow=2)
nH = 0.2
nL = 0.8
IH0 = 1e-5
IL0 = 0

gamma = 1

p = list(Beta=Beta, gamma=gamma, nH=nH, nL=nL)

y0 = c(IH0, IL0)

#Running the ode integrator

steps= 10;
t = seq(from=0, to=30, by=.01);
out = ode(y=y0, times=t, func=STDMod, parms=p);

My understanding is that the 'out' matrix would be the values of the STDmod
function at each time step, given the initial values of the state parameters
IH and IL.  However, for the very first time step, I am getting a value
different than what the derivative and the initial values add up to.

My output:
 

but 'IH0' + 'the value of dIH.dt = Beta[1,1]*(nH-IH)*IH +
Beta[1,2]*(nH-IH)*IL - gamma*IH for timestep one' = 1.999e-5.  Is there
something that I am missing?  I am hoping to use this for more complicated
derivatives, but I want to make sure I am using the package correctly first.

Thanks!



--
View this message in context: 
http://r.789695.n4.nabble.com/deSolve-ODE-Output-Question-tp4707448.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 after performing anosim function with vegan

2015-05-20 Thread Brenzo
Hello,

so I'm relatively new in R, but normally i don't have big problems by using
R. 

But today i struggle a lot with an error message that occurred the first
time.

Error in sort.int(x, na.last = na.last, decreasing = decreasing, ...) : 
  'x' must be atomic

I'm using just a normal anosim function and 2 weeks ago it was working fine
with the same files and the same script. So maybe some of you can help me.

Here is the total script:

> data <-read.csv("H:\\PhD\\Ergebnisse Versuch Norwegen\\T-RFLP\\nirK
> Adonis2.csv")
> fix (data)
> data1 <- (data [,-1])
> fix (data1)
> cca.env<- read.csv ("H:\\PhD\\Ergebnisse Versuch
> Norwegen\\T-RFLP\\env2.csv",
+ header= TRUE, )
> fix(cca.env)
> du<- vegdist(data)
> fix(du)
> attach(cca.env)
> dune.ano <- anosim(du, Sample)
> summary(dune.ano)

Call:
anosim(dat = du, grouping = Sample) 
Dissimilarity: bray 

ANOSIM statistic R:  
  Significance: 0.001 

Permutation: free
Number of permutations: 999

Error in sort.int(x, na.last = na.last, decreasing = decreasing, ...) : 
  'x' must be atomic

it is more or less exactly the same matrix than in the example from R:

> data(dune)
> fix(dune)
> data(dune.env)
> fix(dune.env)
> dune.dist <- vegdist(dune)
> attach(dune.env)
> dune.ano <- anosim(dune.dist, Management)
> summary(dune.ano)

Call:
anosim(dat = dune.dist, grouping = Management) 
Dissimilarity: bray 

ANOSIM statistic R: 0.2579 
  Significance: 0.008 

Permutation: free
Number of permutations: 999

Upper quantiles of permutations (null model):
  90%   95% 97.5%   99% 
0.115 0.151 0.192 0.250 

Dissimilarity ranks between and within classes:
0%   25%50% 75%  100%   N
Between  4 58.50 104.00 145.500 188.0 147
BF   5 15.25  25.50  41.250  57.0   3
HF   1  7.25  46.25  68.125  89.5  10
NM   6 64.75 124.50 156.250 181.0  15
SF   3 32.75  53.50  99.250 184.0  15

Greetings Kristof




--
View this message in context: 
http://r.789695.n4.nabble.com/Error-after-performing-anosim-function-with-vegan-tp4707444.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] Vincentizing Reaction Time data in R

2015-05-20 Thread Gabriel WEINDEL

Dear all,

For my master thesis, I'm currently working in cognitive neuroscience on 
executive control through measurement of reaction time and I need to get 
my data 'vincentized' with an exclusive use of R set by my statistic 
teacher for a test purpose, for this reason I can't use the python code 
the lab team usually uses.
Despite a dozen hours of research I couldn't find any package or R-code 
which would allow the use of vincentization, that's why I'm querying 
help on the R forum.


So has anyone ever used vincentization in R ?

Best regards,

--
Gabriel Weindel
Master student in Neuropsychology - Aix-Marseille University (France)

__
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] subsetting question

2015-05-20 Thread Dieter Anseeuw
Dear all,
I would like to do multiple actions on a subset of my data. Therefore, I want 
to create a for loop on the variable "Date" (actually a double for loop on yet 
another variable, but let's omit that for a moment).
I want to run down every level of "Date" and perform multiple actions on the 
data from a certain date. Here is my code:

for (i in 1:length(datums)){
meanweight<-mean(dataset1[dataset1$Date==datums[i],]$Weight)
...

However, this subsetting obviously doesn't work. How can I adjust my code so 
that R runs down all levels of Data in a for loop?
(I need the for loop, not tapply(), sapply(), ...)

Thanks in advance,
Dieter Anseeuw

[[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] About manipulating NetCDF files in ncdf package.

2015-05-20 Thread Thanh Huyền Trần
Dear R-project staffs,

I'm now dealing with some NetCDF files for my scientific work and I'm
reading it and manipulating it with R.
So far I would like to ask some questions:
1. I have a NetCDF file for time-series data (*daily* time step) in a
domain (with longitudes and latitudes) with two variables are two component
of wind speeds (u-wind and v-wind). I would like  to creat a new NetCDF
file with the synthesized wind speed from the two components from the
existing file in the same spatial resolution but with *monthly* time steps.
Which syntax can I use to compile the code for this?
(please find the enclosed picture for variables information)

2. I have another NetCDF file for time-series data *(hourly)*  in a domain
(with longitudes and latitudes) for downward solar radiation which I want
to transfer to *monthly* data.Which syntax can I use to compile the code
for this?

Thanks and looking forward to your guidance.

Best regards,
Thanh Huyen Tran

-- 
Thanh Huyen Tran

*Master student of Hydrosciences and Engineering Programme,*

*Faculty of Environmental Sciences*
*University of Technology Dresden, Germany*
__
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] subsetting question

2015-05-20 Thread Ivan Calandra

Hi,

What about using functions like aggregate()?
Something like:
aggregate(Weight~datums, data=dataset1, FUN=mean)

If you need to do more things, you can create your own function for 'FUN'

HTH,
Ivan

--
Ivan Calandra, ATER
University of Reims Champagne-Ardenne
GEGENAA - EA 3795
CREA - 2 esplanade Roland Garros
51100 Reims, France
+33(0)3 26 77 36 89
ivan.calan...@univ-reims.fr
https://www.researchgate.net/profile/Ivan_Calandra

Le 20/05/15 12:03, Dieter Anseeuw a écrit :

Dear all,
I would like to do multiple actions on a subset of my data. Therefore, I want to create a 
for loop on the variable "Date" (actually a double for loop on yet another 
variable, but let's omit that for a moment).
I want to run down every level of "Date" and perform multiple actions on the 
data from a certain date. Here is my code:

for (i in 1:length(datums)){
meanweight<-mean(dataset1[dataset1$Date==datums[i],]$Weight)
...

However, this subsetting obviously doesn't work. How can I adjust my code so 
that R runs down all levels of Data in a for loop?
(I need the for loop, not tapply(), sapply(), ...)

Thanks in advance,
Dieter Anseeuw

[[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] Vincentizing Reaction Time data in R

2015-05-20 Thread John McKown
On Wed, May 20, 2015 at 5:13 AM, Gabriel WEINDEL 
wrote:

> Dear all,
>
> For my master thesis, I'm currently working in cognitive neuroscience on
> executive control through measurement of reaction time and I need to get my
> data 'vincentized' with an exclusive use of R set by my statistic teacher
> for a test purpose, for this reason I can't use the python code the lab
> team usually uses.
> Despite a dozen hours of research I couldn't find any package or R-code
> which would allow the use of vincentization, that's why I'm querying help
> on the R forum.
>
> So has anyone ever used vincentization in R ?
>

I haven't. And I failed statistics in school. But a Google search got me to
this page, which I hope might be of some help to you. If not, my apologies.

https://stat.ethz.ch/pipermail/r-help/2003-May/034272.html



>
> Best regards,
>
> --
> Gabriel Weindel
> Master student in Neuropsychology - Aix-Marseille University (France)
>


-- 
If someone tell you that nothing is impossible:
Ask him to dribble a football.He's about as useful as a wax frying pan.10
to the 12th power microphones = 1 MegaphoneMaranatha! <>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] About manipulating NetCDF files in ncdf package.

2015-05-20 Thread Roy Mendelssohn - NOAA Federal
Hi Thanh:

You are confounding  several issues here, and are providing only incomplete 
information about your data.  The confounded issues are:

1.  How to write a netcdf with a given coordinate system.

2.  How to calculate a monthly average or monthly subsample from a larger 
sample.

I would guess that you data are really dimensioned something like (time,lat, 
lon) and what would help is showing the results of say:

str(u_w)

Also, in your original netcdf file there were probably coordinate variables for 
time, latitude and longitude, you need to read those in and be aware of their 
dimensions, and the latitude and longitude data will form the basis of your new 
netcdf file.

To create and write a new netcdf file you will need to understand somewhat the 
structure of a netcdf file.  As the help for the ncdf4-package says:

> If you want to WRITE data to a new netCDF file, the procedure is to first 
> define the dimensions your data array has, then define the variable, then 
> create the file. So, first call ncdim_def to define the dimensions that your 
> data exists along (for example, latitude, longitude, and time). Then call 
> ncvar_def to define a variable that uses those dimensions, and will hold your 
> data. Then call nc_create to create the netCDF file. Finally, call ncvar_put 
> to write your data to the newly created netCDF file, and nc_close when you 
> are done.
> 

Also look at the following web site:

https://www.image.ucar.edu/GSP/Software/Netcdf/

As for issue two, your data are just 3-D arrays, and it is just a question of 
normal array averaging or other operations to get you monthly data.

HTH,

-Roy



> On May 20, 2015, at 4:49 AM, Thanh Huyền Trần  wrote:
> 
> Dear R-project staffs,
> 
> I'm now dealing with some NetCDF files for my scientific work and I'm
> reading it and manipulating it with R.
> So far I would like to ask some questions:
> 1. I have a NetCDF file for time-series data (*daily* time step) in a
> domain (with longitudes and latitudes) with two variables are two component
> of wind speeds (u-wind and v-wind). I would like  to creat a new NetCDF
> file with the synthesized wind speed from the two components from the
> existing file in the same spatial resolution but with *monthly* time steps.
> Which syntax can I use to compile the code for this?
> (please find the enclosed picture for variables information)
> 
> 2. I have another NetCDF file for time-series data *(hourly)*  in a domain
> (with longitudes and latitudes) for downward solar radiation which I want
> to transfer to *monthly* data.Which syntax can I use to compile the code
> for this?
> 
> Thanks and looking forward to your guidance.
> 
> Best regards,
> Thanh Huyen Tran
> 
> -- 
> Thanh Huyen Tran
> 
> *Master student of Hydrosciences and Engineering Programme,*
> 
> *Faculty of Environmental Sciences*
> *University of Technology Dresden, Germany*
> __
> 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.

**
"The contents of this message do not reflect any position of the U.S. 
Government or NOAA."
**
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
***Note new address and phone***
110 Shaffer Road
Santa Cruz, CA 95060
Phone: (831)-420-3666
Fax: (831) 420-3980
e-mail: roy.mendelss...@noaa.gov www: http://www.pfeg.noaa.gov/

"Old age and treachery will overcome youth and skill."
"From those who have been given much, much will be expected" 
"the arc of the moral universe is long, but it bends toward justice" -MLK Jr.

__
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 after performing anosim function with vegan

2015-05-20 Thread David L Carlson
We are not going to be able to help much without the data. You say it is "more 
or less" the same as the example data so maybe it is "less" similar than you 
think. 

Another possibility is that you keep using fix() for some reason that you have 
not explained. That function calls edit() which can strip attributes and that 
can create problems with some data.frames and matrices as the manual page warns:

"Editing an R object may change it in ways other than are obvious: see the 
comment under edit. See edit.data.frame for changes that can occur when editing 
a data frame or matrix."

If you just want to look at the data use, View() not fix().

-
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Brenzo
Sent: Wednesday, May 20, 2015 3:59 AM
To: r-help@r-project.org
Subject: [R] Error after performing anosim function with vegan

Hello,

so I'm relatively new in R, but normally i don't have big problems by using
R. 

But today i struggle a lot with an error message that occurred the first
time.

Error in sort.int(x, na.last = na.last, decreasing = decreasing, ...) :
  'x' must be atomic

I'm using just a normal anosim function and 2 weeks ago it was working fine
with the same files and the same script. So maybe some of you can help me.

Here is the total script:

> data <-read.csv("H:\\PhD\\Ergebnisse Versuch Norwegen\\T-RFLP\\nirK
> Adonis2.csv")
> fix (data)
> data1 <- (data [,-1])
> fix (data1)
> cca.env<- read.csv ("H:\\PhD\\Ergebnisse Versuch
> Norwegen\\T-RFLP\\env2.csv",
+ header= TRUE, )
> fix(cca.env)
> du<- vegdist(data)
> fix(du)
> attach(cca.env)
> dune.ano <- anosim(du, Sample)
> summary(dune.ano)

Call:
anosim(dat = du, grouping = Sample) 
Dissimilarity: bray 

ANOSIM statistic R:  
  Significance: 0.001 

Permutation: free
Number of permutations: 999

Error in sort.int(x, na.last = na.last, decreasing = decreasing, ...) :
  'x' must be atomic

it is more or less exactly the same matrix than in the example from R:

> data(dune)
> fix(dune)
> data(dune.env)
> fix(dune.env)
> dune.dist <- vegdist(dune)
> attach(dune.env)
> dune.ano <- anosim(dune.dist, Management)
> summary(dune.ano)

Call:
anosim(dat = dune.dist, grouping = Management) 
Dissimilarity: bray 

ANOSIM statistic R: 0.2579 
  Significance: 0.008 

Permutation: free
Number of permutations: 999

Upper quantiles of permutations (null model):
  90%   95% 97.5%   99% 
0.115 0.151 0.192 0.250 

Dissimilarity ranks between and within classes:
0%   25%50% 75%  100%   N
Between  4 58.50 104.00 145.500 188.0 147
BF   5 15.25  25.50  41.250  57.0   3
HF   1  7.25  46.25  68.125  89.5  10
NM   6 64.75 124.50 156.250 181.0  15
SF   3 32.75  53.50  99.250 184.0  15

Greetings Kristof




--
View this message in context: 
http://r.789695.n4.nabble.com/Error-after-performing-anosim-function-with-vegan-tp4707444.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] subsetting question

2015-05-20 Thread William Dunlap
Here is a self-contained example of what you might be trying to do.
You would get better answers if you supplied this yourself.

dataset1 <-
data.frame(Date=as.POSIXct(c("2015-04-01","2015-04-01","2015-04-07",
"2015-04-19")), Weight=11:14)
datums <- as.POSIXct(c("2015-04-01", "2015-04-08", "2015-04-19"))
# note that neither dataset1$Date nor datums is a subset of the other

for (i in 1:length(datums)){
meanweight <- mean(dataset1[dataset1$Date==datums[i],]$Weight)
}

You said is 'obviously' doesn't work, but didn't say in what was wrong with
what it did.  One obvious (to me) thing is that in each iteration you
overwrote the
meanweight assigned in the previous iteration so you end up with only the
last one calculated.  You can fix that by using making meanweight a vector
and assigning elements of it in the loop.

meanWeight <- numeric(length(datums))
for (i in 1:length(datums)){
meanWeight[i] <- mean(dataset1[dataset1$Date==datums[i],]$Weight)
}
data.frame(datums, meanWeight)
#  datums meanWeight
#1 2015-04-01   11.5
#2 2015-04-08NaN
#3 2015-04-19   14.0

This looks to me like the appropriate result, but your self-contained
example
would make me more convinced of that.

By the way, why is is important to you to use a for loop and not a function
like
tapply() or aggregate()?  They can cause hassles with the data I gave above
because datums does not partition dataset1$Date, but I don't know what your
problem with them is.



Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Wed, May 20, 2015 at 3:03 AM, Dieter Anseeuw 
wrote:

> Dear all,
> I would like to do multiple actions on a subset of my data. Therefore, I
> want to create a for loop on the variable "Date" (actually a double for
> loop on yet another variable, but let's omit that for a moment).
> I want to run down every level of "Date" and perform multiple actions on
> the data from a certain date. Here is my code:
>
> for (i in 1:length(datums)){
> meanweight<-mean(dataset1[dataset1$Date==datums[i],]$Weight)
> ...
>
> However, this subsetting obviously doesn't work. How can I adjust my code
> so that R runs down all levels of Data in a for loop?
> (I need the for loop, not tapply(), sapply(), ...)
>
> Thanks in advance,
> Dieter Anseeuw
>
> [[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.
>

[[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] java.lang.OutOfMemoryError: Java heap space

2015-05-20 Thread NidhiRai
Hello Bharat,

I am also getting the same error in same situation.
Just want to know that did you resolved your problem, if yes then can you
please help me out.

Thanks !!





--
View this message in context: 
http://r.789695.n4.nabble.com/java-lang-OutOfMemoryError-Java-heap-space-tp4680963p4707446.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.


Re: [R] deSolve ODE Output Question

2015-05-20 Thread David Winsemius

On May 20, 2015, at 6:45 AM, walke554 wrote:

> Hello,
> 
> I am working on a simple ODE problem with the deSolve package, and I was
> hoping that someone could answer a question about how the deSolve package
> does integration.  
> 
> Here is my program:
> 
> #The function
> STDMod<-function(t,y,p){
>   IH = y[1];
>   IL = y[2];
>   with(as.list(p), {
>   dIH.dt = Beta[1,1]*(nH-IH)*IH + Beta[1,2]*(nH-IH)*IL - gamma*IH;
>   dIL.dt = Beta[2,1]*(nL-IL)*IH + Beta[2,2]*(nL-IL)*IL - gamma*IL;
>   return(list(c(dIH.dt,dIL.dt)));
>   })
> }
> 
> #giving the parameters
> 
> Beta = matrix(data=c(10, 0.1, 0.1, 1.0), ncol=2, nrow=2)
> nH = 0.2
> nL = 0.8
> IH0 = 1e-5
> IL0 = 0
> 
> gamma = 1
> 
> p = list(Beta=Beta, gamma=gamma, nH=nH, nL=nL)
> 
> y0 = c(IH0, IL0)
> 
> #Running the ode integrator
> 
> steps= 10;
> t = seq(from=0, to=30, by=.01);
> out = ode(y=y0, times=t, func=STDMod, parms=p);
> 
> My understanding is that the 'out' matrix would be the values of the STDmod
> function at each time step, given the initial values of the state parameters
> IH and IL.  However, for the very first time step, I am getting a value
> different than what the derivative and the initial values add up to.

My reading of the returned value from a call to ode is that it is not the 
values returned by the 'func'-function which only contain the derivative 
vectors, but rather the integrated values. That is what you are seeing in any 
case. You need to remember that integrators calculate the derivative and then 
further multiply by the "dt" increment which in your case will make the 
incremental values one-hundredth of the value you calculated by hand below.  
(Basic calculus.)

> 
> My output:
>  
> 
> but 'IH0' + 'the value of dIH.dt = Beta[1,1]*(nH-IH)*IH +
> Beta[1,2]*(nH-IH)*IL - gamma*IH for timestep one' = 1.999e-5.  Is there
> something that I am missing?  I am hoping to use this for more complicated
> derivatives, but I want to make sure I am using the package correctly first.
> 
> Thanks!
> 
> 
> 
> View this message in context: 
> http://r.789695.n4.nabble.com/deSolve-ODE-Output-Question-tp4707448.html
> Sent from the R help mailing list archive at Nabble.com.

I normally also respond to the list and the questioner but have gotten an 
annoying number of bounces from Nabble users so am not responding directly.

-- 
David Winsemius
Alameda, CA, USA

__
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] subsetting question

2015-05-20 Thread MacQueen, Don
Assuming datums is a vector of the unique dates in Date... perhaps
  datums <- sort(unique(dataset1$Date))

I usually set it up like this

for (i in 1:length(datums) ) {

  crnt.date <- datums[i]
  tmpdat <- subset(dataset1, Date==crnt.date)
  cat(i, format(crnt.date), 'dim(tmpdat)',dim(tmpdat),'\n\n')

 ## use tmpdat for the multiple actions

}

The extra step of creating a subset helps one check that everything is
working as expected. It has no noticeable effect on performance with
datasets of the size I normally work with.

-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 5/20/15, 3:03 AM, "Dieter Anseeuw"  wrote:

>Dear all,
>I would like to do multiple actions on a subset of my data. Therefore, I
>want to create a for loop on the variable "Date" (actually a double for
>loop on yet another variable, but let's omit that for a moment).
>I want to run down every level of "Date" and perform multiple actions on
>the data from a certain date. Here is my code:
>
>for (i in 1:length(datums)){
>meanweight<-mean(dataset1[dataset1$Date==datums[i],]$Weight)
>...
>
>However, this subsetting obviously doesn't work. How can I adjust my code
>so that R runs down all levels of Data in a for loop?
>(I need the for loop, not tapply(), sapply(), ...)
>
>Thanks in advance,
>Dieter Anseeuw
>
>   [[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] Vincentizing Reaction Time data in R

2015-05-20 Thread John Kane
John Kane
Kingston ON Canada

> -Original Message-
> From: john.archie.mck...@gmail.com
> Sent: Wed, 20 May 2015 09:38:47 -0500
> To: gabriel.wein...@gmail.com
> Subject: Re: [R] Vincentizing Reaction Time data in R
> 
> On Wed, May 20, 2015 at 5:13 AM, Gabriel WEINDEL
> 
> wrote:
> 
>> Dear all,
>> 
>> For my master thesis, I'm currently working in cognitive neuroscience on
>> executive control through measurement of reaction time and I need to get
>> my
>> data 'vincentized' with an exclusive use of R set by my statistic
>> teacher
>> for a test purpose, for this reason I can't use the python code the lab
>> team usually uses.
>> Despite a dozen hours of research I couldn't find any package or R-code
>> which would allow the use of vincentization, that's why I'm querying
>> help
>> on the R forum.
>> 
>> So has anyone ever used vincentization in R ?
>> 
> 
> I haven't. And I failed statistics in school. But a Google search got me
> to
> this page, which I hope might be of some help to you. If not, my
> apologies.
> 
> https://stat.ethz.ch/pipermail/r-help/2003-May/034272.html 
> [https://stat.ethz.ch/pipermail/r-help/2003-May/034272.html]
I never heard of it either and I passed a couple out of some number > 2 but we 
always thought the perception and cognition people strange.
I think this paper may be a lead. An email to the authors might help
http://www.ncbi.nlm.nih.gov/pmc/articles/PMC4017132/ 
[http://www.ncbi.nlm.nih.gov/pmc/articles/PMC4017132/]
>

>> Gabriel Weindel
>> Master student in Neuropsychology - Aix-Marseille University (France)


FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
family!
Visit http://www.inbox.com/photosharing to find out more!

__
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] ASA Conference on Statistical Practice

2015-05-20 Thread Adams, Jean
R users,

Abstracts are now being accepted for the
 2016 ASA Conference on Statistical Practice,
 February 18-20,
 San Diego, CA, USA.

Past conference attendees have shown particular interest in R,
reproducibility, and data visualization.

The deadline for submission is June 25.  Presentations will be 35 minutes
long and fall into four broad themes:
 Communication, Impact, and Career Development
 Data Modeling and Analysis
 Big Data Prediction and Analytics
 Software, Programming, and Graphics

Abstracts may be submitted at
http://www.amstat.org/meetings/csp/2016/abstracts.cfm

Thank you.

Jean V. Adams
on behalf of the ASA-CSP 2016 Steering Committee



`·.,,  ><(((º>   `·.,,  ><(((º>   `·.,,  ><(((º>

Jean V. Adams
Statistician
U.S. Geological Survey
Great Lakes Science Center
223 East Steinfest Road
Antigo, WI 54409  USA
http://www.glsc.usgs.gov
http://profile.usgs.gov/jvadams

[[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] Subset and 0 replace?

2015-05-20 Thread Vin Cheng
Hi,
 
I'm trying to group rows in a dataframe with SPCLORatingValue factor >16 and 
summing the Wgt's that correspond to this condition.  There are 100 dataframes 
in a list.  
 
Some of the dataframes won't have any rows that have this condition 
SPCLORatingValue>16 and therefore no corresponding weight.  
 
My problem is that I need to have a corresponding value for each dataframe in 
the list - so 100 values. 
 
If dataframe 44 doesn't have any SPCLORatingValue>16, then I end up getting a 
vector that's 99 long vs. 100.  putting value 45 into 44's slot and so on.
 
Is there either an if/else statement or argument I can place into subset to put 
a 0 for the data frames that don't have SPCLORatingValue>16?
 
GenEval[18,1:100] <- 
t(summaryBy(Wgt.sum~as.numeric(.id),data=subset(ldply(Generation,function(x) 
summaryBy(Wgt ~ SPCLORatingValue, data=x, 
FUN=c(sum))),SPCLORatingValue>16),FUN=c(sum),order=FALSE))
 
Any help or guidance would be greatly appreciated!
Many Thanks,
Vince
 
 
  
[[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] Subset and 0 replace?

2015-05-20 Thread Duncan Murdoch
On 20/05/2015 7:13 PM, Vin Cheng wrote:
> Hi,
>  
> I'm trying to group rows in a dataframe with SPCLORatingValue factor >16 and 
> summing the Wgt's that correspond to this condition.  There are 100 
> dataframes in a list.  
>  
> Some of the dataframes won't have any rows that have this condition 
> SPCLORatingValue>16 and therefore no corresponding weight.  
>  
> My problem is that I need to have a corresponding value for each dataframe in 
> the list - so 100 values. 
>  
> If dataframe 44 doesn't have any SPCLORatingValue>16, then I end up getting a 
> vector that's 99 long vs. 100.  putting value 45 into 44's slot and so on.
>  
> Is there either an if/else statement or argument I can place into subset to 
> put a 0 for the data frames that don't have SPCLORatingValue>16?
>  
> GenEval[18,1:100] <- 
> t(summaryBy(Wgt.sum~as.numeric(.id),data=subset(ldply(Generation,function(x) 
> summaryBy(Wgt ~ SPCLORatingValue, data=x, 
> FUN=c(sum))),SPCLORatingValue>16),FUN=c(sum),order=FALSE))
>  

The summaryBy function is not in base R.  There's a function with that
name in the doBy package; is that the one you're using?

You doing say how to do the grouping, and I can't read your code to
figure it out, but this code will do what you want with suitable inputs:

by(df, group, function(subset) with(subset, sum(Wgt[SPCLORatingValue >
16])))

where df is your dataframe, and group is a variable that defines the groups.

Duncan Murdoch

__
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] Vincentizing Reaction Time data in R

2015-05-20 Thread John Kane


> -Original Message-
> From: gabriel.wein...@gmail.com
> Sent: Wed, 20 May 2015 22:31:48 +0200
> To: jrkrid...@inbox.com, john.archie.mck...@gmail.com
> Subject: Re: [R] Vincentizing Reaction Time data in R
> 
> John Kane : I already read the paper and wrote an e-mail to the author,
> he used matlab and suggested me to ask this same question on this forum.
> But thank you for your answer.

The paper said that they had used R !  They must have forgotten to add what may 
have been a minor bit of use of mintabl

I had a look at the equation in the Wiki article and I have long ago forgotten 
how to read such a thing but I wonder how complicated it is as an algorithm?  R 
is very flexible and it might be fairly easy to just write a function to do it. 

Actually I just had a very quick look at the Ratcliff paper in Psychological 
Bulletin 1979, Vol. 86, No. 3, 446-461 
(http://star.psy.ohio-state.edu/coglab/People/roger/pdf/Papers/psychbull79.pdf)

I am tired and it is not my area of expertise but it does not look too 
difficult to write a function in R to do this. But I have been wrong before. :)

> 
> John McKown : thanks a lot, this could be a great help to me but I have
> to take a closer look.
> 
> Again thank you for your replies.
> 
> Regards,
> 
> --
> Gabriel Weindel
> Master student in Neuropsychology - Aix-Marseille University (France)
> 
> 
> 
> Le 20/05/2015 18:41, John Kane a écrit :
>> John Kane
>> Kingston ON Canada
>> 
>>> -Original Message-
>>> From: john.archie.mck...@gmail.com
>>> Sent: Wed, 20 May 2015 09:38:47 -0500
>>> To: gabriel.wein...@gmail.com
>>> Subject: Re: [R] Vincentizing Reaction Time data in R
>>> 
>>> On Wed, May 20, 2015 at 5:13 AM, Gabriel WEINDEL
>>> 
>>> wrote:
>>> 
 Dear all,
 
 For my master thesis, I'm currently working in cognitive neuroscience
 on
 executive control through measurement of reaction time and I need to
 get
 my
 data 'vincentized' with an exclusive use of R set by my statistic
 teacher
 for a test purpose, for this reason I can't use the python code the
 lab
 team usually uses.
 Despite a dozen hours of research I couldn't find any package or
 R-code
 which would allow the use of vincentization, that's why I'm querying
 help
 on the R forum.
 
 So has anyone ever used vincentization in R ?
 
>>> 
>>> I haven't. And I failed statistics in school. But a Google search got
>>> me
>>> to
>>> this page, which I hope might be of some help to you. If not, my
>>> apologies.
>>> 
>>> https://stat.ethz.ch/pipermail/r-help/2003-May/034272.html
>>> [https://stat.ethz.ch/pipermail/r-help/2003-May/034272.html]
>> I never heard of it either and I passed a couple out of some number > 2
>> but we always thought the perception and cognition people strange.
>> I think this paper may be a lead. An email to the authors might help
>> http://www.ncbi.nlm.nih.gov/pmc/articles/PMC4017132/
>> [http://www.ncbi.nlm.nih.gov/pmc/articles/PMC4017132/]
>>> 
>> 
 Gabriel Weindel
 Master student in Neuropsychology - Aix-Marseille University (France)
>> 
>> 
>> FREE ONLINE PHOTOSHARING - Share your photos online with your friends
>> and family!
>> Visit http://www.inbox.com/photosharing to find out more!
>> 
>>


FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your 
desktop!

__
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] Vincentizing Reaction Time data in R

2015-05-20 Thread Daniel Nordlund

On 5/20/2015 6:22 PM, John Kane wrote:




-Original Message-
From: gabriel.wein...@gmail.com
Sent: Wed, 20 May 2015 22:31:48 +0200
To: jrkrid...@inbox.com, john.archie.mck...@gmail.com
Subject: Re: [R] Vincentizing Reaction Time data in R

John Kane : I already read the paper and wrote an e-mail to the author,
he used matlab and suggested me to ask this same question on this forum.
But thank you for your answer.


The paper said that they had used R !  They must have forgotten to add what may 
have been a minor bit of use of mintabl

I had a look at the equation in the Wiki article and I have long ago forgotten 
how to read such a thing but I wonder how complicated it is as an algorithm?  R 
is very flexible and it might be fairly easy to just write a function to do it.

Actually I just had a very quick look at the Ratcliff paper in Psychological 
Bulletin 1979, Vol. 86, No. 3, 446-461 
(http://star.psy.ohio-state.edu/coglab/People/roger/pdf/Papers/psychbull79.pdf)

I am tired and it is not my area of expertise but it does not look too 
difficult to write a function in R to do this. But I have been wrong before. :)



John McKown : thanks a lot, this could be a great help to me but I have
to take a closer look.

Again thank you for your replies.

Regards,

--
Gabriel Weindel
Master student in Neuropsychology - Aix-Marseille University (France)



Le 20/05/2015 18:41, John Kane a écrit :

John Kane
Kingston ON Canada


-Original Message-
From: john.archie.mck...@gmail.com
Sent: Wed, 20 May 2015 09:38:47 -0500
To: gabriel.wein...@gmail.com
Subject: Re: [R] Vincentizing Reaction Time data in R

On Wed, May 20, 2015 at 5:13 AM, Gabriel WEINDEL

wrote:


Dear all,

For my master thesis, I'm currently working in cognitive neuroscience
on
executive control through measurement of reaction time and I need to
get
my
data 'vincentized' with an exclusive use of R set by my statistic
teacher
for a test purpose, for this reason I can't use the python code the
lab
team usually uses.
Despite a dozen hours of research I couldn't find any package or
R-code
which would allow the use of vincentization, that's why I'm querying
help
on the R forum.

So has anyone ever used vincentization in R ?



I haven't. And I failed statistics in school. But a Google search got
me
to
this page, which I hope might be of some help to you. If not, my
apologies.

https://stat.ethz.ch/pipermail/r-help/2003-May/034272.html
[https://stat.ethz.ch/pipermail/r-help/2003-May/034272.html]

I never heard of it either and I passed a couple out of some number > 2
but we always thought the perception and cognition people strange.
I think this paper may be a lead. An email to the authors might help
http://www.ncbi.nlm.nih.gov/pmc/articles/PMC4017132/
[http://www.ncbi.nlm.nih.gov/pmc/articles/PMC4017132/]





Gabriel Weindel
Master student in Neuropsychology - Aix-Marseille University (France)





A (very) brief search regarding 'vincentizing' reaction time (RT) 
suggests that it just involves binning the RTs and computing the means 
within bins (typically deciles), then analyzing how the distribution of 
means differs across experimental conditions.  This may help you get 
started.


# create some data
rt <- rnorm(100,200,50)
# create deciles for binning
decile <- as.numeric(cut(rt, quantile(rt,0:10)/10),include.lowest=TRUE))
# collect into a dataframe (not really necessary)
df <- data.frame(rt=rt, decile=decile)
#compute the bin means
aggregate(rt,list(decile),mean,data=df)


This should give you a start,

Dan

--
Daniel Nordlund
Bothell, WA USA

__
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] Interfacing Python from R

2015-05-20 Thread Ralph Fehrer
Hi,

 

I need  to call python code from within R. So far, I have found 

 

http://rpython.r-forge.r-project.org/(which is not supported for
windows) 

 

and

 

http://www.omegahat.org/RSPython/   (which  has not been maintained since
2005) .

 

 

Is there any R-package for python interfacing, that  works on windows and is
regularly maintained?

 

 

Kind regards,

 

Finn

 

 

 

 

 


[[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] Vincentizing Reaction Time data in R

2015-05-20 Thread Yisihn
On Wed, 20 May 2015 18:13:17 +0800,
Hi Gabriel,

As far as I could recall, there isn't an R package that has explicitly 
implemented "vincentization". You definitively can find some code 
segments/functions that have implemented "vincentize" on the web. But you 
should verify if they do exactly what you wish to do.  If you could look at the 
question from percentile/quantle perspective, it would not take you too much 
time to realise that they are similar.  I would suggest you to read, as John 
Kane suggested, Prof. Ratcliff's 1979 paper.  Another paper that may be very 
helpful is Prof van Zandt's 2000 RT paper.

However, you should be aware that there are some different implementation of 
"vincentization", and it is debatable, if not problematic, to use it, rather 
than other more general quantile methods. It would help you to understand not 
only how to do vincentization, but also why/why not if you could read papers 
from Jeff Rouder's as well as from Heathcote's and Brown's lab.

Sorry that I hesitate to give you the code, because this looks like part of 
your course works.  It would be more rewarding for you, if you could figure out 
by yourself.

Yishin


Gabriel WEINDEL wrote:
> 
> Dear all,
> 
> For my master thesis, I'm currently working in cognitive neuroscience
> on executive control through measurement of reaction time and I need
> to get my data 'vincentized' with an exclusive use of R set by my
> statistic teacher for a test purpose, for this reason I can't use the
> python code the lab team usually uses.
> Despite a dozen hours of research I couldn't find any package or
> R-code which would allow the use of vincentization, that's why I'm
> querying help on the R forum.
> 
> So has anyone ever used vincentization in R ?
> 
> Best regards,
> 
> -- 
> Gabriel Weindel
> Master student in Neuropsychology - Aix-Marseille University (France)
> 
> __
> 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] Vincentizing Reaction Time data in R

2015-05-20 Thread Gabriel WEINDEL
John Kane : I already read the paper and wrote an e-mail to the author, 
he used matlab and suggested me to ask this same question on this forum. 
But thank you for your answer.


John McKown : thanks a lot, this could be a great help to me but I have 
to take a closer look.


Again thank you for your replies.

Regards,

--
Gabriel Weindel
Master student in Neuropsychology - Aix-Marseille University (France)



Le 20/05/2015 18:41, John Kane a écrit :

John Kane
Kingston ON Canada


-Original Message-
From: john.archie.mck...@gmail.com
Sent: Wed, 20 May 2015 09:38:47 -0500
To: gabriel.wein...@gmail.com
Subject: Re: [R] Vincentizing Reaction Time data in R

On Wed, May 20, 2015 at 5:13 AM, Gabriel WEINDEL

wrote:


Dear all,

For my master thesis, I'm currently working in cognitive neuroscience on
executive control through measurement of reaction time and I need to get
my
data 'vincentized' with an exclusive use of R set by my statistic
teacher
for a test purpose, for this reason I can't use the python code the lab
team usually uses.
Despite a dozen hours of research I couldn't find any package or R-code
which would allow the use of vincentization, that's why I'm querying
help
on the R forum.

So has anyone ever used vincentization in R ?



I haven't. And I failed statistics in school. But a Google search got me
to
this page, which I hope might be of some help to you. If not, my
apologies.

https://stat.ethz.ch/pipermail/r-help/2003-May/034272.html 
[https://stat.ethz.ch/pipermail/r-help/2003-May/034272.html]

I never heard of it either and I passed a couple out of some number > 2 but we 
always thought the perception and cognition people strange.
I think this paper may be a lead. An email to the authors might help
http://www.ncbi.nlm.nih.gov/pmc/articles/PMC4017132/ 
[http://www.ncbi.nlm.nih.gov/pmc/articles/PMC4017132/]





Gabriel Weindel
Master student in Neuropsychology - Aix-Marseille University (France)



FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
family!
Visit http://www.inbox.com/photosharing to find out more!




__
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] Interfacing Python from R

2015-05-20 Thread Bert Gunter
Search. (Not a new idea!)

(I googled on "Call python from R" and found at least one more package).

-- Bert



Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

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




On Wed, May 20, 2015 at 11:41 AM, Ralph Fehrer  wrote:
> Hi,
>
>
>
> I need  to call python code from within R. So far, I have found
>
>
>
> http://rpython.r-forge.r-project.org/(which is not supported for
> windows)
>
>
>
> and
>
>
>
> http://www.omegahat.org/RSPython/   (which  has not been maintained since
> 2005) .
>
>
>
>
>
> Is there any R-package for python interfacing, that  works on windows and is
> regularly maintained?
>
>
>
>
>
> Kind regards,
>
>
>
> Finn
>
>
>
>
>
>
>
>
>
>
>
>
> [[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] Vincentizing Reaction Time data in R

2015-05-20 Thread Bert Gunter
I have one more suggestion:
Consult a local statistician. Psychology, neuroscience (and a host of
other professions that I have encountered) are full of bad statistical
practice and reinvention of wheels. "Vincentizing" sounds suspiciously
like such an example. A statistician could help you sort it out and
either validate the methodology or point you to equivalent more
standard versions (and R packages or functions that might implement
them) or other better alternatives.

Psychology and neuroscience are in particular undergoing public soul
searching regarding their research methodology and the
irreproducibility of many of their published results. Don't add to the
problem: get help from someone local with the necessary statistical
expertise.

Cheers,
Bert

Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

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




On Wed, May 20, 2015 at 1:31 PM, Gabriel WEINDEL
 wrote:
> John Kane : I already read the paper and wrote an e-mail to the author, he
> used matlab and suggested me to ask this same question on this forum. But
> thank you for your answer.
>
> John McKown : thanks a lot, this could be a great help to me but I have to
> take a closer look.
>
> Again thank you for your replies.
>
> Regards,
>
> --
> Gabriel Weindel
> Master student in Neuropsychology - Aix-Marseille University (France)
>
>
>
> Le 20/05/2015 18:41, John Kane a écrit :
>>
>> John Kane
>> Kingston ON Canada
>>
>>> -Original Message-
>>> From: john.archie.mck...@gmail.com
>>> Sent: Wed, 20 May 2015 09:38:47 -0500
>>> To: gabriel.wein...@gmail.com
>>> Subject: Re: [R] Vincentizing Reaction Time data in R
>>>
>>> On Wed, May 20, 2015 at 5:13 AM, Gabriel WEINDEL
>>> 
>>> wrote:
>>>
 Dear all,

 For my master thesis, I'm currently working in cognitive neuroscience on
 executive control through measurement of reaction time and I need to get
 my
 data 'vincentized' with an exclusive use of R set by my statistic
 teacher
 for a test purpose, for this reason I can't use the python code the lab
 team usually uses.
 Despite a dozen hours of research I couldn't find any package or R-code
 which would allow the use of vincentization, that's why I'm querying
 help
 on the R forum.

 So has anyone ever used vincentization in R ?

>>>
>>> I haven't. And I failed statistics in school. But a Google search got me
>>> to
>>> this page, which I hope might be of some help to you. If not, my
>>> apologies.
>>>
>>> https://stat.ethz.ch/pipermail/r-help/2003-May/034272.html
>>> [https://stat.ethz.ch/pipermail/r-help/2003-May/034272.html]
>>
>> I never heard of it either and I passed a couple out of some number > 2
>> but we always thought the perception and cognition people strange.
>> I think this paper may be a lead. An email to the authors might help
>> http://www.ncbi.nlm.nih.gov/pmc/articles/PMC4017132/
>> [http://www.ncbi.nlm.nih.gov/pmc/articles/PMC4017132/]
>>>
>>>
>>
 Gabriel Weindel
 Master student in Neuropsychology - Aix-Marseille University (France)
>>
>>
>> 
>> FREE ONLINE PHOTOSHARING - Share your photos online with your friends and
>> family!
>> Visit http://www.inbox.com/photosharing to find out more!
>>
>>
>
> __
> 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] Subset and 0 replace?

2015-05-20 Thread William Dunlap
Can you show a small self-contained example of you data and expected
results?
I tried to make one and your expression returned a single number in a 1 by
1 matrix.

library(doBy)
Generation<-list(
   data.frame(Wgt=c(1,2,4), SPCLORatingValue=c(10,11,12)),
   data.frame(Wgt=c(8,16), SPCLORatingValue=c(15,17)),
   data.frame(Wgt=c(32,64), SPCLORatingValue=c(19,20)))
 t(summaryBy(Wgt.sum~as.numeric(.id),data=subset(ldply(Generation,function(x)
summaryBy(Wgt ~ SPCLORatingValue, data=x,
FUN=c(sum))),SPCLORatingValue>16),FUN=c(sum),order=FALSE))
#  1
#Wgt.sum.sum 112
str(.Last.value)
# num [1, 1] 112
# - attr(*, "dimnames")=List of 2
#  ..$ : chr "Wgt.sum.sum"
#  ..$ : chr "1"

Two ways of dealing with the problem you verbally described are
(a) determine which elements of the input you can process (e.g., which
have some values>16) and use subscripting on both the left and right
side of the assignment operator to put the results in the right place.
E.g.,
x <- c(-1, 1, 2)
ok <- x>0
x[ok] <- log(x[ok])
(b) make your function handle any case so you don't have to do any
subsetting on either side.  In your case it may be easy since
sum(zeroLongNumericVector) is 0. In other cases you may want to use ifelse,
as in
   x <- c(-1, 1, 2)
   x <- ifelse(x>0, log(x), x)



Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Wed, May 20, 2015 at 4:13 PM, Vin Cheng  wrote:

> Hi,
>
> I'm trying to group rows in a dataframe with SPCLORatingValue factor >16
> and summing the Wgt's that correspond to this condition.  There are 100
> dataframes in a list.
>
> Some of the dataframes won't have any rows that have this condition
> SPCLORatingValue>16 and therefore no corresponding weight.
>
> My problem is that I need to have a corresponding value for each dataframe
> in the list - so 100 values.
>
> If dataframe 44 doesn't have any SPCLORatingValue>16, then I end up
> getting a vector that's 99 long vs. 100.  putting value 45 into 44's slot
> and so on.
>
> Is there either an if/else statement or argument I can place into subset
> to put a 0 for the data frames that don't have SPCLORatingValue>16?
>
> GenEval[18,1:100] <-
> t(summaryBy(Wgt.sum~as.numeric(.id),data=subset(ldply(Generation,function(x)
> summaryBy(Wgt ~ SPCLORatingValue, data=x,
> FUN=c(sum))),SPCLORatingValue>16),FUN=c(sum),order=FALSE))
>
> Any help or guidance would be greatly appreciated!
> Many Thanks,
> Vince
>
>
>
> [[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.
>

[[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] Count unchanged class attribute

2015-05-20 Thread Soe Xiyan
My apologize if the question is confusing. This is due to my English
language.
Thanks to Jim Lemon who has helped me.
I must to learn R harder, like how to use  "unlist" and "list".

On Wed, May 20, 2015 at 1:36 PM, Jim Lemon  wrote:

> Hi Xiyan,
> I have to admit that your puzzle very nearly stumped me. At first I
> thought the question was:
>
> "What are the numbers of rows with changed and unchanged class values?"
>
> That doesn't work as there are at most four rows and your answer sums
> to five. I then tried:
>
> "How many times does at least one value of class change between
> successive data frames?"
>
> Nope, four have at least one change. Could it have been:
>
> "Using unique combinations of the values of Netto and Bruto, how many
> changes have occurred?"
>
> Wrong again, there are 12 combinations, not five. Surely you don't mean:
>
> "In how many data frames does ta least one value of class equal 'no'?"
>
> df1<-data.frame(Netto=c(10,100),Bruto=c(1000,20),class=c("yes","yes"))
> df2<-data.frame(Netto=c(101,100),Bruto=c(1000,210),class=c("yes","no"))
>
> df3<-data.frame(Netto=c(10,12,100),Bruto=c(10,28,20),class=c("yes","yes","yes"))
> df4<-data.frame(Netto=c(120,400),Bruto=c(200,20),class=c("no","yes"))
> df5<-data.frame(Netto=c(110,1100,120,1140),Bruto=c(12000,120,100,125),
>  class=c("yes","yes","yes","yes"))
> sxdat<-list(df1,df2,df3,df4,df5)
> table(ifelse(unlist(lapply(sxdat,function(x)
> return(any(x$class=="no","changed","unchanged"))
>
> Jim
>
> On Wed, May 20, 2015 at 1:04 PM, Bert Gunter 
> wrote:
> > Probably "or what."
> >
> > This demonstrates a fundamental conundrum: many users or prospective
> users
> > of R have had little exposure to data structures in their formal
> education
> > and therefore can be flummoxed by R's fussiness -- as any programming
> > language must necessarily be. Consider: data frames, matrices, lists,
> > "classes", objects with attributes (e.g. factors),...
> >
> > Excel, which is basically structureless, of course, exacerbates the
> > problem. Those accustomed to its tolerance (and the confusion that
> results)
> > expect R to behave the same way. Education is the only recourse, either
> in
> > formal courses or through R tutorials that strongly emphasize this aspect
> > of interacting with R and especially writing effective code. But that
> > demands effort and, to some extent, aptitude... both of which seem to be
> in
> > increasingly short supply amidst the worldwide explosion in R's usage.
> >
> > Of course, feel free to disagree... Just my $.02
> >
> > Cheers,
> > Bert
> >
> >
> > Bert Gunter
> > Genentech Nonclinical Biostatistics
> > (650) 467-7374
> >
> > "Data is not information. Information is not knowledge. And knowledge is
> > certainly not wisdom."
> > Clifford Stoll
> >
> >
> >
> > On Tue, May 19, 2015 at 7:02 PM, John Kane  wrote:
> >
> >> Is this a list of data.frames or what?
> >>
> >> Please have a look at one or both of these for some ideas of how to ask
> a
> >> question and provide information on the problem.  The better you can
> >> describe what you have and what you need the better people can help.
> >>
> >>
> http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
> >> and http://adv-r.had.co.nz/Reproducibility.html
> >>
> >>
> >> John Kane
> >> Kingston ON Canada
> >>
> >>
> >> > -Original Message-
> >> > From: soe.xi...@gmail.com
> >> > Sent: Tue, 19 May 2015 23:37:13 +0700
> >> > To: r-help@r-project.org
> >> > Subject: [R] Count unchanged class attribute
> >> >
> >> > Maybe someone can help me.
> >> > Suppose I have data-set like this:
> >> >
> >> >   Netto   Bruto  class
> >> > 1 10  1000yes
> >> > 2 100 20  yes
> >> >
> >> >
> >> >   Netto   Bruto  class
> >> > 1 101 1000yes
> >> > 2 100 210 no
> >> >
> >> >
> >> >   Netto   Bruto  class
> >> > 1 10  10  yes
> >> > 2 12  28  yes
> >> > 3 100 20  yes
> >> >
> >> >   Netto   Bruto  class
> >> > 1 120 200 no
> >> > 2 400 20  yes
> >> >
> >> >
> >> >   Netto   Bruto  class
> >> > 1 110 12000   yes
> >> > 2 1100120 yes
> >> > 3 120 100 yes
> >> > 4 1140125 yes
> >> >
> >> > How to calculate the number of classes has changed.
> >> > The expected result is
> >> > - class changed2
> >> > - class unchanged  3
> >> >
> >> >
> >> > Thank you so much.
> >> > Soe Xiyan
> >> >
> >> >   [[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.
> >>
> >> 
> >> Can't remember your password? Do you need a strong and secure password?
> >> Use Password manager! It s