Re: [R] shift by one column given rows in a dataframe

2015-07-24 Thread maxbre
hi

thank you all for the great replies, very useful indeed even if some of them
a bit too aggressive (which is never, ever a good approach in my very humble
opinion... but that's a matter of taste and style I do not want to discuss
here); sorry again for bothering someone with such a trivial and
ill-conceived question

finally, I'm posting here my solution as a reference to the problem so that
to close this long and winding thread; 

hoping this code might be somehow useful for someonelse, sometime,
somewhere...

## start code

v0-c(a,xxx,c,rep(xxx,2))
v1-c(1,b,3,d,e)
v2-c(6,2,8,4,5)
v3-c(xxx,7,xxx,9,10)
 
df_start-data.frame(v0,v1,v2,v3, stringsAsFactors = FALSE)

df_start

# set vector of rows to be shifted left
shIftLeft-c(2,4,5)

# shift selected rows
df_start[shIftLeft,1:3]-df_start[shIftLeft,2:4]

# final result
df_end-df_start[,1:3]

df_end

## end code

thanks




--
View this message in context: 
http://r.789695.n4.nabble.com/shift-by-one-column-given-rows-in-a-dataframe-tp4710256p4710294.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] R GUI plot by color

2015-07-24 Thread jpara3
Hi, 

I want to do a plot from a variable (which i select from a listbox) with the
color factor of the variable that i have selected from another listbox.

To be not very heavy pasting all the code, i will only paste real important
parts:

data1 and data2 are the extacted parts of the dataframes data from a
tcltk listbox:

data1- dataframe[as.numeric(tkcurselection(tl))+1]
data2- dataframe[as.numeric(tkcurselection(tl))+1]

As i want to plot the data1 with the color of data2, i use this code:

plot(data1,col=colnames(data2))

This works perfect for plotting the data1 variable, but it do not change the
col of the dots by data2. 

I also have probed with 

plot(data1,col=factor(colnames(data2)))

But nothing happens with the color. 

Thanks!!






--
View this message in context: 
http://r.789695.n4.nabble.com/R-GUI-plot-by-color-tp4710297.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] Table Looks Funny

2015-07-24 Thread Jim Lemon
Hi Marissa,
Unfortunately we didn't get the picture. If you want to send an
image, PDF is probably your best bet. If that is not possible, perhaps
a description of the weirdness that has confronted you will allow
someone to suggest a solution.

Jim

On Fri, Jul 24, 2015 at 7:08 AM, Marissa Fahlberg
marissa.fahlb...@gmail.com wrote:
 Hey, I can't seem to import my csv file in such a way that the table looks
 normal. The dimensions are correct, 4x7, and I set my header =TRUE, but
 it still looks weird. Attached is the picture. Any ideas??

 Thanks!!

 -Marissa
 __
 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] R GUI plot by color

2015-07-24 Thread Jim Lemon
Hi jpara3,
Hmmm. It's becoming clearer, yes I think the answer is emerging from
the swirling clouds of uncertainty.

1) The column names of data2 are not numbers

2) The number of columns in data2 is not equal to the number of values
in data1 that you are plotting

3) You probably want to plot colors determined by the values in data2,
not the names of its columns

Please send payment for this psychic reading to

Jim


On Fri, Jul 24, 2015 at 6:43 PM, jpara3 j.para.fernan...@hotmail.com wrote:
 Hi,

 I want to do a plot from a variable (which i select from a listbox) with the
 color factor of the variable that i have selected from another listbox.

 To be not very heavy pasting all the code, i will only paste real important
 parts:

 data1 and data2 are the extacted parts of the dataframes data from a
 tcltk listbox:

 data1- dataframe[as.numeric(tkcurselection(tl))+1]
 data2- dataframe[as.numeric(tkcurselection(tl))+1]

 As i want to plot the data1 with the color of data2, i use this code:

 plot(data1,col=colnames(data2))

 This works perfect for plotting the data1 variable, but it do not change the
 col of the dots by data2.

 I also have probed with

 plot(data1,col=factor(colnames(data2)))

 But nothing happens with the color.

 Thanks!!






 --
 View this message in context: 
 http://r.789695.n4.nabble.com/R-GUI-plot-by-color-tp4710297.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] R GUI plot by color

2015-07-24 Thread jpara3
I have done a trial with a dataframe like this:
one-c(3,2,2)
two-c(a,b,b)
data-dataframe(uno,dos)

plot(data$one,col=data$two)

and it plots perfect.

If I try it with the code that i have post in the first message, selecting
data1 and data2 as i nthis example, the plot is plotted, but all dots with
the same color.

Thanks for the answer but noone of the 3 topics is the root problem.





--
View this message in context: 
http://r.789695.n4.nabble.com/R-GUI-plot-by-color-tp4710297p4710300.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] how to install and use Rcplex package

2015-07-24 Thread Rui Barradas

Hello,

Try

install.packages(Rcplex)

That's it.

Hope this helps,

Rui Barradas

Em 24-07-2015 12:20, Yasin Gocgun escreveu:

Hi,

I need to know how to completely install Rcplex to be able to use
cplex in R. According to the instructions given in the following
webpage, I edited the Makevars.win file:

https://cran.r-project.org/web/packages/Rcplex/INSTALL

The revised Makevars.win file includes only the following lines:

PKG_CPPFLAGS=-I/C:/ilog/CPLEX_Studio122/include
PKG_LIBS=-L/C:/ilog/CPLEX_Studio122/cplex/lib/x64_windows_vs2008/stat_mda-lcplex122
-lm

First, I am not sure whether the above lines are completely correct.
Second, I don'y know what is the next step in installing and using
Rcplex. So can someone help me about this issue?

Thank you in advance,



__
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] How to calculate the average direct effect, average total effect and average indirect effect for spatial regression models with spatial lag of dependent variable

2015-07-24 Thread Linus Holtermann
Hello,

the command impacts in the spdep-packeage should help you.


Mit freundlichen Grüßen


Linus Holtermann
Hamburgisches WeltWirtschaftsInstitut gemeinnützige GmbH (HWWI)
Heimhuder Straße 71
20148 Hamburg
Tel +49-(0)40-340576-336
Fax+49-(0)40-340576-776
Internet: www.hwwi.org
Email: holterm...@hwwi.org
 
Amtsgericht Hamburg HRB 94303
Geschäftsführer: PD Dr. Christian Growitsch | Prof. Dr. Henning Vöpel
Prokura: Dipl. Kauffrau Alexis Malchin
Umsatzsteuer-ID: DE 241849425

-Ursprüngliche Nachricht-
Von: R-help [mailto:r-help-boun...@r-project.org] Im Auftrag von wenyueyang
Gesendet: Donnerstag, 23. Juli 2015 17:35
An: r-help@r-project.org
Betreff: [R] How to calculate the average direct effect, average total effect 
and average indirect effect for spatial regression models with spatial lag of 
dependent variable

Hi,

I am using four spatial regression models (SAR, SEM, SAC and SDM) to evaluate 
the spillover effect of some factors. LeSage and Pace (2009) pointed out that 
when the spatial lag of the dependent variable is included in the model, 
parameter estimates lose their conventional interpretation as marginal effects, 
because the spatial lag gives rise to a series of feedback loops and spillover 
effects across regions. Therefore, I need to calculate the three different 
marginal effects: average direct effect, average total effect and average 
indirect (spillover) effect, and this is what I don't know how to perform in R.
Can you teach me about how to calculate the average direct effect, average 
total effect and average indirect (spillover) effect for the spatial regression 
models in R and tell me the related R code? 
I would like to express my great appreciation to you!

