[R] How to combine the results of different survey?

2019-06-04 Thread Damien Zurkinden
I have results of different surveys (years) for different species that I called 
NAMA. I want to combining the results of those different surveys to produce one 
overall result by using meta-analysis

I tried to implement my data using the R package metaplus. I used as Vector of 
observed effect sizes corresponding to each study (yi) the years (colomns). I 
used as Vector of character strings corresponding to each study (slab) the 
species (lines).

note: I don't have Vector of observed standard errors corresponding to each 
study (sei)

NAMA.meta <- metaplus(yi= 2011 ~ 2019, slab = 1 ~ 113, data=NAMA)



The expected results should be the parameter estimates & forest plot. However, 
I receive an error message:

Error in terms.formula(object, data = data) :

  terme incorrect dans une formule de mod�le

In addition: Warning message:

In metaplus(yi = 2011 ~ 2019, slab = 1 ~ 113, data = NAMA) :

  Very few studies. Solution may be unstable.

Thanks for your help,


Damien

[[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] flexmix - concomitant model and significance of variables

2015-09-26 Thread Damien Jourdain
Dear All, 

I am new to this forum and to flexmix. 
I am using flexmix to make a cluster analysis (Model Based). The data for
the clustering are all continuous (although all between 0 and 1).  I also
want to see the correlation between found clusters and some socio economic
variables, so I am using a concomitant model

The formulation is:
Conc<- FLXmultinom(~factor(Area)+factor(income)+Gender+factor(Education))

f2c <- flexmix(cbind(ECO, SOC, ENV, CULT)~1, k=5, 
  model=FLXMCmvnorm(), concomitant=Conc, data=data)

To recover the influence of socio-economic variables from the output I am
using:
f2c@concomitant@coef

However, how do I know which variables are significant?

Any help is welcomed!

Best

Damien





--
View this message in context: 
http://r.789695.n4.nabble.com/flexmix-concomitant-model-and-significance-of-variables-tp4712809.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] incrementation within ifelse

2013-01-08 Thread Damien Pilloud
Dear R-helper,

I am working on a very large data frame and I am trying to add a new column
and write in it with certain conditions. I have try to use this code with
the data frame p :

ID = 0

p[,newColumn]-
ifelse (p$flagFoehn3_durr == 1,
ifelse(p$Guetsch == 0,
ID - ID ++
,
ID
)
,
0
)

What I am trying to do is to increment the ID when p$Guetsch == 0 and to
put this result in the column. The problem is that ID does not increment
itself.

An other way is to use a loop for like this example :

ID = 0
for (s in 1:(nrow(z))){

z[s,newColumn]-
if (z$flagFoehn3_durr[s] == 1){
if(z$flagFoehn3_durr[s-1] == 0){
ID -ID+1
}else{
ID
}
}else{
0
}
}

This work perfectly, but the problem is that it will take me more than a
month to run it.

Is there a way to increment with the first code I used or a way of running
the second code faster (I have more than 1 million rows)

Thanks!

Cheers,

Damien

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] customize packages' help index ( 00index.html file )

2012-07-10 Thread Damien Georges

Hi all,

I'm writing my packages helps files and I'm not really satisfied by the 
visual results.


I'm would like to make subsections in a package function help index file.

I would like for example to put all S4 object documentation link 
together, then all the getters function.. and so on..


Does someone know if it's possible to do it?
Is it possible to define by myself the html/00index.html file that will 
be use in my package?


If it's not possible, how could I add the alphabetic subsections that 
exist in most of packages index help files?


Best,

Damien

__
R-help@r-project.org mailing list
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] random between two values

2009-08-06 Thread damien landais
Hi,
I would obtain a random value between two (for example between 40.15 and 56.58 
I would have only one value).
I'm looking for a package/a function which could do this.
Could anybody help me please?

Cordialement
Damien Landais

__
R-help@r-project.org mailing list
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] strange dlply behavior

2009-07-21 Thread Damien Moore
I'm running R 2.9.1 on winXP, using the library plyr.

