Re: [R] [R-sig-ME] different results from lme and lmer function

2015-05-26 Thread Ben Bolker
  These actually aren't terribly different from each other.  I suspect
that lmer is slightly closer to the correct answer, because lme
reports a log-likelihood (really -1/2 times the REML criterion) of
49.30021, while lmer reports a REML criterion of  -98.8 - slightly
better fit at -R/2 = 49.4.  The residual sds are 0.0447 (lme) vs.
0.0442 (lmer); the intercept sd estimate is 0.016 vs 0.0089,
admittedly a bit low, and both month sds are very small.  lmer
indicates a singular fit (correlation of -1).If you look at the
confidence intervals on these estimates (confint(fitted_model) in
lme4; intervals(fitted_model) in lme) I think you'll find that the
confidence intervals are much wider than these differences (you may
even find that lme reports that it can't give you the intervals
because the Hessian [curvature] matrix is not positive definite).

  Both should be comparable to SAS PROC MIXED results, I think, if
you get the syntax right ...

On Tue, May 26, 2015 at 7:09 PM, li li hannah@gmail.com wrote:
 Hi all,
   I am fitting a random slope and random intercept model using R. I
 used both lme and lmer funciton for the same model. However I got
 different results as shown below (different variance component
 estimates and so on). I think that is really confusing. They should
 produce close results. Anyone has any thoughts or suggestions. Also,
 which one should be comparable to sas results?
  Thanks!
   Hanna

 ## using lme function
 mod_lme - lme(ti  ~ type*months, random=~ 1+months|lot, na.action=na.omit,
 + data=one, control = lmeControl(opt = optim))
 summary(mod_lme)
 Linear mixed-effects model fit by REML
  Data: one
 AIC   BIC   logLik
   -82.60042 -70.15763 49.30021

 Random effects:
  Formula: ~1 + months | lot
  Structure: General positive-definite, Log-Cholesky parametrization
 StdDev   Corr
 (Intercept) 8.907584e-03 (Intr)
 months  6.039781e-05 -0.096
 Residual4.471243e-02

 Fixed effects: ti ~ type * months
  Value   Std.Error DF   t-value p-value
 (Intercept) 0.25831245 0.016891587 31 15.292373  0.
 type0.13502089 0.026676101  4  5.061493  0.0072
 months  0.00804790 0.001218941 31  6.602368  0.
 type:months -0.00693679 0.002981859 31 -2.326329  0.0267
  Correlation:
(Intr) typPPQ months
 type   -0.633
 months -0.785  0.497
 type:months  0.321 -0.762 -0.409

 Standardized Within-Group Residuals:
   MinQ1   MedQ3   Max
 -2.162856e+00 -1.962972e-01 -2.771184e-05  3.749035e-01  2.088392e+00

 Number of Observations: 39
 Number of Groups: 6




 ###Using lmer function
 mod_lmer -lmer(ti  ~ type*months+(1+months|lot), na.action=na.omit, 
 data=one)
 summary(mod_lmer)
 Linear mixed model fit by REML t-tests use Satterthwaite approximations to
   degrees of freedom [merModLmerTest]
 Formula: ti ~ type * months + (1 + months | lot)
Data: one

 REML criterion at convergence: -98.8

 Scaled residuals:
 Min  1Q  Median  3Q Max
 -2.1347 -0.2156 -0.0067  0.3615  2.0840

 Random effects:
  Groups   NameVariance  Std.Dev.  Corr
  lot  (Intercept) 2.870e-04 0.0169424
   months  4.135e-07 0.0006431 -1.00
  Residual 1.950e-03 0.0441644
 Number of obs: 39, groups:  lot, 6

 Fixed effects:
 Estimate Std. Errordf t value Pr(|t|)
 (Intercept) 0.258312   0.018661  4.82  13.842 4.59e-05 ***
 type 0.135021   0.028880  6.802000   4.675  0.00245 **
 months  0.008048   0.001259 11.943000   6.390 3.53e-05 ***
 type:months -0.006937   0.002991 28.91  -2.319  0.02767 *
 ---
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

 Correlation of Fixed Effects:
 (Intr) typPPQ months
 type -0.646
 months  -0.825  0.533
 type:month  0.347 -0.768 -0.421

 ___
 r-sig-mixed-mod...@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

__
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] lme function to obtain pvalue for fixed effect

2015-05-26 Thread Ben Bolker
li li hannah.hlx at gmail.com writes:

 
 Hi all,
   I am using the lme function to run a random coefficient model.
 Please see
 output (mod1) as below.

  Please don't cross-post to different R lists (this is explicitly
deprecated by the list policy: http://www.r-project.org/mail.html, 
cross-posting is considered to be impolite).  r-sig-mixed-models
seems to be more appropriate for these questions.

  sincerely
Ben Bolker

__
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-sig-ME] different results from lme and lmer function

2015-05-26 Thread John Sorkin
Ben,
I doubt the very small difference in log likelihood gives much, if any
information about which model is a better fit. Even if we overlook the
limited precision of the estimate of the REML criterion, the difference
is so small as to me of minimal importance.
John

 John David Sorkin M.D., Ph.D.
 Professor of Medicine
 Chief, Biostatistics and Informatics
 University of Maryland School of Medicine Division of Gerontology and
Geriatric Medicine
 Baltimore VA Medical Center
 10 North Greene Street
 GRECC (BT/18/GR)
 Baltimore, MD 21201-1524
 (Phone) 410-605-7119
 (Fax) 410-605-7913 (Please call phone number above prior to faxing)


 On May 26, 2015, at 8:03 PM, Ben Bolker bbol...@gmail.com wrote:
 
  These actually aren't terribly different from each other.  I suspect
 that lmer is slightly closer to the correct answer, because lme
 reports a log-likelihood (really -1/2 times the REML criterion) of
 49.30021, while lmer reports a REML criterion of  -98.8 - slightly
 better fit at -R/2 = 49.4.  The residual sds are 0.0447 (lme) vs.
 0.0442 (lmer); the intercept sd estimate is 0.016 vs 0.0089,
 admittedly a bit low, and both month sds are very small.  lmer
 indicates a singular fit (correlation of -1).If you look at the
 confidence intervals on these estimates (confint(fitted_model) in
 lme4; intervals(fitted_model) in lme) I think you'll find that the
 confidence intervals are much wider than these differences (you may
 even find that lme reports that it can't give you the intervals
 because the Hessian [curvature] matrix is not positive definite).
 
  Both should be comparable to SAS PROC MIXED results, I think, if
 you get the syntax right ...
 
 On Tue, May 26, 2015 at 7:09 PM, li li hannah@gmail.com wrote:
 Hi all,
  I am fitting a random slope and random intercept model using R. I
 used both lme and lmer funciton for the same model. However I got
 different results as shown below (different variance component
 estimates and so on). I think that is really confusing. They should
 produce close results. Anyone has any thoughts or suggestions. Also,
 which one should be comparable to sas results?
 Thanks!
  Hanna
 
 ## using lme function
 mod_lme - lme(ti  ~ type*months, random=~ 1+months|lot,
na.action=na.omit,
 + data=one, control = lmeControl(opt = optim))
 summary(mod_lme)
 Linear mixed-effects model fit by REML
 Data: one
AIC   BIC   logLik
  -82.60042 -70.15763 49.30021
 
 Random effects:
 Formula: ~1 + months | lot
 Structure: General positive-definite, Log-Cholesky parametrization
StdDev   Corr
 (Intercept) 8.907584e-03 (Intr)
 months  6.039781e-05 -0.096
 Residual4.471243e-02
 
 Fixed effects: ti ~ type * months
 Value   Std.Error DF   t-value p-value
 (Intercept) 0.25831245 0.016891587 31 15.292373  0.
 type0.13502089 0.026676101  4  5.061493  0.0072
 months  0.00804790 0.001218941 31  6.602368  0.
 type:months -0.00693679 0.002981859 31 -2.326329  0.0267
 Correlation:
   (Intr) typPPQ months
 type   -0.633
 months -0.785  0.497
 type:months  0.321 -0.762 -0.409
 
 Standardized Within-Group Residuals:
  MinQ1   MedQ3   Max
 -2.162856e+00 -1.962972e-01 -2.771184e-05  3.749035e-01  2.088392e+00
 
 Number of Observations: 39
 Number of Groups: 6
 
 
 
 
 ###Using lmer function
 mod_lmer -lmer(ti  ~ type*months+(1+months|lot), na.action=na.omit,
data=one)
 summary(mod_lmer)
 Linear mixed model fit by REML t-tests use Satterthwaite