Thank you very much and best regards.

Yours sincerely,
Wenyue Yang



--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-calculate-the-average-direct-effect-average-total-effect-and-average-indirect-effect-for-spate-tp4710253.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.


[R] how to install and use Rcplex package

2015-07-24 Thread Yasin Gocgun
Hi,

I need to know how to completely install Rcplex to be able to use
cplex in R. According to the instructions given in the following
webpage, I edited the Makevars.win file:

https://cran.r-project.org/web/packages/Rcplex/INSTALL

The revised Makevars.win file includes only the following lines:

PKG_CPPFLAGS=-I/C:/ilog/CPLEX_Studio122/include
PKG_LIBS=-L/C:/ilog/CPLEX_Studio122/cplex/lib/x64_windows_vs2008/stat_mda-lcplex122
-lm

First, I am not sure whether the above lines are completely correct.
Second, I don'y know what is the next step in installing and using
Rcplex. So can someone help me about this issue?

Thank you in advance,

-- 
Yasin Gocgun

__
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] R GUI plot by color

2015-07-24 Thread Jim Lemon
Hi jpara3,
Your example, when I got it to go:

one-c(3,2,2)
two-c(a,b,b)
data-dataframe(one,two)
plot(data$one,col=data$two)

does indeed work, and I'll explain how. You are plotting the values of
data$one against the _values_ of data$two (see point 3 of my
response). In this case, the values of data$two are of class factor,
which means that they have numeric values attached to the levels (a,
b) of the factor. When you pass these values as the col argument,
they are silently converted to their numeric values (1,2,2). In the
default palette, these numbers represent the colors - black, red, red.
Those are the colors in which the points are plotted. So far, so good.
Let's look at the other two points that I guessed.

1) The column names of data2 are not numbers

colnames(data)
[1] one two

As you can see, the column names are character variables, and they
don't translate to numbers:

as.numeric(colnames(data))
[1] NA NA

2) The number of columns in data2 is not equal to the number of values
in data1 that you are plotting

It's pretty obvious that there are two values in the column names and
three in the vector of values that you are plotting in your
example.So, I think I got three out of three without knowing what the
data were.

Jim


On Fri, Jul 24, 2015 at 7:53 PM, jpara3 j.para.fernan...@hotmail.com wrote:
 I have done a trial with a dataframe like this:
 one-c(3,2,2)
 two-c(a,b,b)
 data-dataframe(uno,dos)

 plot(data$one,col=data$two)

 and it plots perfect.

 If I try it with the code that i have post in the first message, selecting
 data1 and data2 as i nthis example, the plot is plotted, but all dots with
 the same color.

 Thanks for the answer but noone of the 3 topics is the root problem.





 --
 View this message in context: 
 http://r.789695.n4.nabble.com/R-GUI-plot-by-color-tp4710297p4710300.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.


[R] Which is the best way of reporting results of lme() in two different possible cases?

2015-07-24 Thread angelo.arc...@virgilio.it
 
Dear List Memebers,
I need some advise about how to report the output of lme(). When searching for 
correlations between between a dependent variable 
and a factor or a combination of factors in a repeated measure design 
with lme() I noticed that I can encounter two types of results, and I am
 wondering which is the best way to report each of them in a journal 
publication. It is not clear to me when I should report the values of 
the beta coefficient together with the t-test value and p-value, or the 
beta coefficient with F value and p-value.


Let’s have as a reference the following two models:


MODEL TYPE 1: fixed effects only 

lme_Weigth - lme(Sound_Feature ~ Weight, data = My_Data, random = ~1 | Subject)
summary(lme_Weigth)

lme_Height - lme(Sound_Feature ~ Height, data = My_Data, random = ~1 | Subject)
summary(lme_Height)


MODEL TYPE 2: Fixed and interaction effects together

lme_Interaction - lme(Sound_Feature ~ Weight*Height, data = My_Data, random = 
~1 | Subject)

summary(lme_Interaction)  
anova.lme(lme_Interaction, type = marginal).


RESULTS CASE 1: Applying model type 2 I do not get any significant p-value so 
there is no interaction effect. Therefore I check
the simplified model type 1, and I get for both Height and Weight significant 
p-values.


RESULTS CASE 2: Applying model type 2 I get a significant p-value so 
there is an interaction effect. Therefore I do not check
the simplified model type 1 for the two factors separately. Moreover, in
 the results of model type 2 I can also see that the fixed effects of 
both factors are significant.


I am not sure if in presence of an interaction it is correct to 
report the significant interactions of the separate factors, since I 
read somewhere that it does not make too much sense. Am I wrong?


My attempt in reporting the results for the two cases is the following. Can you 
please tell me it I am right?


“We performed a linear mixed effects analysis of the relationship 
between Sound_Feature and Height and Weight. As fixed effects, we 
entered Height and Weight (without interaction term) into a first model,
 and we included the interaction effect into a second model. As random 
effects, we had intercepts for subjects.”


RESULTS CASE 1: “Results showed that Sound_Feature was linearly 
related to Height (beta = value, t(df)= value, p  0.05) and Weight 
(beta = value, t(df)= value, p  0.05), but no to their interaction 
effect.”


RESULTS CASE 2:  “Results showed that Sound_Feature was linearly 
related to Height (beta = value, F(df)= value, p  0.05) and Weight 
(beta = value, F(df)= value, p  0.05), and to their interaction 
effect (beta = value, F(df)= value, p  0.05).”


Basically I used for reporting the beta value in the 2 cases I use 
the output of summary(). In the case 1, I report the value of the 
t-test, still taken from summary. But for case 2 I do not report the 
t-test, I report the F value as result of anova.lme(lme_Interaction, 
type = marginal).


Is this the correct way of proceeding in the results reporting?


I give an example of the outputs I get using the two models for the three cases:


RESULTS CASE 1:

 ### Sound_Level_Peak vs Weight*Height ###
 

 
 library(nlme)
 lme_Sound_Level_Peak - lme(Sound_Level_Peak ~ Weight*Height, data = 
 My_Data1, random = ~1 | Subject)
 
 summary(lme_Sound_Level_Peak)
Linear mixed-effects model fit by REML
 Data: My_Data1 
   AIC  BIClogLik
  716.2123 732.4152 -352.1061

Random effects:
 Formula: ~1 | Subject
(Intercept) Residual
StdDev:5.470027 4.246533

Fixed effects: Sound_Level_Peak ~ Weight * Height 
  Value Std.Error DFt-value p-value
(Intercept)   -7.185833  97.56924 95 -0.0736485  0.9414
Weight 0.993543   1.63151 15  0.6089715  0.5517
Height-0.076300   0.55955 15 -0.1363592  0.8934
Weight:Height -0.005403   0.00898 15 -0.6017421  0.5563
 Correlation: 
  (Intr) Weight Height
Weight-0.927  
Height-0.994  0.886   
Weight:Height  0.951 -0.996 -0.919