Can anyone explain to me what is going wrong in this code? (in particular
see lines marked with **) Trying to modify objects in a list
created using dlply seems to corrupt the objects in the list.

 library(plyr)
 d=as.data.frame(cbind(c(1,1,1,2,2,2),c(1,2,3,4,5,6)))
 d
  V1 V2
1  1  1
2  1  2
3  1  3
4  2  4
5  2  5
6  2  6
 c=dlply(d,.(V1))
 c
[[1]]
  V1 V2
1  1  1
2  1  2
3  1  3

[[2]]
  V1 V2
4  2  4
5  2  5
6  2  6

## display an element from the second data frame
 c[[2]][2,2]
[1] 5

## change element in the second data from
 c[[2]][2,2]=10
 c
[[1]]
V1 V2
21  2**
2.1  1  2   **  What happened to V2?
2.2  1  2   **

[[2]]
   V1 V2
4   2  4
NA NA NA **
6   2  6

##Try again with first data frame
 c=dlply(d,.(V1))
 c[[1]][2,2]=10 **
 c
[[1]]
NULL * YIKES!


##Try again but copy c into a new list k
 c=dlply(d,.(V1))
 k=list(c[[1]],c[[2]])
 k[[1]]
  V1 V2
1  1  1
2  1  2
3  1  3
 k[[2]][2,2]=10
 k
[[1]]
  V1 V2
1  1  1
2  1  2
3  1  3

[[2]]
  V1 V2
4  2  4
5  2 10 ***
6  2  6
 k[[1]][2,2]=10
 k
[[1]]
  V1 V2
1  1  1
2  1 10 ***
3  1  3

[[2]]
  V1 V2
4  2  4
5  2 10
6  2  6

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] plm Issues