approximations to
  degrees of freedom [merModLmerTest]
 Formula: ti ~ type * months + (1 + months | lot)
   Data: one
 
 REML criterion at convergence: -98.8
 
 Scaled residuals:
Min  1Q  Median  3Q Max
 -2.1347 -0.2156 -0.0067  0. lot  (Intercept) 2.870e-04 0.0169424
  months  4.135e-07 0.0006431 -1.00
 Residual 1.950e-03 0.0441644
 Number of obs: 39, groups:  lot, 6
 
 Fixed effects:
Estimate Std. Errordf t value Pr(|t|)
 (Intercept) 0.258312   0.018661  4.82  13.842 4.59e-05 ***
 type 0.135021   0.028880  6.802000   4.675  0.00245 **
 months  0.008048   0.001259 11.943000   6.390 3.53e-05 ***
 type:months -0.006937   0.002991 28.91  -2.319  0.02767 *
 ---
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
 
 Correlation of Fixed Effects:
(Intr) typPPQ months
 type -0.646
 months  -0.825  0.533
 type:month  0.347 -0.768 -0.421
 
 ___
 r-sig-mixed-mod...@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
 
 __
 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, 

[R] Find and replace backslashes XXXX

2015-05-26 Thread Dan Abner
Hi all,

I realize that the backslash is an escape character in R, therefore, I
am trying to replace it with a forward slash. Can someone please
suggest how to get this code to work?

 lib-gsub(\,/,X:\Classes\TT\Automation)
Error: unexpected symbol in lib-gsub(\,/,X


Thanks,

Dan

__
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] Find and replace backslashes XXXX

2015-05-26 Thread Ista Zahn
Escape the backslash with another backslash, i.e.,

gsub(\\,/,X:\\Classes\\TT\\Automation, fixed = TRUE)

best,
Ista

On Tue, May 26, 2015 at 9:30 PM, Dan Abner dan.abne...@gmail.com wrote:
 Hi all,

 I realize that the backslash is an escape character in R, therefore, I
 am trying to replace it with a forward slash. Can someone please
 suggest how to get this code to work?

 lib-gsub(\,/,X:\Classes\TT\Automation)
 Error: unexpected symbol in lib-gsub(\,/,X


 Thanks,

 Dan

 __
 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] nls model singular gradient matrix at initial parameter estimates

2015-05-26 Thread oussama belmejdoub
Greetings,
I'm trying to use the nls function in my statistics project but I'm really 
finding lot of difficulties.
I have a function called apinene_modele_prediction that calculates the 
estimations:
library(expm); #exp of a matrixapinene_modele_prediction - function(t,theta) { 
x0=c(100,0,0,0,0)   
A=matrix(c(-(theta[1]+theta[2]),theta[1],theta[2],0,0,0,0,0,0,0,0,0,-(theta[3]+theta[4]),theta[3],theta[4],0,0,0,0,0,0,0,theta[5],0,-theta[5]),5,5)
 X=x0for (i in t[2:length(t)]){  X=c(X,x0%*%expm(A*i))  
 }return(X)}

My t vector is given by: 
t=seq(0,100,by=2) 
And the real observations y ara given to us  in a txt file called data.txt 
that I have joined to this message.
So when I try to fit the theta in my model starting with: 
theta=c(0.2,0.2,0.2,0.2,0.2) 
And doing:
theta_appr 
-nls(y~apinene_modele_prediction(t,theta),start=list(theta=c(0.2,0.2,0.2,0.2,0.2)))
I always got the ERROR : singular gradient matrix at initial parameter estimates
And, when I try: 
nls(y~apinene_modele_prediction(t,c(theta,theta,theta,theta,theta)),start=list(theta=0.2))
I got the result: Nonlinear regression model  model: y ~ 
apinene_modele_prediction(t, c(theta, theta, theta, theta, theta))   data: 
parent.frame()  theta0.04403 residual sum-of-squares: 219002
But I need to have the elements of the theta to be different and not equal.
Thanks in advance for your help.  y
99.9232
5.7485
0.6644
-0.4988
0.5019
83.3796
16.0905
3.4184
-0.1619
4.3231
67.6461
17.6714
6.1861
0.4555
3.4022
58.3199
24.0947
7.009
1.3153
7.0712
47.587
35.4656
6.4072
0.715
9.0156
42.3778
34.0976
6.0112
1.0316
14.0637
34.4176
38.188
6.0135
0.8093
14.7598
29.2941
56.7453
5.7462
1.24
15.5634
24.2075
49.4543
4.8968
1.3849
21.834
21.2213
51.3734
5.2268
1.7867
19.4716
18.9238
55.3147
4.5223
2.6202
22.053
13.9119
65.6723
4.4736
2.4025
20.5307
14.0519
64.1892
4.3354
2.6657
23.0909
9.6691
62.9989
4.8074
3.1438
20.2343
8.018
59.7792
3.9934
2.7481
23.0476
7.6965
58.3577
3.6449
3.8192
25.8571
5.7062
54.7404
4.2607
3.1089
25.4888
5.6596
58.5899
3.6794
3.541
25.3896
5.4871
65.4693
3.6679
3.5918
25.7453
2.5278
70.9596
3.933
3.8858
22.8982
5.3682
74.6359
3.7192
4.1048
25.37
3.159
66.7303
3.3373
4.0423
25.6204
-0.3612
72.2608
3.9413
4.9181
22.8085
3.1431
68.0772
3.5597
4.5132
22.3135
0.7453
66.8462
3.9621
4.1373
25.5405
0.8502
63.7415
3.8063
4.9193
24.9146
1.4089
71.1166
3.7259
4.2357
21.76
1.7045
71.7744
3.3515
4.899
23.7245
0.6204
61.9383
3.8477
5.561
22.3485
0.3335
63.1572
3.3009
5.7315
26.3752
1.6638
62.4002
3.1931
5.2699
23.3077
1.7851
66.0386
3.3138
5.79
25.2986
0.3481
61.4702
3.3343
5.6509
22.9967
0.088
59.5469
3.2485
5.9959
21.0902
-0.9691
70.1917
3.3433
5.8771
27.0169
-0.1861
66.933
3.1346
6.0566
20.7277
1.1325
74.0641
3.7472
6.0475
22.177
1.7875
61.0552
3.1733
5.8029
18.2692
-0.6303
69.7692
3.3849
6.6513
22.7722
0.8757
62.7373
2.7142
6.6476
20.6708
-0.5705
61.1083
3.4895
6.077
23.3414
-0.3324
69.8406
3.1186
6.6764
22.7215
0.2536
63.2522
3.2815
7.3864
21.1594
-1.1912
65.0752
3.2217
5.9924
23.3834
0.3408
68.4797
2.7571
6.9196
21.9287
0.6937
75.7468
3.6325
7.5853
21.6415
1.6548
70.4596
2.7858
6.9878
25.7793
-0.2572
73.3611
3.0593
7.6976
21.6229
1.5903
72.4284
2.8289
8.1584
25.5773
-0.5075
63.7588
3.3313
8.1676
23.3128
-0.836
71.0337
3.1666
7.638
20.2517
__
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] Retrieving data from nested lists

2015-05-26 Thread blue honour via R-help
Dear R users,
I have a question regarding retrieving data from nested lists. To illustrate, 
here is an example input:
d1-data.table(v1=c(3,4),v2=c(2,5))
d2-data.table(v1=c(1,2),v2=c(1,1))l1-list(d1,name=test)l2-list(d2,name=test2)motherlist-list()motherlist$l1-l1motherlist$l2-l2
Let's say we are given motherlist as above. We would like to get the union of 
the contents of v1 vector from d1 data.table and the v1 vector from d2 
data.table. How can we achieve this in a compact one line command using 
motherlist as input please? 
Thank you. 