Standardized Within-Group Residuals:
Min  Q1 Med  Q3 Max 
-2.95289464 -0.51041805 -0.06414148  0.48562230  2.95415889 

Number of Observations: 114
Number of Groups: 19 


 anova.lme(lme_Sound_Level_Peak,type = marginal)
  numDF denDF   F-value p-value
(Intercept)   195 0.0054241  0.9414
Weight115 0.3708463  0.5517
Height115 0.0185938  0.8934
Weight:Height 115 0.3620936  0.5563
 
 





 ### Sound_Level_Peak vs Weight ###
 
 library(nlme)
 summary(lme(Sound_Level_Peak ~ Weight, data = My_Data1, random = ~1 | 
 Subject))
Linear mixed-effects model fit by REML
 Data: My_Data1 
   AIC  BIClogLik
  706.8101 717.6841 -349.4051

Random effects:
 Formula: ~1 | Subject
(Intercept) Residual
StdDev:5.717712 4.246533

Fixed effects: Sound_Level_Peak ~ Weight 
  

Re: [R] how to install and use Rcplex package

2015-07-24 Thread ProfJCNash
It's important to look at the CRAN documentation, where it is quite
clear there are NO Windows binaries for this package.

My suggestion -- set up the (freeware) VirtualBox or a similar Virtual
Machine environment, install a Linux OS virtually, and install there. If
there is no Windows binary on CRAN, there is likely a very good reason.

You may actually find that something like Lubuntu or Linux Mint are more
convenient for working with R.

JN

On 15-07-24 09:54 AM, Yasin Gocgun wrote:
 Hi,
 
 Thanks for your email. When I use that line, I received the following
 messages from R:
 
 package ‘Rcplex’ is available as a source package but not as a binary
 
 package ‘Rcplex’ is not available (for R version 3.1.1)
 
 So, do you see what the problem is?
 
 Thank you,
 
 Yasin
 
 On Fri, Jul 24, 2015 at 4:04 PM, Rui Barradas ruipbarra...@sapo.pt wrote:
 Hello,

 Try

 install.packages(Rcplex)

 That's it.

 Hope this helps,

 Rui Barradas

 Em 24-07-2015 12:20, Yasin Gocgun escreveu:

 Hi,

 I need to know how to completely install Rcplex to be able to use
 cplex in R. According to the instructions given in the following
 webpage, I edited the Makevars.win file:

 https://cran.r-project.org/web/packages/Rcplex/INSTALL

 The revised Makevars.win file includes only the following lines:

 PKG_CPPFLAGS=-I/C:/ilog/CPLEX_Studio122/include

 PKG_LIBS=-L/C:/ilog/CPLEX_Studio122/cplex/lib/x64_windows_vs2008/stat_mda-lcplex122
 -lm

 First, I am not sure whether the above lines are completely correct.
 Second, I don'y know what is the next step in installing and using
 Rcplex. So can someone help me about this issue?

 Thank you in advance,


 
 


__
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] R version update

2015-07-24 Thread David Winsemius

On Jul 21, 2015, at 11:55 AM, kle...@sxmail.de wrote:

 Dear Ladies and Gentlemen,
 as a beginner in R, I encountered a sort of naturally given 
 limitsconcerning the process of amending R with packages.
 I apparently own version 3.0.2 and I principally decided to use R via
 the RKWard GUI on Linux Kubuntu Trusty Tahr; the R version installed on
 my computer is admittedly not far from the basics provided by my
 distribution's package management (also throughout multiple rounds of
 updates/ upgrades of the system).
 What would I have to do to finally update/ upgrade beyond that R
 version? Would that process (generally?) affect any/ my GUI?
 This problem appeared to me as I was busy installing packages an
 received the error message package ‘ATLAS’ is not available (for R
 version 3.0.2) .

ATLAS is not an R package:

https://launchpad.net/ubuntu/+source/atlas

 I am quite desperate and would look forward to be indicated a path to a
 sustainable solution or be told how to mitigate/ circumvent (these/
 such) problems.
 Thanks a lot!
 
 Best regards,Markus Hofstetter
 
 
   [[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.

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] Infinite Series

2015-07-24 Thread Jeff Newmiller
Please reply-all so the mailing list stays in the loop.

cumsum(1/(1:100)^2)

gives you the partial sums up through i=100.
---
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 July 24, 2015 10:30:09 AM PDT, Janh Anni annij...@gmail.com wrote:
Hello Jeff,

Thank you so much for the suggestion,  I searched cumsum as suggested
but
not sure it is what I had in mind.  For instance if I had the infinite
series:[image: Inline image 1]

and want to compute the sum of the, say, first 100 terms, how could I
use
cusum to do that?

Thanks again,

Janh


On Thu, Jul 23, 2015 at 11:51 PM, Jeff Newmiller
jdnew...@dcn.davis.ca.us
wrote:

 ?cumsum

---
 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 July 23, 2015 8:23:39 PM PDT, Janh Anni annij...@gmail.com
wrote:
 Dear All,
 
 Does anyone know of any R functions that compute partial sums of
 series?
 
 Thanks in advance!
 
 Janh
 
[[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] R version update

2015-07-24 Thread Ista Zahn
Hi Markus,

Please keep the list copied. See responses in line.


On Fri, Jul 24, 2015 at 1:22 PM,  kle...@sxmail.de wrote:
 Dear Ista Zahn,

 Thank you that you answered.
 Kubuntu delivered some packages of R and I obviously got R version 3.0.2 by
 the time (early 2015) I installed R fully on my Linux Kubuntu Trusty Tahr.

Yes, I understood that much. If you want to upgrade to a more recent
version follow the instructions in the first link I sent you last time
(https://cran.r-project.org/bin/linux/ubuntu/).

 The package ATLAS is a recommended one from recent R-explaining literature
 that I intend to work through to get accustomed and tackle R as fully as I
 can.

Well, AFAIK there is no such package on CRAN. What literature exactly
are you referring to?

 I had to experience that beyond a package called ATLAS a certain
 number of further other very useful packages were not available because
 being not for R version 3.0.2 as I appended when speaking of the problem
 ATLAS.
 My conclusion up to now is: I cannot use R fully because I have no
 opportunity to update my basic R version AS SUCH. I hope there is a way of
 solving this without destroying too much of the wealth of packages I have
 already integrated.

OK, so follow the instructions for updating.

Best,
ISta


 Best regards,
 Markus Hofstetter


 Ista Zahn istaz...@gmail.com schrieb (22.07.2015 14:24):


 On Jul 21, 2015 9:30 PM, kle...@sxmail.de wrote:

 Dear Ladies and Gentlemen,
 as a beginner in R, I encountered a sort of naturally given
 limitsconcerning the process of amending R with packages.
 I apparently own version 3.0.2 and I principally decided to use R via
 the RKWard GUI on Linux Kubuntu Trusty Tahr; the R version installed on
 my computer is admittedly not far from the basics provided by my
 distribution's package management (also throughout multiple rounds of
 updates/ upgrades of the system).
 What would I have to do to finally update/ upgrade beyond that R
 version?

 https://cran.r-project.org/bin/linux/ubuntu/

 Would that process (generally?) affect any/ my GUI?

 possibly.

 This problem appeared to me as I was busy installing packages an
 received the error message package ‘ATLAS’ is not available (for R
 version 3.0.2) .

 I don't think there is any package on CRAN with that name. What makes you
 think there is?

 I am quite desperate and would look forward to be indicated a path to a
 sustainable solution or be told how to mitigate/ circumvent (these/
 such) problems.

 I'm not actually sure exactly what the problem is...

 Thanks a lot!

 Best regards,Markus Hofstetter


 [[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] How to simulate informative censoring in a Cox PH model?

2015-07-24 Thread Daniel Meddings
Hi Greg

Many thanks for taking the time to respond to my query. You are right about
pointing out the distinction between what variables are and are not
included in the event times process and in the censoring process. I clearly
forgot this important aspect. I amended my code to do as you advise and now
I am indeed getting biased estimates when using the informatively censored
responses. The problem is now that the estimates from the independently
censored responses are the same - i.e. they are just as biased. Thus the
bias seems to be due entirely to model mis-specification and not the
informative censoring.


To give a concrete example I simulate event times T_i and censoring times
C_i from the following models;


T_i~ Weibull(lambda_t(x),v_t),lambda_t(x)=lambda_t*exp( beta_t_0 +
(beta_t_1*Treat_i) + (beta_t_2*Z_i) + (beta_t_3*Treat_i*Z_i)  )

C_i~ Weibull(lambda_c(x),v_c),lambda_c(x)=lambda_c*exp( beta_c_0 +
(beta_c_1*Treat_i) + (beta_c_2*Z_i) + (beta_c_3*Treat_i*Z_i)  )

D_i~Weibull(lambda_d(x),v_D), lambda_d(x)=lamda_d*exp( beta_d_0)

where ;

beta_t_0 = 1,  beta_t_1 = -1,   beta_t_2 = 1,  beta_t_3 = -2,   lambda_t=0.5

beta_c_0 = 0.2,  beta_c_1 = -2,   beta_c_2 = 2,  beta_c_3 = -2,
lambda_c=0.5

beta_d_0 = -0.7,  lambda_d=0.1

When I fit the cox model to both the informatively censored responses and
the independent censored responses I include only the Treatment covariate
in the model.

I simulate Treatment from a Bernoulli distribution with p=0.5 and Z_i from
a beta distribution so that Z ranges from 0 to 1 (I like to think of Z as a
poor prognosis probability where Z_i=1 means a subject is 100% certain to
have a poor prognosis and Z_i=0 means zero chance). These parameter choices
give approximately 27% and 25% censoring for the informatively censored
responses (using C_i) and the independent censored responses (using D_i)
respectively. I use N=2000 subjects and 2000 simulation replications.

The above simulation I get estimates of beta_t_2 of -1.526 and -1.537 for
the informatively censored responses and the independent censored responses
respectively.

Furthermore when I fit a cox model to the full responses (no censoring at
all) I get an estimate of beta_t_2 of -1.542. This represents the best that
can possibly be done given that Z and Treat*Z are not in the model. Clearly
censoring is not making much of a difference here - model mis-specification
dominates.

I still must be doing something wrong but I cannot figure this one out.

Thanks

Dan



On Thu, Jul 23, 2015 at 12:33 AM, Greg Snow 538...@gmail.com wrote:

 I think that the Cox model still works well when the only information
 in the censoring is conditional on variables in the model.  What you
 describe could be called non-informative conditional on x.

 To really see the difference you need informative censoring that
 depends on something not included in the model.  One option would be
 to use copulas to generate dependent data and then transform the
 values using your Weibul.  Or you could generate your event times and
 censoring times based on x1 and x2, but then only include x1 in the
 model.

 On Wed, Jul 22, 2015 at 2:20 AM, Daniel Meddings dpmeddi...@gmail.com
 wrote:
  I wish to simulate event times where the censoring is informative, and to
  compare parameter estimator quality from a Cox PH model with estimates
  obtained from event times generated with non-informative censoring.
 However
  I am struggling to do this, and I conclude rather than a technical flaw
 in
  my code I instead do not understand what is meant by informative and
  un-informative censoring.
 
  My approach is to simulate an event time T dependent on a vector of
  covariates x having hazard function h(t|x)=lambda*exp(beta'*x)v*t^{v-1}.
  This corresponds to T~ Weibull(lambda(x),v), where the scale parameter
  lambda(x)=lambda*exp(beta'*x) depends on x and the shape parameter v is
  fixed. I have N subjects where T_{i}~ Weibull(lambda(x_{i}),v_{T}),
  lambda(x_{i})=lambda_{T}*exp(beta_{T}'*x_{i}), for i=1,...,N. Here I
 assume
  the regression coefficients are p-dimensional.
 
  I generate informative censoring times C_i~ Weibull(lambda(x_i),v_C),
  lambda(x_i)=lambda_C*exp(beta_C'*x_i) and compute Y_inf_i=min(T_i,C_i)
 and
  a censored flag delta_inf_i=1 if Y_inf_i = C_i (an observed event), and
  delta_inf_i=0 if Y_inf_i  C_i (informatively censored: event not
  observed). I am convinced this is informative censoring because as long
 as
  beta_T~=0 and beta_C~=0 then for each subject the data generating process
  for T and C both depend on x.
 
  In contrast I generate non-informative censoring times
  D_i~Weibull(lambda_D*exp(beta_D),v_D), and compute Y_ninf_i=min(T_i,D_i)
  and a censored flag delta_ninf_i=1 if Y_ninf_i = D_i (an observed
 event),
  and delta_ninf_i=0 if Y_ninf_i  D_i (non-informatively censored: event
 not
  observed). Here beta_D is a scalar. I scale the simulation by choosing
  the lambda_T, lambda_C and lambda_D parameters 

Re: [R] Infinite Series

2015-07-24 Thread Janh Anni
Hello Jeff,

Thanks a lot.  I tried it and see that it prints out the entire 100 partial
sums, so I can take the last value as the partial sum for the first 100
terms. Would there be any way cumsum can print only the nth partial sum,
i.e. the last value in the array, instead of printing the entire array?
Thanks again.

Joseph

On Fri, Jul 24, 2015 at 2:02 PM, Jeff Newmiller jdnew...@dcn.davis.ca.us
wrote:

 Please reply-all so the mailing list stays in the loop.

 cumsum(1/(1:100)^2)

 gives you the partial sums up through i=100.
 ---
 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 July 24, 2015 10:30:09 AM PDT, Janh Anni annij...@gmail.com wrote:
 Hello Jeff,
 
 Thank you so much for the suggestion,  I searched cumsum as suggested
 but
 not sure it is what I had in mind.  For instance if I had the infinite
 series:[image: Inline image 1]
 
 and want to compute the sum of the, say, first 100 terms, how could I
 use
 cusum to do that?
 
 Thanks again,
 
 Janh
 
 
 On Thu, Jul 23, 2015 at 11:51 PM, Jeff Newmiller
 jdnew...@dcn.davis.ca.us
 wrote:
 
  ?cumsum
 

 ---
  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 July 23, 2015 8:23:39 PM PDT, Janh Anni annij...@gmail.com
 wrote:
  Dear All,
  
  Does anyone know of any R functions that compute partial sums of
  series?
  
  Thanks in advance!
  
  Janh
  
 [[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-es] Método S3 paquete

2015-07-24 Thread Carlos J. Gil Bellosta
Hola, ¿qué tal?

Sigue 
http://www.datanalytics.com/2011/08/04/desarrollo-de-paquetes-con-r-iv-funciones-genericas/
a rajatabla y lo tendrás.

Un saludo,

Carlos J. Gil Bellosta
http://www.datanalytics.com

P.D.: Si te fijas bien, no estás siguiendo esa guía a rajatabla.

El día 23 de julio de 2015, 16:26,  guillermo.vi...@uv.es escribió:
 Hola,

 Estoy tratando de crear un método S3 llamado anthr dentro del paquete
 que estoy desarrollando, cuyo argumento principal es res que
 básicamente es una lista con un solo componente. Pero si el segundo
 argumento llamado oneSize es FALSE, res es una lista de listas.

 Lo que he escrito hasta el momento es lo siguiente:

 anthr - function(res, oneSize, nsizes){
   UseMethod(anthr)
 }

 anthr.tri - function(res, oneSize, nsizes){

   if(oneSize){
 cases - c()
 cases - res$meds
   }else{
 cases - list()
 for (i in 1 : (nsizes - 1)){
   cases[[i]] - res[[i]]$meds
 }
   }
   return(cases)
 }

 El problema cuando instalo el paquete y utilizo este método, es que R no
 me reconoce que res sea una lista. En concreto, me aparece este error:

 Error in UseMethod(anthr) :
   no applicable method for 'anthr' applied to an object of class list

 He tratado de añadir esto:

 tri - function(x){
  value - list(meds = x$meds)
  attr(value, class) - tri
  value
 }

 pero sigue sin funcionarme. ¿Alguien puede ofrecerme alguna ayuda?.

 Muchas gracias de antemano.

 Un saludo,

 Guillermo

 ___
 R-help-es mailing list
 R-help-es@r-project.org
 https://stat.ethz.ch/mailman/listinfo/r-help-es

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] how to install and use Rcplex package

2015-07-24 Thread Yasin Gocgun
Hi,

Thanks for your email. When I use that line, I received the following
messages from R:

package ‘Rcplex’ is available as a source package but not as a binary

package ‘Rcplex’ is not available (for R version 3.1.1)

So, do you see what the problem is?

Thank you,

Yasin

On Fri, Jul 24, 2015 at 4:04 PM, Rui Barradas ruipbarra...@sapo.pt wrote:
 Hello,

 Try

 install.packages(Rcplex)

 That's it.

 Hope this helps,

 Rui Barradas

 Em 24-07-2015 12:20, Yasin Gocgun escreveu:

 Hi,

 I need to know how to completely install Rcplex to be able to use
 cplex in R. According to the instructions given in the following
 webpage, I edited the Makevars.win file:

 https://cran.r-project.org/web/packages/Rcplex/INSTALL

 The revised Makevars.win file includes only the following lines:

 PKG_CPPFLAGS=-I/C:/ilog/CPLEX_Studio122/include

 PKG_LIBS=-L/C:/ilog/CPLEX_Studio122/cplex/lib/x64_windows_vs2008/stat_mda-lcplex122
 -lm

 First, I am not sure whether the above lines are completely correct.
 Second, I don'y know what is the next step in installing and using
 Rcplex. So can someone help me about this issue?

 Thank you in advance,





-- 
Yasin Gocgun

__
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] R GUI plot by color

2015-07-24 Thread jpara3
Yes, you were right!! 

Thanks.




--
View this message in context: 
http://r.789695.n4.nabble.com/R-GUI-plot-by-color-tp4710297p4710320.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] Infinite Series

2015-07-24 Thread Bert Gunter
Janh:

It sounds like you really need to go through an R tutorial or two
before posting further, as this is a pretty basic query. Or am I wrong
about this?

An answer: Just use indexing

cumsum(1/seq_len(100)^2)[seq(10, to = 100,by = 10)] ## keeps every 10th

 [1] 1.549768 1.596163 1.612150 1.620244 1.625133 1.628406 1.630750
1.632512 1.633884
[10] 1.634984


But beware FAQ 7.31 for long series.

Cheers,
Bert


Bert Gunter

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


On Fri, Jul 24, 2015 at 4:37 PM, Janh Anni annij...@gmail.com wrote:
 Hello Jeff,

 Thanks a lot.  I tried it and see that it prints out the entire 100 partial
 sums, so I can take the last value as the partial sum for the first 100
 terms. Would there be any way cumsum can print only the nth partial sum,
 i.e. the last value in the array, instead of printing the entire array?
 Thanks again.

 Joseph

 On Fri, Jul 24, 2015 at 2:02 PM, Jeff Newmiller jdnew...@dcn.davis.ca.us
 wrote:

 Please reply-all so the mailing list stays in the loop.

 cumsum(1/(1:100)^2)

 gives you the partial sums up through i=100.
 ---
 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 July 24, 2015 10:30:09 AM PDT, Janh Anni annij...@gmail.com wrote:
 Hello Jeff,
 
 Thank you so much for the suggestion,  I searched cumsum as suggested
 but
 not sure it is what I had in mind.  For instance if I had the infinite
 series:[image: Inline image 1]
 
 and want to compute the sum of the, say, first 100 terms, how could I
 use
 cusum to do that?
 
 Thanks again,
 
 Janh
 
 
 On Thu, Jul 23, 2015 at 11:51 PM, Jeff Newmiller
 jdnew...@dcn.davis.ca.us
 wrote:
 
  ?cumsum
 

 ---
  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 July 23, 2015 8:23:39 PM PDT, Janh Anni annij...@gmail.com
 wrote:
  Dear All,
  
  Does anyone know of any R functions that compute partial sums of
  series?
  
  Thanks in advance!
  
  Janh
  
 [[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.

__
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 in if (abs(x - oldx) ftol)” when using “lognormal” distribution in mixed logit

2015-07-24 Thread Henric Winell

Den 2015-07-24 kl. 00:33, skrev Dera:


Hi, I have a question about how to use the mlogit package in R to do analysis
of discrete choice survey data. Our survey is about asking people to choose
from different insurance policies(with two attributes of deductible and
premium).

The code I used to fit mixed logit is:


[1] ml - mlogit.data (mydata, choice=choice, shape = wide, id =
individual,
opposite =c ('deductible', 'premium'),varying = 5:10)

[2] ml.w5 - mlogit (choice~deductible+premium|0, ml, panel = TRUE,
  rpar = c(deductible='ln', premium='ln'),
  R = 100, halton = NA, print.level=0)

I try to use lognormal because we hope the coefficients for both deductible
and premium are negative. And I use opposite in [1] to reverse the sign
because lognormal is always positive.

But I always get the error warning:

Error in if (abs(x - oldx)  ftol) { : missing value where TRUE/FALSE
needed
In addition: Warning message: In log(start[ln]) : NaNs produced
I double check the data and am sure there isn't any missing data. And if I
change the lognormal ln to n or cn, it will work without any warning.

Does anyone know how to deal with this? Thank you for your help.


I've never used the 'mlogit' package but that error message has likely 
nothing to do with missingness in your data.


The error message is pretty clear: for some reason 'if (abs(x - oldx)  
ftol)', which looks like a check for convergence, doesn't evaluate to 
TRUE or FALSE as expected.  Perhaps due to the warning message about 
problems with NaN in the starting values?  Have you checked your data? 
That warning message is typical for when you try to take logs of a 
negative number:


 log(-1)
[1] NaN
Warning message:
In log(-1) : NaNs produced

Unless this helps you identify the problem, we need a (preferably small) 
reproducible example demonstrating the issue to be able to provide 
further help.


BTW, have you asked the package maintainer (as per the posting guide)?


Henric Winell







--
View this message in context: 
http://r.789695.n4.nabble.com/Error-in-if-abs-x-oldx-ftol-when-using-lognormal-distribution-in-mixed-logit-tp4710284.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.


[R] building a quicksort function in rcpp

2015-07-24 Thread Martin Tully
Hi I am using RCPP to build a C++ function for quicksort called qsort.
This function is compiled and loaded through the cxxfunction in R
I am getting the message in R error: no matching function for call to
'qsort(int*)' The code is below.
It will not run for me and I was wondering if you could help?



library(Rcpp)
library(inline)


incl - 'int qsort(int xx[], int left, int right) {

int i = left,
j = right;
int tmp;
int pivot = xx[(left + right) / 2];

/* partition */
  while (i = j) {
while (xx[i]  pivot)
  i++;
while (xx[j]  pivot)
  j--;
if (i = j) {
  tmp = xx[i];
  xx[i] = xx[j];
  xx[j] = tmp;
  i++;
  j--;
}
  }

/* recursion */
  if (left  j){
qsort(xx, left, j);
  }
if (i  right){
  qsort(xx, i, right);
}

return (qsort(xx));
  }
  '

  sortCpp - cxxfunction(signature( x = integer,left = integer,
right = integer),
 body = 'IntegerVector arr(x);
 int a = asint(left);
 int b = asint(right);
return wrap(qsort(arr));',
 include = incl,
 plugin = Rcpp,
 verbose = TRUE)

[[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] Infinite Series

2015-07-24 Thread Janh Anni
Thanks Bert!

On Fri, Jul 24, 2015 at 7:57 PM, Bert Gunter bgunter.4...@gmail.com wrote:

 Janh:

 It sounds like you really need to go through an R tutorial or two
 before posting further, as this is a pretty basic query. Or am I wrong
 about this?

 An answer: Just use indexing

 cumsum(1/seq_len(100)^2)[seq(10, to = 100,by = 10)] ## keeps every 10th

  [1] 1.549768 1.596163 1.612150 1.620244 1.625133 1.628406 1.630750
 1.632512 1.633884
 [10] 1.634984


 But beware FAQ 7.31 for long series.

 Cheers,
 Bert


 Bert Gunter

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


 On Fri, Jul 24, 2015 at 4:37 PM, Janh Anni annij...@gmail.com wrote:
  Hello Jeff,
 
  Thanks a lot.  I tried it and see that it prints out the entire 100
 partial
  sums, so I can take the last value as the partial sum for the first 100
  terms. Would there be any way cumsum can print only the nth partial sum,
  i.e. the last value in the array, instead of printing the entire array?
  Thanks again.
 
  Joseph
 
  On Fri, Jul 24, 2015 at 2:02 PM, Jeff Newmiller 
 jdnew...@dcn.davis.ca.us
  wrote:
 
  Please reply-all so the mailing list stays in the loop.
 
  cumsum(1/(1:100)^2)
 
  gives you the partial sums up through i=100.
 
 ---
  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 July 24, 2015 10:30:09 AM PDT, Janh Anni annij...@gmail.com wrote:
  Hello Jeff,
  
  Thank you so much for the suggestion,  I searched cumsum as suggested
  but
  not sure it is what I had in mind.  For instance if I had the infinite
  series:[image: Inline image 1]
  
  and want to compute the sum of the, say, first 100 terms, how could I
  use
  cusum to do that?
  
  Thanks again,
  
  Janh
  
  
  On Thu, Jul 23, 2015 at 11:51 PM, Jeff Newmiller
  jdnew...@dcn.davis.ca.us
  wrote:
  
   ?cumsum
  
 
 
 ---
   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 July 23, 2015 8:23:39 PM PDT, Janh Anni annij...@gmail.com
  wrote:
   Dear All,
   
   Does anyone know of any R functions that compute partial sums of
   series?
   
   Thanks in advance!
   
   Janh
   
  [[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.


[[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] Infinite Series

2015-07-24 Thread Janh Anni
Wow! So many (simpler) ways to skin a cat.  Thanks!

On Fri, Jul 24, 2015 at 8:07 PM, David Winsemius dwinsem...@comcast.net
wrote:


 On Jul 24, 2015, at 4:37 PM, Janh Anni wrote:

  Hello Jeff,
 
  Thanks a lot.  I tried it and see that it prints out the entire 100
 partial
  sums, so I can take the last value as the partial sum for the first 100
  terms. Would there be any way cumsum can print only the nth partial sum,
  i.e. the last value in the array, instead of printing the entire array?
  Thanks again.

 Wouldn't that just mean using sum instead of cumsum?

 Can even check the error from the analytical limit.

  sum(1/(1:100)^2) - pi^2/6
 [1] -0.009950167


 
  Joseph
 
  On Fri, Jul 24, 2015 at 2:02 PM, Jeff Newmiller 
 jdnew...@dcn.davis.ca.us
  wrote:
 
  Please reply-all so the mailing list stays in the loop.
 
  cumsum(1/(1:100)^2)
 
  gives you the partial sums up through i=100.
 
 ---
  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 July 24, 2015 10:30:09 AM PDT, Janh Anni annij...@gmail.com wrote:
  Hello Jeff,
 
  Thank you so much for the suggestion,  I searched cumsum as suggested
  but
  not sure it is what I had in mind.  For instance if I had the infinite
  series:[image: Inline image 1]
 
  and want to compute the sum of the, say, first 100 terms, how could I
  use
  cusum to do that?
 
  Thanks again,
 
  Janh
 
 
  On Thu, Jul 23, 2015 at 11:51 PM, Jeff Newmiller
  jdnew...@dcn.davis.ca.us
  wrote:
 
  ?cumsum
 
 
 
 ---
  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 July 23, 2015 8:23:39 PM PDT, Janh Anni annij...@gmail.com
  wrote:
  Dear All,
 
  Does anyone know of any R functions that compute partial sums of
  series?
 
  Thanks in advance!
 
  Janh
 
   [[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.

 David Winsemius
 Alameda, CA, USA



[[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] Simulating multivariate gamma

2015-07-24 Thread Rolf Turner


On 25/07/15 07:59, gmoyeyemi wrote:


Hi, I'm having problem simulating multivariate gamma. Is there
anyone to assist in simulating multivariate gamma. I know that for
multivariate normal, we can use; mvrnorm (n, means, sigma)


For starters you have to specify exactly what you mean by multivariate 
gamma; there is not a *unique* multivariate gamma distribution.


A little bit of googling on multivariate gamma will lead you to some 
useful material.  In particular there is a reference to the copula 
package which apparently provides a means of simulating a multivariate

distribution with gamma marginals.

It is not however clear to me how one specifies the desired correlation 
structure, or what the limitations on such a structure are.  I find the 
documentation to be opaque.


Perhaps someone with knowledge and insight on this issue will chime in.

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.


[R] about R 3.2.0

2015-07-24 Thread Waqas Shafqat
Dear sir,

I am using currently R 3.1.3. But i wnat to upgrade this version to R 3.2.0
but i am feared that the libraries which i have installed may be remove?
please guide me.

thanks
-- 
Waqas Shafqat Chattha
Ph. D Scholar
Department of Plant Breeding and Genetics
University of Agriculture, Faisalabad
Pakistan

[[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] Differences in output of lme() when introducing interactions

2015-07-24 Thread John Kane
I clearly am going to have to improve my stats knowledge by reading McPhearson. 
To heck with Senn- too complicated. :)

Thanks Terry.

John Kane
Kingston ON Canada


 -Original Message-
 From: thern...@mayo.edu
 Sent: Thu, 23 Jul 2015 14:07:00 -0500
 To: r.tur...@auckland.ac.nz, thern...@mayo.edu
 Subject: Re: [R] Differences in output of lme() when introducing
 interactions
 
 The following are in parody (but like all good parody correct wrt the
 salient features).
 The musings of
 Guernsey McPhearson
 http://www.senns.demon.co.uk/wprose.html#Mixed
 http://www.senns.demon.co.uk/wprose.html#FDA
 
 
 In formal publication:
   Senn, Statistical Issues in Drug Development, second edition, Chapter
 14: Multicentre Trials
   Senn, The many modes of meta, Drug information journal, 34:535-549,
 2000.
 
 The second points out that in a meta analysis no one would ever consider
 giving both large
 and small trials equal weights, and relates that to several other bits of
 standard
 practice.  The 'equal weights' notion embedded in a fixed effects model +
 SAS type 3 is an
 isolated backwater.
 
 Terry T.
 
 PS. The Devils' Drug Development Dictionary at the same source has some
 gems. Three
 rather random choices:
 
 Bayesian - One who, vaguely expecting a horse and catching a glimpse of a
 donkey, strongly
 concludes he has seen a mule.
 
 Medical Statistician - One who won't accept that Columbus discovered
 America because he
 said he was looking for India in the trial Plan.
 
 Trend Towards Significance - An ever present help in times of trouble.
 
 
 
 On 07/22/2015 06:02 PM, Rolf Turner wrote:
 On 23/07/15 01:15, Therneau, Terry M., Ph.D. wrote:
 
 SNIP
 
 3. Should you ever use it [i.e. Type III SS]?  No.  There is a very
 strong inverse
 correlation between understand what it really is and recommend its
 use.   Stephen Senn has written very intellgently on the issues.
 
 Terry --- can you please supply an explicit citation?  Ta.
 
 cheers,
 
 Rolf
 
 
 __
 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.


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] Table Looks Funny

2015-07-24 Thread John Kane
Hi Marrisa,

As a follow-up to Jim's point,  it might be a good idea to supply the data. 
Since you don't trust the imported data our preferred method of using dput() 
won't work but if you rename the csv file to whatever.txt and attached it 
should make it through.

John Kane
Kingston ON Canada


 -Original Message-
 From: marissa.fahlb...@gmail.com
 Sent: Thu, 23 Jul 2015 16:08:10 -0500
 To: r-help@r-project.org
 Subject: [R] Table Looks Funny
 
 Hey, I can't seem to import my csv file in such a way that the table
 looks
 normal. The dimensions are correct, 4x7, and I set my header =TRUE, but
 it still looks weird. Attached is the picture. Any ideas??
 
 Thanks!!
 
 -Marissa


FREE 3D EARTH SCREENSAVER - Watch the Earth right 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.


[R] apply kendall tau to a split data set

2015-07-24 Thread SRS
$`19179222`
   Unique.IDStart.YearL1.Risk.Category  
   
Gross.amount.sum
17  19179222   2013 Execution, Delivery  Process Management
161212.1
18  19179222   2015 Execution, Delivery  Process Management
110880.0

$`25182498`
   Unique.ID   Start.YearL1.Risk.Category   

Gross.amount.sum
19  25182498   2014   Clients, Products  Business Practices
 
59384
20  25182498   2014 Execution, Delivery  Process Management  
355000
21  25182498   2015 Execution, Delivery  Process Management   
27720

$`32506027`
   Unique.IDStart.YearL1.Risk.Category  
  
Gross.amount.sum
22  32506027   2003 Execution, Delivery  Process Management   
360.0
23  32506027   2013 Execution, Delivery  Process Management
161212.1
24  32506027   2014   Clients, Products  Business Practices   
14846.0


Hi, I have split a data frame and output is as above. 

I would like to apply Kendall's tau to calculate correlations. For example,
for the last Unique.ID 32506027, I want to create a time series for each L1
risk category, and then calculate the correlation between each L1 risk
category using the Kendall tau approach. 

Any help would be much appreciated. 

Thanks
s




--
View this message in context: 
http://r.789695.n4.nabble.com/apply-kendall-tau-to-a-split-data-set-tp4710303.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] Labeling world map

2015-07-24 Thread sreenath
I draw world map using 
library(maptools)
 library(ggmap)
 library(mapdata)
 library(maps)
map(world,fill=TRUE,col=White,bg=light
blue,ylim=c(-60,90),mar=c(0,0,0,0))
native - c(brazil,sao paulo state)
 nat -geocode(native)
nat.x - nat$lon
 nat.y - nat$lat
points(nat.x,nat.y,col=yellow,pch=16)
How can i put lilte for this map and label points




--
View this message in context: 
http://r.789695.n4.nabble.com/Labeling-world-map-tp4710296.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] “Error in if (abs(x - oldx) ftol)” when using “lognormal” distribution in mixed logit

2015-07-24 Thread Dong Wang
Hi Henric,

Thank you for your reply! It really helps. I should have noticed this
earlier. I don't have a negative input, the error is because our survey
allowed people to choose neither of the choices we gave, so we added a
choice Neither with both deductible and premium being 0, which caused
this problem. I tried to delete the 0 entries just now and it worked! I
think I need to find a way do deal with the Neither choice in another way.

Thank you so much and have a nice weekend!

Best, Dong

On Fri, Jul 24, 2015 at 7:16 AM, Henric Winell nilsson.hen...@gmail.com
wrote:

 Den 2015-07-24 kl. 00:33, skrev Dera:

  Hi, I have a question about how to use the mlogit package in R to do
 analysis
 of discrete choice survey data. Our survey is about asking people to
 choose
 from different insurance policies(with two attributes of deductible and
 premium).

 The code I used to fit mixed logit is:


 [1] ml - mlogit.data (mydata, choice=choice, shape = wide, id =
 individual,
 opposite =c ('deductible', 'premium'),varying = 5:10)

 [2] ml.w5 - mlogit (choice~deductible+premium|0, ml, panel = TRUE,
   rpar = c(deductible='ln', premium='ln'),
   R = 100, halton = NA, print.level=0)

 I try to use lognormal because we hope the coefficients for both
 deductible
 and premium are negative. And I use opposite in [1] to reverse the sign
 because lognormal is always positive.

 But I always get the error warning:

 Error in if (abs(x - oldx)  ftol) { : missing value where TRUE/FALSE
 needed
 In addition: Warning message: In log(start[ln]) : NaNs produced
 I double check the data and am sure there isn't any missing data. And if I
 change the lognormal ln to n or cn, it will work without any
 warning.

 Does anyone know how to deal with this? Thank you for your help.


 I've never used the 'mlogit' package but that error message has likely
 nothing to do with missingness in your data.

 The error message is pretty clear: for some reason 'if (abs(x - oldx) 
 ftol)', which looks like a check for convergence, doesn't evaluate to TRUE
 or FALSE as expected.  Perhaps due to the warning message about problems
 with NaN in the starting values?  Have you checked your data? That warning
 message is typical for when you try to take logs of a negative number:

  log(-1)
 [1] NaN
 Warning message:
 In log(-1) : NaNs produced

 Unless this helps you identify the problem, we need a (preferably small)
 reproducible example demonstrating the issue to be able to provide further
 help.

 BTW, have you asked the package maintainer (as per the posting guide)?


 Henric Winell






 --
 View this message in context:
 http://r.789695.n4.nabble.com/Error-in-if-abs-x-oldx-ftol-when-using-lognormal-distribution-in-mixed-logit-tp4710284.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.


[R] interactive Map with option to slide through years

2015-07-24 Thread Marie-Louise
Hello,
first of all: my english is horrible but I try to explain what I want to
say.

I am new to R and thank to your help I managed to create an interactive map
of Germany for some weather data. I used 

States = data.frame(Datensatz)
require(googleVis)
G4 = gvisGeoChart(States, 
  locationvar = ISO, 
  colorvar = Hoechsttemperatur, hovervar = name,
options=list(
  width=800, height=600, region=DE, 
displayMode=regions, 
  resolution=provinces, colorAxis={colors:
['yellow','red']}))
plot(G4)  
plot(G4, 'chart')

for the map. Now I would like to create a map that shows the data for
different years. I would like to do something like this:
http://r.789695.n4.nabble.com/file/n4710322/Bildschirmfoto_2015-07-24_um_23.png
 
Is there an easy possibility (I am really really new to R) to do so? Again,
I am very sorry for my bad english.

Thank you very very much,
Marie-Louise



--
View this message in context: 
http://r.789695.n4.nabble.com/interactive-Map-with-option-to-slide-through-years-tp4710322.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] Infinite Series

2015-07-24 Thread Don McKenzie
cumsum(1/(1:100)^2)[100]


 On Jul 24, 2015, at 4:37 PM, Janh Anni annij...@gmail.com wrote:
 
 Hello Jeff,
 
 Thanks a lot.  I tried it and see that it prints out the entire 100 partial
 sums, so I can take the last value as the partial sum for the first 100
 terms. Would there be any way cumsum can print only the nth partial sum,
 i.e. the last value in the array, instead of printing the entire array?
 Thanks again.
 
 Joseph
 
 On Fri, Jul 24, 2015 at 2:02 PM, Jeff Newmiller jdnew...@dcn.davis.ca.us
 wrote:
 
 Please reply-all so the mailing list stays in the loop.
 
 cumsum(1/(1:100)^2)
 
 gives you the partial sums up through i=100.
 ---
 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 July 24, 2015 10:30:09 AM PDT, Janh Anni annij...@gmail.com wrote:
 Hello Jeff,
 
 Thank you so much for the suggestion,  I searched cumsum as suggested
 but
 not sure it is what I had in mind.  For instance if I had the infinite
 series:[image: Inline image 1]
 
 and want to compute the sum of the, say, first 100 terms, how could I
 use
 cusum to do that?
 
 Thanks again,
 
 Janh
 
 
 On Thu, Jul 23, 2015 at 11:51 PM, Jeff Newmiller
 jdnew...@dcn.davis.ca.us
 wrote:
 
 ?cumsum
 
 
 ---
 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 July 23, 2015 8:23:39 PM PDT, Janh Anni annij...@gmail.com
 wrote:
 Dear All,
 
 Does anyone know of any R functions that compute partial sums of
 series?
 
 Thanks in advance!
 
 Janh
 
  [[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.



__
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] Infinite Series

2015-07-24 Thread David Winsemius

On Jul 24, 2015, at 4:37 PM, Janh Anni wrote:

 Hello Jeff,
 
 Thanks a lot.  I tried it and see that it prints out the entire 100 partial
 sums, so I can take the last value as the partial sum for the first 100
 terms. Would there be any way cumsum can print only the nth partial sum,
 i.e. the last value in the array, instead of printing the entire array?
 Thanks again.

Wouldn't that just mean using sum instead of cumsum?

Can even check the error from the analytical limit.

 sum(1/(1:100)^2) - pi^2/6
[1] -0.009950167


 
 Joseph
 
 On Fri, Jul 24, 2015 at 2:02 PM, Jeff Newmiller jdnew...@dcn.davis.ca.us
 wrote:
 
 Please reply-all so the mailing list stays in the loop.
 
 cumsum(1/(1:100)^2)
 
 gives you the partial sums up through i=100.
 ---
 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 July 24, 2015 10:30:09 AM PDT, Janh Anni annij...@gmail.com wrote:
 Hello Jeff,
 
 Thank you so much for the suggestion,  I searched cumsum as suggested
 but
 not sure it is what I had in mind.  For instance if I had the infinite
 series:[image: Inline image 1]
 
 and want to compute the sum of the, say, first 100 terms, how could I
 use
 cusum to do that?
 
 Thanks again,
 
 Janh
 
 
 On Thu, Jul 23, 2015 at 11:51 PM, Jeff Newmiller
 jdnew...@dcn.davis.ca.us
 wrote:
 
 ?cumsum
 
 
 ---
 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 July 23, 2015 8:23:39 PM PDT, Janh Anni annij...@gmail.com
 wrote:
 Dear All,
 
 Does anyone know of any R functions that compute partial sums of
 series?
 
 Thanks in advance!
 
 Janh
 
  [[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.

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.


[R] P value from jaccard's index matrix

2015-07-24 Thread sreenath
My table having 40 raw and 4 columns, in that 4 columns first column belongs
to one group and the remaining constitute the other group. using following
commands for calculating jaccard's index
x - read.csv(file name,header=T, sep= ) 
jac - vegdist(x,method=jaccard) 
from this out file(jac) how can i find the p value for two groups ? and how
can i plot notched box plot of these two groups? when i use boxes
(as.matrix(jac)~x$first column,notch=TRUE) it showing 40 box plots.why it
so?




--
View this message in context: 
http://r.789695.n4.nabble.com/P-value-from-jaccard-s-index-matrix-tp4710302.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] interactive Map: Popups

2015-07-24 Thread Marie-Louise
You guys are awesome thank you all very very much!



--
View this message in context: 
http://r.789695.n4.nabble.com/interactive-Map-Popups-tp4710226p4710295.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] How to calculate the average direct effect, average total effect and average indirect effect for spatial regression models with spatial lag of dependent variable

2015-07-24 Thread wenyueyang
Dear Linus Holtermann,

thank a lot for telling me the key to calculate the effects. I will try it.
thank you for your help!

best regards,

Wenyue Yang





--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-calculate-the-average-direct-effect-average-total-effect-and-average-indirect-effect-for-spate-tp4710253p4710315.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] Simulating multivariate gamma

2015-07-24 Thread gmoyeyemi
Hi,
I'm having problem simulating multivariate gamma. Is there anyone to assist in 
simulating multivariate gamma.
I know that for multivariate normal, we can use;
mvrnorm (n, means, sigma)

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