2009-07-13 Thread Damien Moore
Duh! Thanks and good advice. I was using 2.7.2 because it was, until
recently, the latest version working with RPy (http://rpy.sourceforge.net/).
Also didn't realize plm was still actively developed.

Interesting that since plm now correctly handles diff and lag operations, it
actually breaks with the behavior of lm:

 a=ts(c(1,2,4))
 lm(a~diff(a))
Error in model.frame.default(formula = a ~ diff(a), drop.unused.levels =
TRUE) :
  variable lengths differ (found for 'diff(a)')

To regress a on its difference, one needs the more laborious:
 a=ts(c(1,2,4))
 adata=as.data.frame(cbind(a,diff(a)))
 colnames(adata)=c(a,diffa)
 lm(a~diffa,data=adata)

Call:
lm(formula = a ~ diffa, data = adata)

Coefficients:
(Intercept)diffa
  02

From the R help
Fitting Linear ModelsUsing time series

Considerable care is needed when using lm with time series.

Unless na.action = NULL, the time series attributes are stripped from the
variables before the regression is done. (This is necessary as omitting NAs
would invalidate the time series attributes, and if NAs are omitted in the
middle of the series the result would no longer be a regular time series.)

Even if the time series attributes are retained, they are not used to line
up series, so that the time shift of a lagged or differenced regressor would
be ignored. It is good practice to prepare a data argument by
ts.intersectts.union.html(...,
dframe = TRUE), then apply a suitable na.action to that data frame and call
lm with na.action = NULL so that residuals and fitted values are time
series.


On Sat, Jul 11, 2009 at 10:53 PM, milton ruser milton.ru...@gmail.comwrote:

 The first think one need to do when has a so old version, is update it :-)
 After, if the problem remain, try get help with the colleagues.

 best

 milton

 On Thu, Jul 9, 2009 at 10:58 AM, Damien Moore damienlmo...@gmail.comwrote:

 Hi List

 I'm having difficulty understanding how plm should work with dynamic
 formulas. See the commands and output below on a standard data set. Notice
 that the first summary(plm(...)) call returns the same result as the
 second
 (it shouldn't if it actually uses the lagged variable requested). The
 third
 call results in error (trying to use diff'ed variable in regression)

 Other info: I'm running R 2.7.2 on WinXP

 cheers



 *data(Gasoline,package=Ecdat)
 Gasoline_plm-plm.data(Gasoline,c(country,year))
 pdim(Gasoline_plm)
 **Balanced Panel: n=18, T=19, N=342
 *
 *summary(plm(lgaspcar~lincomep,data=Gasoline_plm**))
 **Oneway (individual) effect Within Model

 Call:
 plm(formula = lgaspcar ~ lincomep, data = Gasoline_plm)

 Balanced Panel: n=18, T=19, N=342

 Residuals :
Min.  1st Qu.   Median  3rd Qu. Max.
 -0.40100 -0.08410 -0.00858  0.08770  0.73400

 Coefficients :
 Estimate Std. Error t-value  Pr(|t|)
 lincomep -0.761830.03535 -21.551  2.2e-16 ***
 ---
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

 Total Sum of Squares: 17.061
 Residual Sum of Squares: 6.9981
 Multiple R-Squared: 0.58981
 F-statistic: 464.442 on 323 and 1 DF, p-value: 0.036981

 ** summary(plm(lgaspcar~lag(lincomep),data=Gasoline_plm))
 **Oneway (individual) effect Within Model

 Call:
 plm(formula = lgaspcar ~ lag(lincomep), data = Gasoline_plm)

 Balanced Panel: n=18, T=19, N=342

 Residuals :
Min.  1st Qu.   Median  3rd Qu. Max.
 -0.40100 -0.08410 -0.00858  0.08770  0.73400

 Coefficients :
  Estimate Std. Error t-value  Pr(|t|)
 lag(lincomep) -0.761830.03535 -21.551  2.2e-16 ***
 ---
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

 Total Sum of Squares: 17.061
 Residual Sum of Squares: 6.9981
 Multiple R-Squared: 0.58981
 F-statistic: 464.442 on 323 and 1 DF, p-value: 0.036981

 *
 *summary(plm(lgaspcar~diff(lincomep),data=Gasoline_plm))*
 *Error in model.frame.default(formula = lgaspcar ~ diff(lincomep), data =
 mydata,  :
  variable lengths differ (found for 'diff(lincomep)')
 *

[[alternative HTML version deleted]]


 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.htmlhttp://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
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] plm Issues

2009-07-09 Thread Damien Moore
Hi List

I'm having difficulty understanding how plm should work with dynamic
formulas. See the commands and output below on a standard data set. Notice
that the first summary(plm(...)) call returns the same result as the second
(it shouldn't if it actually uses the lagged variable requested). The third
call results in error (trying to use diff'ed variable in regression)

Other info: I'm running R 2.7.2 on WinXP

cheers



*data(Gasoline,package=Ecdat)
Gasoline_plm-plm.data(Gasoline,c(country,year))
pdim(Gasoline_plm)
**Balanced Panel: n=18, T=19, N=342
*
*summary(plm(lgaspcar~lincomep,data=Gasoline_plm**))
**Oneway (individual) effect Within Model

Call:
plm(formula = lgaspcar ~ lincomep, data = Gasoline_plm)

Balanced Panel: n=18, T=19, N=342

Residuals :
Min.  1st Qu.   Median  3rd Qu. Max.
-0.40100 -0.08410 -0.00858  0.08770  0.73400

Coefficients :
 Estimate Std. Error t-value  Pr(|t|)
lincomep -0.761830.03535 -21.551  2.2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Total Sum of Squares: 17.061
Residual Sum of Squares: 6.9981
Multiple R-Squared: 0.58981
F-statistic: 464.442 on 323 and 1 DF, p-value: 0.036981

** summary(plm(lgaspcar~lag(lincomep),data=Gasoline_plm))
**Oneway (individual) effect Within Model

Call:
plm(formula = lgaspcar ~ lag(lincomep), data = Gasoline_plm)

Balanced Panel: n=18, T=19, N=342

Residuals :
Min.  1st Qu.   Median  3rd Qu. Max.
-0.40100 -0.08410 -0.00858  0.08770  0.73400

Coefficients :
  Estimate Std. Error t-value  Pr(|t|)
lag(lincomep) -0.761830.03535 -21.551  2.2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Total Sum of Squares: 17.061
Residual Sum of Squares: 6.9981
Multiple R-Squared: 0.58981
F-statistic: 464.442 on 323 and 1 DF, p-value: 0.036981

*
*summary(plm(lgaspcar~diff(lincomep),data=Gasoline_plm))*
*Error in model.frame.default(formula = lgaspcar ~ diff(lincomep), data =
mydata,  :
  variable lengths differ (found for 'diff(lincomep)')
*

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] to raise in a loop more than 1

2009-06-26 Thread damien landais
I would raise x,y and z in a loop but I won't raise of 1. I tried this but it 
doesn't work

mydata=matrix(nrow=1500,ncol=3)
i=1
for(x in 0:10){
for(y in 0:20){
for(z in 0:10){
mydata[i,]=c(x,y,z)
i=i+1
z=z+2}
y=y+4}
x=x+2}

And I would have something like that 
x   y   z
0   0   0
0   0   2
0   0   4
0   0   6
0   0   8
0   0   10 
0   4   0
0   4   2
...

Could anybody help me?
I don't work on a special package to do it...

Thanks

Cordialement
Damien Landais

__
R-help@r-project.org mailing list
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] Variogram fitted by Cauchy

2009-06-11 Thread damien landais
Hi
I'm using R(2.9.0)  and gstat package under Windows  to  plot sample variograms.
When I want to fit them, I don't have the possibility to choose Cauchy 
functions. Under Mathematica for example, we have it and it seems to be the 
best one to fit the variograms I have
I tested the others functions, they can fit but I would,if possible, use the 
Cauchy one. If anybody knows something about it, I would know, even with 
another package

To show what I want to do, here is my code

mydata=read.table(97MHz_15cm_V3.txt)
colnames(mydata)=c(x,y,z,E,taille)
g=gstat(id=zinc,formula=mydata[,4]~1,locations=~x+y+z,data=mydata)
g.var=variogram(g,cutoff=2500,width=100)

modele=vgm(model=Exp,range=2000)
vario=fit.variogram(g.var,modele)


Thanks!

Cordialement
Damien Landais

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] plot two variograms on a same graph

2009-06-10 Thread damien landais
Hi,
I would know how to plot two variograms on a same graph. I can plot one by one 
but I would draw both on the same one.
Is it possible? Do i need any special package?

Thanks!

Cordialement
Damien Landais

__
R-help@r-project.org mailing list
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] Read from url requiring authentication?

2008-09-09 Thread Damien
René Sachse wrote:

 Damien schrieb:

  I'm looking into opening an url on a server which requires
 authentication.

 Under a Windows Operating System you could try to start R with the
 --internet2 option. This worked in my case.

Thanks René it did the trick for me too!

Best Regards,
Damien

__
R-help@r-project.org mailing list
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] Read from url requiring authentication?