[[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] Problem merging data frames and duplicates

2015-05-26 Thread Frank Burbrink
Hello All,

I am attempting to merge two data frames that naturally contain duplicate
entries, however when using either merge or dMerge I get even more
duplicates.

For example:

data.frame(state=c(IL, IL, LA,LA, MS,MS, AR, AR),
locus=c(1,1,2,2,3,4,5,6))-x

data.frame(state=c(IL, IL, AR, AR, TN,TN),
locus=c(1,1,2,3,3,4,4))-y

These yield:

 x
  state locus
1IL 1
2IL 1
3LA 2
4LA 2
5MS 3
6MS 4
7AR 5
8AR 6

y
  state locus
1IL 1
2IL 1
3AR 2
4AR 3
5TN 3
6TN 4

However, when merged by state: they produce another second set of AR and
IL:
merge(x,y,by=1,all=T)-z

   state locus.x locus.y
1 AR   5   2
2 AR   5   3
3 AR   6   2
4 AR   6   3
5 IL   1   1
6 IL   1   1
7 IL   1   1
8 IL   1   1
9 LA   2  NA
10LA   2  NA
11MS   3  NA
12MS   4  NA
13TN  NA   3
14TN  NA   4

While, the NAs are desired when states are missing, I don't want the extra
duplicated states and values but rather:

   state locus.x locus.y
1 AR   5   2
4 AR   6   3
7 IL   1   1
8 IL   1   1
9 LA   2  NA
10LA   2  NA
11MS   3  NA
12MS   4  NA
13TN  NA   3
14TN  NA   4

Any help would be much appreciated.

Thanks!

Frank

-- 

*
*Frank T. Burbrink, Ph.D.*
*Professor*
*Biology Department*
*6S-143*
*2800 Victory Blvd.*
*College of Staten Island/CUNY*
*Staten Island, New York 10314*
*E-Mail:frank.burbr...@csi.cuny.edu e-mail%3afrank.burbr...@csi.cuny.edu*
*Phone:718-982-3961*
*Web Page: http://scholar.library.csi.cuny.edu/~fburbrink/
http://scholar.library.csi.cuny.edu/%7Efburbrink/*
*
*Chair *
*Ecology, Evolutionary Biology, and Behavior*
*Doctoral Subprogram*
*Biology Program*
*City University of New York *
*Graduate Center*
*365 Fifth Avenue*
*New York, NY 10016-4309*


[[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] Problem with comparing multiple data sets

2015-05-26 Thread Mohammad Alimohammadi
Thank you John. Yes. as you mentioned this is not really what I am looking
for.

It's interesting because I was really thinking that it should be pretty
easy. All I need to do is just compare class1, class2 and class3 for each
text and put the most frequent number next to it in each row. Repeat it for
all the rows. Apparently it's not that simple.

Sorry I didn't notice that I sent it only to you! Thanks for letting me
know.

I appreciate if anybody can help on this.

Thank you.




On Tue, May 26, 2015 at 7:27 PM, John Kane jrkrid...@inbox.com wrote:

 Hi Mohammad,

 The data came through beautifully despite the fact that you posted in
 HTML.  Please, post in plain text.

 Oh, just as I was ready to push Send, I  noticed you only replied to me.
 You really should reply to the R-help list since there are a lot more and
 better people to help there. Besides it's a world-wide list. Others can
 play with the problem while we sleep :) .

 I will just reply to you but I really suggest sending all of this to the
 list.

 Now I am wondering what to do with the data. As a first swipe I just added
 up all the values in each class by each text value. Results are below. Not
 what you want by any means but perhaps a small step.

 Then I started to think are we really interested in the sum or should we
 be looking at incidence, that is should we be looking at the frequency
 rather than the sum?

 Is
 class.1 class.2   class  #dac
   0   2  0

 a value of 2 (sum) or a hit of 1 (count or freq) ?

 Anyway below is what I have tried so far -- it may not be anywhere near
 what you want but if it makes any sense then I think we just need to pick
 off the highest values for each combination of terms and class to give you
 what you want.

 I suspect our real data-munging gurus can do  all this faster and better
 than I can but hopefully it is a start.

 Where your data set is dat1
 #=
 # If reshape2 is not installed.
 install.packages(reshape2)
 #=

 library(reshape2)
  mdat  -  melt(dat1, id.vars= c(terms),
variable.name = class,
value.name = value,
na.rm = FALSE)

 mdat1  -  aggregate(value ~ terms + class, data = mdat, sum)

 mdat1[order(mdat1$terms, mdat1$class), ]

 #=


 John Kane
 Kingston ON Canada

 -Original Message-
 From: mxalimoha...@ualr.edu
 Sent: Tue, 26 May 2015 09:50:43 -0500
 To: jrkrid...@inbox.com
 Subject: Re: [R] Problem with comparing multiple data sets

 Thank you John for being patient with me.

 My original post was to compare 3 sets of data which had difference in
 their class value for the same text. However, I thought it might be easier
 to combine those 3 data sets into one that shows the 3 different classes
 and then find the most frequent class value for the text. So that's what I
 did. Now I only want to add the most frequent class value in a new column.

 I tried to create a dput version of the data set (Only a small part of it)
 so you can see. I hope it works.

  Tweet1- read.csv(file=part1_complete.csv,head=TRUE,sep= ,)

  dput(head(Tweet1, 100))

 structure(list(class.1 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,

 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,

 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 2L, 1L, 1L, 1L,

 1L, 2L, 2L, 1L, 1L, 2L, 1L, 2L, 0L, 1L, 2L, 2L, 2L, 1L, 1L, 1L,

 1L, 2L, 1L, 1L, 1L, 0L, 2L, 2L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L,

 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,

 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L, 2L), class.2 = c(2L,

 2L, 2L, 2L, 0L, 0L, 2L, 0L, 0L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,

 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,

 2L, 0L, 2L, 2L, 2L, 1L, 1L, 2L, 2L, 0L, 0L, 0L, 0L, 1L, 1L, 1L,

 0L, 1L, 1L, 1L, 0L, 1L, 1L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 0L,

 1L, 0L, 0L, 1L, 0L, 0L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L,

 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,

 1L, 1L, 1L), class.3 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,

 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,

 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 2L, 1L, 1L, 1L,

 1L, 0L, 0L, 0L, 0L, 2L, 1L, 2L, 0L, 2L, 2L, 0L, 2L, 1L, 1L, 1L,

 1L, 0L, 0L, 0L, 2L, 1L, 0L, 0L, 1L, 0L, 0L, 2L, 2L, 2L, 2L, 2L,

 0L, 2L, 2L, 1L, 0L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L,

 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L), terms = structure(c(9L,

 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L,

 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L,

 9L, 9L, 9L, 9L, 69L, 69L, 69L, 69L, 69L, 40L, 40L, 40L, 40L,

 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 98L, 98L, 98L, 98L, 98L,

 98L, 98L, 98L, 98L, 98L, 98L, 98L, 98L, 98L, 23L, 87L, 87L, 87L,

 87L, 87L, 87L, 87L, 87L, 87L, 87L, 87L, 87L, 87L, 87L, 87L, 87L,

 87L, 87L, 87L, 87L, 87L, 87L, 87L, 87L, 87L, 87L, 87L, 87L, 87L,

 87L, 87L), .Label = 

[R] X11 font problem

2015-05-26 Thread Renato Rivera
Hi I have this problem and do not know how to solve it, I'm new to R

R version 2.15.0 (2012-03-30)
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-unknown-linux-gnu (64-bit)

x11 font -adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*, face 1 at size 16 could 
not be loaded   
[[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] Path analysis

2015-05-26 Thread Alberto Canarini
Hi there,

As I'm approaching path analysis I was wondering which packages may suite a 
path analysis for my data. My data are on interaction of soil biotic and 
abiotic factor, like microbial biomass carbon, soil carbon, water content, 
temperature etc.

Thanks in advance,

Best regards.

Alberto

Alberto Canarini
PhD Student l Faculty of Agriculture and Environment
THE UNIVERSITY OF SYDNEY
Shared room l CCWF l Camden Campus l NSW 2570
P 02 935 11892


[[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] How to pass a variable to a function which use variable name as a parameter

2015-05-26 Thread wong jane
There are functions which use variable names as parameters in some R
packages. However, if the variable name is stored in another variable, how
can I pass this variable to the function. Taking the rms package as an
example:

library(rms)
n - 1000
age - rnorm(n, 50, 10)
sex - factor(sample(c('female','male'), n,TRUE))

y - rnorm(n, 200, 25)
ddist - datadist(age, sex)
options(datadist='ddist')
fit - lrm(y ~ age)
Predict(fit, age, np=4)
options(datadist=NULL)

Here age was a variable name passed to Predict() function, but if age
was stored in variable var, that is, var - age, how can I pass var
to Predict() function? The purpose is that I want to change the parameter
of Predict()  in a loop.

[[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] png package in Ubuntu 12.04 with R 3.1.0

2015-05-26 Thread Gygli, Gudrun

Dear All,


I am using R to analyse computer simulations of ligand docking in a protein.

I am plotting the results as scatterplots and bopxplots, using the code below.

This works perfectly fine.


I would like now to add a png file to that plot, meaning I want sth like:


png(file=analysis.png)
par(mfrow=c(1,3), oma=c(0,0,2,0))

plot

boxplot

PNG figure I read in


I am running Ubuntu 12.04 and R 3.1.0.


readPNG and the png packge do NOT work for me at this point.


when I try to install the png package I get the error below.


Any ideas what's wrong or other options to import png files?


Thank you in advance for the help.


Best regards


Gudrun



png(file=analysis.png)
par(mfrow=c(1,2), oma=c(0,0,2,0))
plot(data, main=all, xlab=simulations run, ylab=steps)
boxplot(data, main=steps, horizontal = FALSE, axes = FALSE, staplewex = 1)
text(y = boxplot.stats(data)$stats, labels = boxplot.stats(data)$stats, x = 
1.35)
title(analysis, outer=TRUE)



install.packages(png)


downloaded 24 Kb


* installing *source* package 'png' ...
** package 'png' successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG  `libpng-config --cflags` 
-fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat 
-Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c read.c -o 
read.o
/bin/bash: libpng-config: command not found
read.c:3:17: fatal error: png.h: No such file or directory
compilation terminated.
make: *** [read.o] Error 1
ERROR: compilation failed for package 'png'
* removing '/home/g1/R/x86_64-pc-linux-gnu-library/3.1/png'

The downloaded source packages are in
'/tmp/Rtmpvo3r8J/downloaded_packages'
Warning message:
In install.packages(png) :
  installation of package 'png' had non-zero exit status




Gudrun Gygli, MSc

PhD candidate

Wageningen University
Laboratory of Biochemistry
Dreijenlaan 3
6703 HA Wageningen
The Netherlands

Phone  31 317483387
e-mail: gudrun.gy...@wur.nl

- - - - - - - - - - - - - - - - - -

Project information: 
http://www.wageningenur.nl/en/show/Bioinformatics-structural-biology-and-molecular-modeling-of-Vanillyl-Alcohol-Oxidases-VAOs.htm

__
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] (no subject)

2015-05-26 Thread venkadesan venky
Hello guys,

I have data set like this

Name   A B CD
Venky  12   157   168 209
Kalai65   8899 889 998
balaji98   877   8787   9888
.
.
.

i want to change Name column as a Charcter and A column as a percentage and
B and C column as a thousand seperators

[[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] apply a function to a list of data frames

2015-05-26 Thread Stefano Sofia
Thank you for your help.
Your explanations have been very useful.

Stefano


Da: Rui Barradas [ruipbarra...@sapo.pt]
Inviato: venerdì 22 maggio 2015 20.26
A: Stefano Sofia; r-help@r-project.org
Oggetto: Re: [R] apply a function to a list of data frames

Hello,

You should change your function to accept only one argument, the
data.frames, and then use lapply (not sapply).
Something like the following.

calc - function(dat)
{
bias_dmo_max - round(mean((dat$dmo_12-dat$Eonestep_12), na.rm=TRUE),
digits=2)
rmse_dmo_max - round(sqrt(mean((dat$dmo_12-dat$Eonestep_12)^2,
na.rm=TRUE)), digits=2)
bias_dmo_min - round(mean((dat$dmo_27-dat$Eonestep_27), na.rm=TRUE),
digits=2)
rmse_dmo_min - round(sqrt(mean((dat$dmo_27-dat$Eonestep_27)^2,
na.rm=TRUE)), digits=2)
result - list(bias_dmo_max, rmse_dmo_max, bias_dmo_min, rmse_dmo_min)
result
}

result_lst - lapply(lst, calc)


Hope this helps,

Rui Barradas


Em 22-05-2015 19:02, Stefano Sofia escreveu:
 Dear R-users,
 given a list of dataframes (like below reported), for each month I need to 
 apply a function (called calc).
 The result should be written in a new list of data frames, one row for each 
 month.

 I have been trying to use sapply, with no success.
 Could somebody help me in this?


 $df1
 day dmo_12 Eonestep_12 tmax dmo_27 Eonestep_27 tmin
 2012-12-01 11 13 13 9 8 8
 2012-12-02 11 13 13 5 6 8
 2012-12-03 6 10 8 6 6 7
 2012-12-04 11 13 9 6 6 3
 2012-12-05 8 10 12 5 6 7
 2012-12-06 8 10 8 4 5 4
 2012-12-07 7 9 8 6 6 5
 ...


 calc - function(dmo_12, Eonestep_12, dmo_27, Eonestep_27)
 {
 bias_dmo_max - round(mean((dmo_12-Eonestep_12), na.rm=TRUE), digits=2)
 rmse_dmo_max - round(sqrt(mean((dmo_12-Eonestep_12)^2, na.rm=TRUE)), 
 digits=2)
 bias_dmo_min - round(mean((dmo_27-Eonestep_27), na.rm=TRUE), digits=2)
 rmse_dmo_min - round(sqrt(mean((dmo_27-Eonestep_27)^2, na.rm=TRUE)), 
 digits=2)
 result - list(bias_dmo_max, rmse_dmo_max, bias_dmo_min, rmse_dmo_min)
 result
 }


 Thank you for your help
 Stefano


 

 AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere 
 informazioni confidenziali, pertanto è destinato solo a persone autorizzate 
 alla ricezione. I messaggi di posta elettronica per i client di Regione 
 Marche possono contenere informazioni confidenziali e con privilegi legali. 
 Se non si è il destinatario specificato, non leggere, copiare, inoltrare o 
 archiviare questo messaggio. Se si è ricevuto questo messaggio per errore, 
 inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio 
 computer. Ai sensi dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso 
 di necessità ed urgenza, la risposta al presente messaggio di posta 
 elettronica può essere visionata da persone estranee al destinatario.
 IMPORTANT NOTICE: This e-mail message is intended to be received only by 
 persons entitled to receive the confidential information it may contain. 
 E-mail messages to clients of Regione Marche may contain information that is 
 confidential and legally privileged. Please do not read, copy, forward, or 
 store this message unless you are an intended recipient of it. If you have 
 received this message in error, please forward it to the sender and delete it 
 completely from your computer system.

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




AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere 
informazioni confidenziali, pertanto è destinato solo a persone autorizzate 
alla ricezione. I messaggi di posta elettronica per i client di Regione Marche 
possono contenere informazioni confidenziali e con privilegi legali. Se non si 
è il destinatario specificato, non leggere, copiare, inoltrare o archiviare 
questo messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al 
mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi 
dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed 
urgenza, la risposta al presente messaggio di posta elettronica può essere 
visionata da persone estranee al destinatario.
IMPORTANT NOTICE: This e-mail message is intended to be received only by 
persons entitled to receive the confidential information it may contain. E-mail 
messages to clients of Regione Marche may contain information that is 
confidential and legally privileged. Please do not read, copy, forward, or 
store this message unless you are an intended recipient of it. If you have 
received this message in error, please forward it to the sender and delete it 
completely from your computer system.


Re: [R] png package in Ubuntu 12.04 with R 3.1.0

2015-05-26 Thread John Kane
Have you loaded the png package?

library(png)

John Kane
Kingston ON Canada


 -Original Message-
 From: gudrun.gy...@wur.nl
 Sent: Tue, 26 May 2015 07:10:35 +
 To: r-help@r-project.org
 Subject: [R] png package in Ubuntu 12.04 with R 3.1.0
 
 
 Dear All,
 
 
 I am using R to analyse computer simulations of ligand docking in a
 protein.
 
 I am plotting the results as scatterplots and bopxplots, using the code
 below.
 
 This works perfectly fine.
 
 
 I would like now to add a png file to that plot, meaning I want sth like:
 
 
 png(file=analysis.png)
 par(mfrow=c(1,3), oma=c(0,0,2,0))
 
 plot
 
 boxplot
 
 PNG figure I read in
 
 
 I am running Ubuntu 12.04 and R 3.1.0.
 
 
 readPNG and the png packge do NOT work for me at this point.
 
 
 when I try to install the png package I get the error below.
 
 
 Any ideas what's wrong or other options to import png files?
 
 
 Thank you in advance for the help.
 
 
 Best regards
 
 
 Gudrun
 
 
 
 png(file=analysis.png)
 par(mfrow=c(1,2), oma=c(0,0,2,0))
 plot(data, main=all, xlab=simulations run, ylab=steps)
 boxplot(data, main=steps, horizontal = FALSE, axes = FALSE, staplewex =
 1)
 text(y = boxplot.stats(data)$stats, labels = boxplot.stats(data)$stats, x
 = 1.35)
 title(analysis, outer=TRUE)
 
 
 
 install.packages(png)
 
 
 downloaded 24 Kb
 
 
 * installing *source* package 'png' ...
 ** package 'png' successfully unpacked and MD5 sums checked
 ** libs
 gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG  `libpng-config
 --cflags` -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4
 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g
 -c read.c -o read.o
 /bin/bash: libpng-config: command not found
 read.c:3:17: fatal error: png.h: No such file or directory
 compilation terminated.
 make: *** [read.o] Error 1
 ERROR: compilation failed for package 'png'
 * removing '/home/g1/R/x86_64-pc-linux-gnu-library/3.1/png'
 
 The downloaded source packages are in
 '/tmp/Rtmpvo3r8J/downloaded_packages'
 Warning message:
 In install.packages(png) :
   installation of package 'png' had non-zero exit status
 
 
 
 
 Gudrun Gygli, MSc
 
 PhD candidate
 
 Wageningen University
 Laboratory of Biochemistry
 Dreijenlaan 3
 6703 HA Wageningen
 The Netherlands
 
 Phone  31 317483387
 e-mail: gudrun.gy...@wur.nl
 
 - - - - - - - - - - - - - - - - - -
 
 Project information:
 http://www.wageningenur.nl/en/show/Bioinformatics-structural-biology-and-molecular-modeling-of-Vanillyl-Alcohol-Oxidases-VAOs.htm
 
 __
 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 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.


Re: [R] Path analysis

2015-05-26 Thread John Fox
Dear Alberto,

There are several R packages available on CRAN for structural equation 
modeling: sem, lavaan, and OpenMx come immediately to mind. If your model is 
recursive with only observed variables, then you could just use lm(). If your 
model is nonrecursive with only observed variables, then you could also use the 
systemfit package.

I hope this helps,
 John


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



On Tue, 26 May 2015 05:43:47 +
 Alberto Canarini alberto.canar...@sydney.edu.au wrote:
 Hi there,
 
 As I'm approaching path analysis I was wondering which packages may suite a 
 path analysis for my data. My data are on interaction of soil biotic and 
 abiotic factor, like microbial biomass carbon, soil carbon, water content, 
 temperature etc.
 
 Thanks in advance,
 
 Best regards.
 
 Alberto
 
 Alberto Canarini
 PhD Student l Faculty of Agriculture and Environment
 THE UNIVERSITY OF SYDNEY
 Shared room l CCWF l Camden Campus l NSW 2570
 P 02 935 11892
 
 
   [[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] Path analysis

2015-05-26 Thread Charles Determan
Given that your problem primarily focuses on a biological context you
probably would have better luck with bioconductor (www.bioconductor.org).

Regards,
Charles

On Tue, May 26, 2015 at 12:43 AM, Alberto Canarini 
alberto.canar...@sydney.edu.au wrote:

 Hi there,

 As I'm approaching path analysis I was wondering which packages may suite
 a path analysis for my data. My data are on interaction of soil biotic and
 abiotic factor, like microbial biomass carbon, soil carbon, water content,
 temperature etc.

 Thanks in advance,

 Best regards.

 Alberto

 Alberto Canarini
 PhD Student l Faculty of Agriculture and Environment
 THE UNIVERSITY OF SYDNEY
 Shared room l CCWF l Camden Campus l NSW 2570
 P 02 935 11892


 [[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] (no subject)

2015-05-26 Thread Jim Lemon
Hi venkadesan,
Assuming that the Name column is now a factor (and the data set is a
data frame named mydata), try:

mydata$Name-as.character(mydata$Name)

If you mean that you want to display column A with percentage signs:

paste(mydata$A,%,sep=)

You can use the format function to display the final three columns
with thousand separators:

format(mydata$B,big.mark=,)

Note that the result will be a character variable, not a number.

Jim


On Tue, May 26, 2015 at 9:41 PM, venkadesan venky venkyno...@gmail.com wrote:
 Hello guys,

 I have data set like this

 Name   A B CD
 Venky  12   157   168 209
 Kalai65   8899 889 998
 balaji98   877   8787   9888
 .
 .
 .

 i want to change Name column as a Charcter and A column as a percentage and
 B and C column as a thousand seperators

 [[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 CMD methods and ggplot2 advice

2015-05-26 Thread Duncan Murdoch
This posting should probably go to the new R-package-devel mailing list
instead of R-help.  If you do re-post there, you should give more
information to let people help you.  We can see the errors, but we can't
see the source to your package, so it's hard to diagnose them.  If your
source is online somewhere, a link to it would really help.  If not,
then please include a copy of the DESCRIPTION file (so we can see how
you declared dependence on methods), and extracts from the source of
CreditEnhancement() where you use Period, etc.

Duncan Murdoch

On 25/05/2015 8:24 PM, Glenn Schultz wrote:
 Hello All,
 
 I have two packages Bond Lab and the Companion to Investing in MBS.  Bond Lab 
 clears the check and I am working on the on.load() to copy a needed directory 
 per Duncan Murdoch's advise to make Bond Lab CRAN-able.  The companion passes 
 with two notes.  The output is below:
 
 I get two notes (highlighted in red)
 
 Not sure on this one as I tried to declare methods but I get another note 
 methods declared but not used.  The second note is related to ggplot2 they 
 are variable passed to ggplot2 within a function.  I am not sure why they 
 appear in the R CMD check.  If someone could point in the right direction to 
 resolve these I would appreciate the advice.  These are my last remaining two 
 issues to make the packages pass CRAN aside from the on.load()
 
 Best Regards,
 Glenn
 
 * checking dependencies in R code ... NOTE
 package ‘methods’ is used but not declared
 
 
 * checking R code for possible problems ... NOTE
 CreditEnhancement: no visible binding for global variable ‘Period’
 CreditEnhancement: no visible binding for global variable ‘Value’
 CreditEnhancement: no visible binding for global variable ‘Variable’
 CreditEnhancement: no visible binding for global variable ‘..density..’
 PassThrough.OAS: no visible binding for global variable ‘value’
 PassThrough.OAS: no visible binding for global variable ‘..density..’
 PassThroughCashFlow: no visible binding for global variable ‘Period’
 PassThroughCashFlow: no visible binding for global variable ‘value’
 PassThroughCashFlow: no visible binding for global variable ‘variable’
 PlotMtgKeyRates: no visible binding for global variable ‘Tenor’
 PlotMtgKeyRates: no visible binding for global variable ‘Duration’
 PlotTermStructure: no visible binding for global variable ‘value’
 PlotTermStructure: no visible binding for global variable ‘variable’
 REMICOAS: no visible binding for global variable ‘value’
 REMICOAS: no visible binding for global variable ‘..density..’
 TotalReturn: no visible binding for global variable ‘Scenario’
 TotalReturn: no visible binding for global variable ‘value’
 TotalReturn: no visible binding for global variable ‘variable’
 TwistScenario: no visible binding for global variable ‘Scenario’
 TwistScenario: no visible binding for global variable ‘Return’
 ValuationFramework: no visible binding for global variable ‘value’
 ValuationFramework: no visible binding for global variable ‘variable’
 
 == devtools::check()
 
 Updating Companion2IMBS documentation
 Loading Companion2IMBS
 '/Library/Frameworks/R.framework/Resources/bin/R' --vanilla CMD build  \
   '/Users/glennschultz/Companion to Investing in MBS' --no-resave-data  \
   --no-manual 
 
 * checking for file ‘/Users/glennschultz/Companion to Investing in 
 MBS/DESCRIPTION’ ... OK
 * preparing ‘Companion2IMBS’:
 * checking DESCRIPTION meta-information ... OK
 * checking for LF line-endings in source and make files
 * checking for empty or unneeded directories
 Removed empty directory ‘Companion2IMBS/inst’
 Removed empty directory ‘Companion2IMBS/test/testthat’
 Removed empty directory ‘Companion2IMBS/test’
 * building ‘Companion2IMBS_1.0.tar.gz’
 
 '/Library/Frameworks/R.framework/Resources/bin/R' --vanilla CMD check  \
   
 '/var/folders/tv/sq6gmnvs13j8jrhkt87f_zmcgn/T//RtmpOabREs/Companion2IMBS_1.0.tar.gz'
   \
   --timings 
 
 * using log directory ‘/Users/glennschultz/Companion2IMBS.Rcheck’
 * using R version 3.0.3 (2014-03-06)
 * using platform: x86_64-apple-darwin10.8.0 (64-bit)
 * using session charset: UTF-8
 * checking for file ‘Companion2IMBS/DESCRIPTION’ ... OK
 * checking extension type ... Package
 * this is package ‘Companion2IMBS’ version ‘1.0’
 * checking package namespace information ... OK
 * checking package dependencies ... OK
 * checking if this is a source package ... OK
 * checking if there is a namespace ... OK
 * checking for executable files ... OK
 * checking for hidden files and directories ... OK
 * checking for portable file names ... OK
 * checking for sufficient/correct file permissions ... OK
 * checking whether package ‘Companion2IMBS’ can be installed ... OK
 * checking installed package size ... OK
 * checking package directory ... OK
 * checking DESCRIPTION meta-information ... OK
 * checking top-level files ... OK
 * checking for left-over files ... OK
 * checking index information ... OK
 * checking package subdirectories ... 

Re: [R] Issues with loading csv file

2015-05-26 Thread Shivi82
Hi Pat,

Thanks for the suggestion. It worked for me. 
Actually I had not saved the file in the WD accidentally and with the help
of get files syntax I got to know what was the issue.

Thanks a ton.
Shivi



--
View this message in context: 
http://r.789695.n4.nabble.com/Issues-with-loading-csv-file-tp4707637p4707675.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] Help with urnsamples and all possible combination

2015-05-26 Thread MGalla
Thanks for your help. So I have to try it on the long way, because I need
exactly all combinations, but thanks for the idea.

Best wishes
Michelle Galla



--
View this message in context: 
http://r.789695.n4.nabble.com/Help-with-urnsamples-and-all-possible-combination-tp4707560p4707676.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] logistic regression R and Stata – grouping variable

2015-05-26 Thread Lambert Bruno
Hello,

I mostly use Stata 13 for my regression analysis. I want to conduct a logistic 
regression on a proportion/number of success. Because I receive errors in Stata 
I did not expect nor understand (if there are Stata experts who want to know 
more about the problems I face and can potentially help me solve them, I would 
be glad to give more details), I want to repeat the analysis in R. In Stata I 
would use the command: xtlogit DEP_PROP INDEP_A INDEP_B INDEP_C, i(ID). ID is 
the identifier for each subject. There are eight lines with data for each 
subject because there are three within factors (INDEP_A, B, C) with two levels 
each (0 and 1). I can repeat this analysis in R by using the command: 
glm(DEP_SUC ~ INDEP_A + INDEP_B + INDEP_C, family = �binomial�). DEP_SUC is 
here a table with the successes and misses per row. Again, there are eight rows 
for each subject. But while I know how to group these lines in Stata by using 
the option i(ID ), I do not know what to do in R. I have search for more 
information about the i() command, but did not find any usefull information.

So, to summarize: I want to find out how three variables (binary) influence a 
proportion and use logistic regression. In Stata I can group multiple lines per 
subject using the i( ) command in logistic regression. What is the equivalent 
in R?

Thank you in advance!

[[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] Hadoop R integration

2015-05-26 Thread Lalitha Kristipati

Hi,

I need to showcase how R and Hadoop can work together using ORCH. I have found 
a sample code from the ORACLE website as follows
dfs - hdfs.attach(ontime_DB)

res - hadoop.run(
dfs,
mapper = function(key, value) {
  if (key == 'SFO'  !is.na(x$ARRDELAY)) {
keyval(key, value)
  }
  else {
NULL
  }
},
 reducer = function(key, values) {
for (x in values) {
sumAD - sumAD + x$ARRDELAY
count - count + 1
  }
  res - sumAD / count
  keyval(key, res)
})

OUTPUT:

 hdfs.get(res)
   key val1
1  SFO   17.44828

I could not understand in this code where is ORCH acting as a connector. Even 
if you can explain how ORCH acts as a connector to Hadoop with another example 
it would also be helpful.


Regards,
Lalitha Kristipati
Associate Software Engineer




Disclaimer:  This message and the information contained herein is proprietary 
and confidential and subject to the Tech Mahindra policy statement, you may 
review the policy at http://www.techmahindra.com/Disclaimer.html externally 
http://tim.techmahindra.com/tim/disclaimer.html internally within TechMahindra.



[[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] How to pass a variable to a function which use variable name as a parameter

2015-05-26 Thread John McKown
On Tue, May 26, 2015 at 5:14 AM, wong jane jane.wong...@gmail.com wrote:

 There are functions which use variable names as parameters in some R
 packages. However, if the variable name is stored in another variable, how
 can I pass this variable to the function. Taking the rms package as an
 example:

 ​​
 library(rms)
 n - 1000
 age - rnorm(n, 50, 10)
 sex - factor(sample(c('female','male'), n,TRUE))

 y - rnorm(n, 200, 25)
 ddist - datadist(age, sex)
 options(datadist='ddist')
 fit - lrm(y ~ age)
 Predict(fit, age, np=4)
 options(datadist=NULL)

 Here age was a variable name passed to Predict() function, but if age
 was stored in variable var, that is, var - age, how can I pass var
 to Predict() function? The purpose is that I want to change the parameter
 of Predict()  in a loop.


​Please turn off HMTL email. The forum software doesn't really like it.

What you want is the get() function.


var-age

​
​
library(rms)
n - 1000
age - rnorm(n, 50, 10)
sex - factor(sample(c('female','male'), n,TRUE))

y - rnorm(n, 200, 25)
​#​
ddist - datadist(age, sex)
​ddist - datadist(get(var),sex)​
options(datadist='ddist')
fit - lrm(y ~ age)
​#​
Predict(fit, age, np=4)
​Predict(fit,get(var),np=4)​
options(datadist=NULL)

-- 
My sister opened a computer store in Hawaii. She sells C shells down by the
seashore.

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 Megaphone

Maranatha! 
John McKown

[[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] lme function to obtain pvalue for fixed effect

2015-05-26 Thread li li
Hi all,
  I am using the lme function to run a random coefficient model. Please see
output (mod1) as below.
  I need to obtain the pvalue for the fixed effect. As you can see,
the pvalues given using the summary function is different from the
resutls given in anova function.
Why should they be different and which one is the correct one to use?
   Thanks!
  Hanna


 summary(mod1)
Linear mixed-effects model fit by REML
 Data: minus20C1
AIC   BIC   logLik
  -82.60042 -70.15763 49.30021

Random effects:
 Formula: ~1 + months | lot
 Structure: General positive-definite, Log-Cholesky parametrization
StdDev   Corr
(Intercept) 8.907584e-03 (Intr)
months  6.039781e-05 -0.096
Residual4.471243e-02

Fixed effects: ti ~ type * months
 Value   Std.Error DF   t-value p-value
(Intercept) 0.25831245 0.016891587 31 15.292373  0.
type 0.13502089 0.026676101  4  5.061493  0.0072
months  0.00804790 0.001218941 31  6.602368  0.
type:months -0.00693679 0.002981859 31 -2.326329  0.0267
 Correlation:
   (Intr) typ months
type-0.633
months -0.785  0.497
type:months  0.321 -0.762 -0.409

Standardized Within-Group Residuals:
  MinQ1   MedQ3   Max
-2.162856e+00 -1.962972e-01 -2.771184e-05  3.749035e-01  2.088392e+00

Number of Observations: 39
Number of Groups: 6
 anova(mod1)
numDF denDF   F-value p-value
(Intercept) 131 2084.0265  .0001
type1 4   10.8957  0.0299
months  131   38.3462  .0001
type:months 1315.4118  0.0267

__
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] png package in Ubuntu 12.04 with R 3.1.0

2015-05-26 Thread Yihui Xie
sudo apt-get install libpng12-dev

I'm not sure about Ubuntu 12.04. You may need a different libpng??-dev.

Regards,
Yihui
--
Yihui Xie xieyi...@gmail.com
Web: http://yihui.name


On Tue, May 26, 2015 at 2:10 AM, Gygli, Gudrun gudrun.gy...@wur.nl wrote:

 Dear All,


 I am using R to analyse computer simulations of ligand docking in a protein.

 I am plotting the results as scatterplots and bopxplots, using the code below.

 This works perfectly fine.


 I would like now to add a png file to that plot, meaning I want sth like:


 png(file=analysis.png)
 par(mfrow=c(1,3), oma=c(0,0,2,0))

 plot

 boxplot

 PNG figure I read in


 I am running Ubuntu 12.04 and R 3.1.0.


 readPNG and the png packge do NOT work for me at this point.


 when I try to install the png package I get the error below.


 Any ideas what's wrong or other options to import png files?


 Thank you in advance for the help.


 Best regards


 Gudrun



 png(file=analysis.png)
 par(mfrow=c(1,2), oma=c(0,0,2,0))
 plot(data, main=all, xlab=simulations run, ylab=steps)
 boxplot(data, main=steps, horizontal = FALSE, axes = FALSE, staplewex = 1)
 text(y = boxplot.stats(data)$stats, labels = boxplot.stats(data)$stats, x = 
 1.35)
 title(analysis, outer=TRUE)



 install.packages(png)


 downloaded 24 Kb


 * installing *source* package 'png' ...
 ** package 'png' successfully unpacked and MD5 sums checked
 ** libs
 gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG  `libpng-config --cflags` 
 -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat 
 -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c read.c 
 -o read.o
 /bin/bash: libpng-config: command not found
 read.c:3:17: fatal error: png.h: No such file or directory
 compilation terminated.
 make: *** [read.o] Error 1
 ERROR: compilation failed for package 'png'
 * removing '/home/g1/R/x86_64-pc-linux-gnu-library/3.1/png'

 The downloaded source packages are in
 '/tmp/Rtmpvo3r8J/downloaded_packages'
 Warning message:
 In install.packages(png) :
   installation of package 'png' had non-zero exit status




 Gudrun Gygli, MSc

 PhD candidate

 Wageningen University
 Laboratory of Biochemistry
 Dreijenlaan 3
 6703 HA Wageningen
 The Netherlands

 Phone  31 317483387
 e-mail: gudrun.gy...@wur.nl

 - - - - - - - - - - - - - - - - - -

 Project information: 
 http://www.wageningenur.nl/en/show/Bioinformatics-structural-biology-and-molecular-modeling-of-Vanillyl-Alcohol-Oxidases-VAOs.htm

 __
 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 pass a variable to a function which use variable name as a parameter

2015-05-26 Thread William Dunlap
One way to use variable names in functions like Predict() that
do not evaluate their arguments in the standard way is to use
do.call() along with as.name().  E.g.,
  varName-age
  do.call(Predict, list(fit, as.name(varName), np=4))})
gives the same result as
  Predict(fit, age, np=4)



Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Tue, May 26, 2015 at 3:14 AM, wong jane jane.wong...@gmail.com wrote:

 There are functions which use variable names as parameters in some R
 packages. However, if the variable name is stored in another variable, how
 can I pass this variable to the function. Taking the rms package as an
 example:

 library(rms)
 n - 1000
 age - rnorm(n, 50, 10)
 sex - factor(sample(c('female','male'), n,TRUE))

 y - rnorm(n, 200, 25)
 ddist - datadist(age, sex)
 options(datadist='ddist')
 fit - lrm(y ~ age)
 Predict(fit, age, np=4)
 options(datadist=NULL)

 Here age was a variable name passed to Predict() function, but if age
 was stored in variable var, that is, var - age, how can I pass var
 to Predict() function? The purpose is that I want to change the parameter
 of Predict()  in a loop.

 [[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] [R-sig-ME] lme function to obtain pvalue for fixed effect

2015-05-26 Thread Thierry Onkelinx
Because they test different hypothesis.

ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie  Kwaliteitszorg / team Biometrics  Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey

2015-05-26 21:46 GMT+02:00 li li hannah@gmail.com:

 Thanks so much for replying.
 Yes LimerTest package could be used to get pvalues when using lmer
 function. But still the summary and anova function give different
 pvalues.
Hanna

 2015-05-26 15:19 GMT-04:00, byron vinueza byronvin...@hotmail.com:
  You can use the lmerTest package .
 
 
 
 
 
  Enviado desde mi iPhone
 
  El 26/5/2015, a las 13:18, li li hannah@gmail.com escribió:
 
  Hi all,
   I am using the lme function to run a random coefficient model. Please
  see
  output (mod1) as below.
   I need to obtain the pvalue for the fixed effect. As you can see,
  the pvalues given using the summary function is different from the
  resutls given in anova function.
  Why should they be different and which one is the correct one to use?
Thanks!
   Hanna
 
 
  summary(mod1)
  Linear mixed-effects model fit by REML
  Data: minus20C1
 AIC   BIC   logLik
   -82.60042 -70.15763 49.30021
 
  Random effects:
  Formula: ~1 + months | lot
  Structure: General positive-definite, Log-Cholesky parametrization
 StdDev   Corr
  (Intercept) 8.907584e-03 (Intr)
  months  6.039781e-05 -0.096
  Residual4.471243e-02
 
  Fixed effects: ti ~ type * months
  Value   Std.Error DF   t-value p-value
  (Intercept) 0.25831245 0.016891587 31 15.292373  0.
  type 0.13502089 0.026676101  4  5.061493  0.0072
  months  0.00804790 0.001218941 31  6.602368  0.
  type:months -0.00693679 0.002981859 31 -2.326329  0.0267
  Correlation:
(Intr) typ months
  type-0.633
  months -0.785  0.497
  type:months  0.321 -0.762 -0.409
 
  Standardized Within-Group Residuals:
   MinQ1   MedQ3   Max
  -2.162856e+00 -1.962972e-01 -2.771184e-05  3.749035e-01  2.088392e+00
 
  Number of Observations: 39
  Number of Groups: 6
  anova(mod1)
 numDF denDF   F-value p-value
  (Intercept) 131 2084.0265  .0001
  type1 4   10.8957  0.0299
  months  131   38.3462  .0001
  type:months 1315.4118  0.0267
 
  ___
  r-sig-mixed-mod...@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
 

 ___
 r-sig-mixed-mod...@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models


[[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] [R-sig-ME] lme function to obtain pvalue for fixed effect

2015-05-26 Thread byron vinueza
You can use the lmerTest package .





Enviado desde mi iPhone

 El 26/5/2015, a las 13:18, li li hannah@gmail.com escribió:
 
 Hi all,
  I am using the lme function to run a random coefficient model. Please see
 output (mod1) as below.
  I need to obtain the pvalue for the fixed effect. As you can see,
 the pvalues given using the summary function is different from the
 resutls given in anova function.
 Why should they be different and which one is the correct one to use?
   Thanks!
  Hanna
 
 
 summary(mod1)
 Linear mixed-effects model fit by REML
 Data: minus20C1
AIC   BIC   logLik
  -82.60042 -70.15763 49.30021
 
 Random effects:
 Formula: ~1 + months | lot
 Structure: General positive-definite, Log-Cholesky parametrization
StdDev   Corr
 (Intercept) 8.907584e-03 (Intr)
 months  6.039781e-05 -0.096
 Residual4.471243e-02
 
 Fixed effects: ti ~ type * months
 Value   Std.Error DF   t-value p-value
 (Intercept) 0.25831245 0.016891587 31 15.292373  0.
 type 0.13502089 0.026676101  4  5.061493  0.0072
 months  0.00804790 0.001218941 31  6.602368  0.
 type:months -0.00693679 0.002981859 31 -2.326329  0.0267
 Correlation:
   (Intr) typ months
 type-0.633
 months -0.785  0.497
 type:months  0.321 -0.762 -0.409
 
 Standardized Within-Group Residuals:
  MinQ1   MedQ3   Max
 -2.162856e+00 -1.962972e-01 -2.771184e-05  3.749035e-01  2.088392e+00
 
 Number of Observations: 39
 Number of Groups: 6
 anova(mod1)
numDF denDF   F-value p-value
 (Intercept) 131 2084.0265  .0001
 type1 4   10.8957  0.0299
 months  131   38.3462  .0001
 type:months 1315.4118  0.0267
 
 ___
 r-sig-mixed-mod...@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
__
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-sig-ME] lme function to obtain pvalue for fixed effect

2015-05-26 Thread li li
Thanks so much for replying.
Yes LimerTest package could be used to get pvalues when using lmer
function. But still the summary and anova function give different
pvalues.
   Hanna

2015-05-26 15:19 GMT-04:00, byron vinueza byronvin...@hotmail.com:
 You can use the lmerTest package .





 Enviado desde mi iPhone

 El 26/5/2015, a las 13:18, li li hannah@gmail.com escribió:

 Hi all,
  I am using the lme function to run a random coefficient model. Please
 see
 output (mod1) as below.
  I need to obtain the pvalue for the fixed effect. As you can see,
 the pvalues given using the summary function is different from the
 resutls given in anova function.
 Why should they be different and which one is the correct one to use?
   Thanks!
  Hanna


 summary(mod1)
 Linear mixed-effects model fit by REML
 Data: minus20C1
AIC   BIC   logLik
  -82.60042 -70.15763 49.30021

 Random effects:
 Formula: ~1 + months | lot
 Structure: General positive-definite, Log-Cholesky parametrization
StdDev   Corr
 (Intercept) 8.907584e-03 (Intr)
 months  6.039781e-05 -0.096
 Residual4.471243e-02

 Fixed effects: ti ~ type * months
 Value   Std.Error DF   t-value p-value
 (Intercept) 0.25831245 0.016891587 31 15.292373  0.
 type 0.13502089 0.026676101  4  5.061493  0.0072
 months  0.00804790 0.001218941 31  6.602368  0.
 type:months -0.00693679 0.002981859 31 -2.326329  0.0267
 Correlation:
   (Intr) typ months
 type-0.633
 months -0.785  0.497
 type:months  0.321 -0.762 -0.409

 Standardized Within-Group Residuals:
  MinQ1   MedQ3   Max
 -2.162856e+00 -1.962972e-01 -2.771184e-05  3.749035e-01  2.088392e+00

 Number of Observations: 39
 Number of Groups: 6
 anova(mod1)
numDF denDF   F-value p-value
 (Intercept) 131 2084.0265  .0001
 type1 4   10.8957  0.0299
 months  131   38.3462  .0001
 type:months 1315.4118  0.0267

 ___
 r-sig-mixed-mod...@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models


__
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] Installing Blotterand Rtoolsin R

2015-05-26 Thread nmrql
HI, Im trying to install the blotter package in R however I get the
following message:
 
Warning in install.packages :
  package ‘blotter’ is not available (for R version 3.2.0)

I have been told to first install the Rtools package, which gives me the
same message.
I also believe that there is a way to install Rtools directly from the
website: http://cran.r-project.org/bin/windows/Rtools/; However  do not
know how to do this.

Any help would be much aprreciated?
Thanks



--
View this message in context: 
http://r.789695.n4.nabble.com/Installing-Blotter-and-Rtools-in-R-tp4707688.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] different results from lme and lmer function

2015-05-26 Thread li li
Hi all,
  I am fitting a random slope and random intercept model using R. I
used both lme and lmer funciton for the same model. However I got
different results as shown below (different variance component
estimates and so on). I think that is really confusing. They should
produce close results. Anyone has any thoughts or suggestions. Also,
which one should be comparable to sas results?
 Thanks!
  Hanna

## using lme function
 mod_lme - lme(ti  ~ type*months, random=~ 1+months|lot, na.action=na.omit,
+ data=one, control = lmeControl(opt = optim))
 summary(mod_lme)
Linear mixed-effects model fit by REML
 Data: one
AIC   BIC   logLik
  -82.60042 -70.15763 49.30021

Random effects:
 Formula: ~1 + months | lot
 Structure: General positive-definite, Log-Cholesky parametrization
StdDev   Corr
(Intercept) 8.907584e-03 (Intr)
months  6.039781e-05 -0.096
Residual4.471243e-02

Fixed effects: ti ~ type * months
 Value   Std.Error DF   t-value p-value
(Intercept) 0.25831245 0.016891587 31 15.292373  0.
type0.13502089 0.026676101  4  5.061493  0.0072
months  0.00804790 0.001218941 31  6.602368  0.
type:months -0.00693679 0.002981859 31 -2.326329  0.0267
 Correlation:
   (Intr) typPPQ months
type   -0.633
months -0.785  0.497
type:months  0.321 -0.762 -0.409

Standardized Within-Group Residuals:
  MinQ1   MedQ3   Max
-2.162856e+00 -1.962972e-01 -2.771184e-05  3.749035e-01  2.088392e+00

Number of Observations: 39
Number of Groups: 6




###Using lmer function
 mod_lmer -lmer(ti  ~ type*months+(1+months|lot), na.action=na.omit, data=one)
 summary(mod_lmer)
Linear mixed model fit by REML t-tests use Satterthwaite approximations to
  degrees of freedom [merModLmerTest]
Formula: ti ~ type * months + (1 + months | lot)
   Data: one

REML criterion at convergence: -98.8

Scaled residuals:
Min  1Q  Median  3Q Max
-2.1347 -0.2156 -0.0067  0.3615  2.0840

Random effects:
 Groups   NameVariance  Std.Dev.  Corr
 lot  (Intercept) 2.870e-04 0.0169424
  months  4.135e-07 0.0006431 -1.00
 Residual 1.950e-03 0.0441644
Number of obs: 39, groups:  lot, 6

Fixed effects:
Estimate Std. Errordf t value Pr(|t|)
(Intercept) 0.258312   0.018661  4.82  13.842 4.59e-05 ***
type 0.135021   0.028880  6.802000   4.675  0.00245 **
months  0.008048   0.001259 11.943000   6.390 3.53e-05 ***
type:months -0.006937   0.002991 28.91  -2.319  0.02767 *
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
(Intr) typPPQ months
type -0.646
months  -0.825  0.533
type:month  0.347 -0.768 -0.421

__
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 pass a variable to a function which use variable name as a parameter

2015-05-26 Thread David Winsemius

On May 26, 2015, at 8:30 AM, William Dunlap wrote:

 One way to use variable names in functions like Predict() that
 do not evaluate their arguments in the standard way is to use
 do.call() along with as.name().  E.g.,
  varName-age
  do.call(Predict, list(fit, as.name(varName), np=4))})
 gives the same result as
  Predict(fit, age, np=4)
 

Here's another approach, developed after looking at the code and the help page, 
where I noticed that the factors argument was given an an alternate route for 
specifying the variables for evaluation. The requirements for the 'factors' 
argument are that it be provided as a named list and have either specific 
values or NA.

 var=age
 vlist - list(dum=NA)
 names(vlist)=var
 
 Predict(fit, factors=vlist, np=4)
#- same result ---
   age yhatlowerupper
1 25.04901 6.834836 4.856497 8.813174
2 41.14259 6.882369 4.919433 8.845306
3 57.23618 6.929903 4.967118 8.892688
4 73.32977 6.977437 4.999548 8.955325

Response variable (y): log odds 

Limits are 0.95 confidence limits

-- 
David.

 
 
 Bill Dunlap
 TIBCO Software
 wdunlap tibco.com
 
 On Tue, May 26, 2015 at 3:14 AM, wong jane jane.wong...@gmail.com wrote:
 
 There are functions which use variable names as parameters in some R
 packages. However, if the variable name is stored in another variable, how
 can I pass this variable to the function. Taking the rms package as an
 example:
 
 library(rms)
 n - 1000
 age - rnorm(n, 50, 10)
 sex - factor(sample(c('female','male'), n,TRUE))
 
 y - rnorm(n, 200, 25)
 ddist - datadist(age, sex)
 options(datadist='ddist')
 fit - lrm(y ~ age)
 Predict(fit, age, np=4)
 options(datadist=NULL)
 
 Here age was a variable name passed to Predict() function, but if age
 was stored in variable var, that is, var - age, how can I pass var
 to Predict() function? The purpose is that I want to change the parameter
 of Predict()  in a loop.
 
[[alternative HTML version deleted]]
-- 
 

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] Installing Blotterand Rtoolsin R

2015-05-26 Thread David Winsemius

On May 26, 2015, at 6:29 AM, nmrql wrote:

 HI, Im trying to install the blotter package in R however I get the
 following message:

How?

 
 Warning in install.packages :
  package ‘blotter’ is not available (for R version 3.2.0)

I do not see it in the list of packages available from CRAN.
 
 I have been told to first install the Rtools package, which gives me the
 same message.

Rtools is a set of Windows utilities. I don't think it's possible to be 
installed from an R console session.


 I also believe that there is a way to install Rtools directly from the
 website: http://cran.r-project.org/bin/windows/Rtools/; However  do not
 know how to do this.

http://cran.r-project.org/bin/windows/Rtools/index.html

http://cran.r-project.org/bin/windows/Rtools/installer.html


 
 Any help would be much aprreciated?
 Thanks
 
 
 
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Installing-Blotter-and-Rtools-in-R-tp4707688.html
 Sent from the R help mailing list archive at Nabble.com.

Posting from Nabble is somewhat discouraged. If it is at all feasible you 
should use a regular mail client and post directly to the list.

-- 

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.