2008-09-09 Thread Damien
On 8 Sep, 20:15, Prof Brian Ripley [EMAIL PROTECTED] wrote:
 On Mon, 8 Sep 2008, Damien wrote:
  Hi all,

  I'm looking into opening an url on a server which requires
 authentication.

  After failing to find some kind of connection structure to fill in I
  turned to explicitly stating the credentials in the url itself (e.g.
  http://username:[EMAIL PROTECTED]).
  Sadly this didn't do the trick either and both source() and url()
  failed trying to resolve the username ()

  Is there anything I missed in the documentation/internet/groups?
  If not could I maybe add to the existing R functions as it doesn't
  seem too far of a stretch to allow the username and password in the
  url string fed to the web server?

 Look at the RCurl package: it is more like download.file than url, though,
 and you could perhaps wse the wget method of download.file.

Thank you for the quick reply,

it seems that the argument --internet2 did solve my immediate
problem
but I'll have a look at RCurl too.

Best Regards,
Damien

__
R-help@r-project.org mailing list
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] Read from url requiring authentication?

2008-09-08 Thread Damien
Hi all,

I'm looking into opening an url on a server which requires
authentication.

After failing to find some kind of connection structure to fill in I
turned to explicitly stating the credentials in the url itself (e.g.
http://username:[EMAIL PROTECTED]).
Sadly this didn't do the trick either and both source() and url()
failed trying to resolve the username ()

Is there anything I missed in the documentation/internet/groups?
If not could I maybe add to the existing R functions as it doesn't
seem too far of a stretch to allow the username and password in the
url string fed to the web server?

Thanks,
Damien

__
R-help@r-project.org mailing list
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.