Re: [R] Please help me debugg

2021-11-05 Thread Ivan Krylov
On Fri, 5 Nov 2021 12:29:21 +0530
Shrinivas Dharma  wrote:

> I am trying to run the following double loop which  I have written
> but it is not running.

Thanks for providing the code, but it's much easier to help you if you
provide the data, too. Use dput(head(...)) to make it easy for us to
copy-paste the data.

> Unable to get my head around the mistake. Please try to spot the bug
> and help

> > for(i in 1:122){  
> + for(j in 1:68){
> + if(V(FriendGraph)$name[i]==names[j]){
> + gender_vector[i]<-sex[j]
> + break;}
> + else{gender_vector[i]<-NA}
> + } }

> Error in `[.data.frame`(sex, j) : undefined columns selected

sex[j] extracts the `j`th column out of the `sex` data frame. Does
`sex` contain 68 columns? If you want the `j`th row, use sex[j,].

Also, it may help to use merge() and have the R language do some of the
work for you, if you organise your `names` and `sex` into a single
data.frame to merge V(FriendGraph) with.

Additionally, you might save some of the execution time if you move the
V(FriendGraph) calculation out of the loop.

>   [[alternative HTML version deleted]]

P.S. Your post came across mostly fine, but please compose your mail in
plain text, not HTML. We only see the plain text version, and in many
cases, the mailers horribly mangle the post when they automatically
generate it from the HTML message.

-- 
Best regards,
Ivan

__
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] Please help me debugg

2021-11-05 Thread Shrinivas Dharma
I am trying to run the following double loop which  I have written but it
is not running.
Unable to get my head around the mistake. Please try to spot the bug and
help

> for(i in 1:122){
+ for(j in 1:68){
+ if(V(FriendGraph)$name[i]==names[j]){
+ gender_vector[i]<-sex[j]
+ break;}
+ else{gender_vector[i]<-NA}
+ } }

*Error in `[.data.frame`(sex, j) : undefined columns selectedCalled from:
`[.data.frame`(sex, j)*
Browse[1]>

-- 
Warm Regards,
*Shrinivas Dharmadhikari*

Metric Consultancy Ltd.
91, Florida Estate,
Keshavanagar, Mundhwa
Pune-411036.

M: +91 98 230 09850
E : dha...@metricuk.com
www.metricglobal.com

*P* Please consider the environment and do not print this email unless
absolutely necessary.

[[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] please help me a little

2018-02-09 Thread Jeff Newmiller
I don't use coxphf, but it is generally a bad idea to reference variables via 
multiple environments (e.g. global and the data= argument in this case) 
directly from within a formula. Just use FAM138A.chr wherever you have used 
test[,6] and it should work. 
-- 
Sent from my phone. Please excuse my brevity.

On February 9, 2018 8:43:03 PM PST, "Ding, Yuan Chun"  wrote:
>Hi R Users,
>
>I am very frustrated with the following code. Please do me a favor to
>run it.
>
>after reading into the test data set (I also pasted the data set
>below), the first line of code for "res_coxphf" did not work and
>generated the error code below. but the other three line worked well.  
>the second line for "res_coxphf2" should be the same as the first line;
>I need to run more than 100 variables in a loop, so I want to do test[,
>i], that is why I want to use the first line.
>
>however, the fourth line for "res_coxphf_cnaRate " also worked well
>after I added one variable "cna.rate" to first line. Can you run them
>and tell me why the first line does not run correctly?
>
>please install coxphf package if you do not have it installed.
>
>Thank you very much!!!
>
>Ding
>
>test<-read.csv("data_coxphf.csv", head=T)
>res_coxphf <- coxphf(formula=Surv(RFS_days2, OV_Had_a_Recurrence_CODE)
>~test[, 6], data=test)
>res_coxphf2 <- coxphf(formula=Surv(RFS_days2, OV_Had_a_Recurrence_CODE)
>~ test$FAM138A.chr1, data=test)
>
>res_coxph <- coxph(formula=Surv(RFS_days2, OV_Had_a_Recurrence_CODE) ~
>test[, 6], data=test)
>res_coxphf_cnaRate <- coxphf(formula=Surv(RFS_days2,
>OV_Had_a_Recurrence_CODE) ~ test[, 6]+ cna.rate, data=test)
>
>
>> test<-read.csv("data_coxphf.csv", head=T)
>> res_coxphf <- coxphf(formula=Surv(RFS_days2,
>OV_Had_a_Recurrence_CODE) ~ test[, 6], data=test)
>Error in mm1[, !colInter, drop = FALSE] :
>  (subscript) logical subscript too long
>> res_coxph <- coxph(formula=Surv(RFS_days2, OV_Had_a_Recurrence_CODE)
>~ test[, 6], data=test)
>> res_coxphf_cnaRate <- coxphf(formula=Surv(RFS_days2,
>OV_Had_a_Recurrence_CODE) ~ test[, 6]+ cna.rate, data=test)
>> res_coxphf2 <- coxphf(formula=Surv(RFS_days2,
>OV_Had_a_Recurrence_CODE) ~ test$FAM138A.chr1, data=test)
>>
>
>
>
>id  cna.rateRFS_days2   OV_Had_a_Recurrence_CODE   
>DDX11L1.chr1FAM138A.chr1FAM138F.chr1
>sn1 150 560 1   0   0   0
>sn10216 581 1   0   0   0
>sn11191 455 1   0   0   0
>sn12135 118 1   0   0   0
>sn13199 25500   0   0   0
>sn14312 477 1   0   0   0
>sn15260 216 1   0   0   0
>sn16400 10561   0   0   0
>sn17350 398 1   1   1   1
>sn18324 583 1   0   0   0
>sn19174 136 1   0   0   0
>sn20262 98  1   0   0   0
>sn21172 516 1   0   0   0
>sn22490 14391   0   0   0
>sn23165 365 1   0   0   0
>sn24185 168 1   0   0   0
>sn25396 16631   0   0   0
>sn26240 299 1   0   0   0
>sn27114 29170   0   0   0
>sn28128 50  1   0   0   0
>sn29190 654 1   0   0   0
>sn3 435 429 1   0   0   0
>sn30268 31  1   0   0   0
>sn31175 34070   0   0   0
>sn32248 277 1   0   0   0
>sn33116 306 1   0   0   0
>sn34122 52  1   0   0   0
>sn35222 77  1   0   0   0
>sn36414 242 1   0   0   0
>sn37300 10341   1   1   1
>sn38268 32980   0   0   0
>sn4 556 24240   0   0   0
>sn40274 201 1   0   0   0
>sn41267 268 1   0   0   0
>sn42325 147 1   0   0   0
>sn43323 26110   0   0   0
>sn44115 573 1   0   0   0
>sn45265 215 1   0   0   0
>sn48129 259 1   0   0   0
>sn5 114 183 1   0   0   0
>sn51183 219 1   0   0   0
>sn52314 271 1   0   0   0
>sn53465 20710   0   0   0
>sn54207 44  1   0   0   0
>sn55321 347 1   0   0   0
>sn56217 12570   0   0   0
>sn57209 262 1   0   0   0
>sn58227 18110   0   0   0
>sn59130 463 1   0   0   0
>sn6 320 306 1   0   0   0
>sn60136 456 1   0   0   0
>sn62208 48  1   0   0   0
>sn63253 452 1   0  

[R] please help me a little

2018-02-09 Thread Ding, Yuan Chun
Hi R Users,

I am very frustrated with the following code. Please do me a favor to run it.

after reading into the test data set (I also pasted the data set below), the 
first line of code for "res_coxphf" did not work and generated the error code 
below. but the other three line worked well.   the second line for 
"res_coxphf2" should be the same as the first line; I need to run more than 100 
variables in a loop, so I want to do test[, i], that is why I want to use the 
first line.

however, the fourth line for "res_coxphf_cnaRate " also worked well after I 
added one variable "cna.rate" to first line. Can you run them and tell me why 
the first line does not run correctly?

please install coxphf package if you do not have it installed.

Thank you very much!!!

Ding

test<-read.csv("data_coxphf.csv", head=T)
res_coxphf <- coxphf(formula=Surv(RFS_days2, OV_Had_a_Recurrence_CODE) ~test[, 
6], data=test)
res_coxphf2 <- coxphf(formula=Surv(RFS_days2, OV_Had_a_Recurrence_CODE) ~ 
test$FAM138A.chr1, data=test)

res_coxph <- coxph(formula=Surv(RFS_days2, OV_Had_a_Recurrence_CODE) ~ test[, 
6], data=test)
res_coxphf_cnaRate <- coxphf(formula=Surv(RFS_days2, OV_Had_a_Recurrence_CODE) 
~ test[, 6]+ cna.rate, data=test)


> test<-read.csv("data_coxphf.csv", head=T)
> res_coxphf <- coxphf(formula=Surv(RFS_days2, OV_Had_a_Recurrence_CODE) ~ 
> test[, 6], data=test)
Error in mm1[, !colInter, drop = FALSE] :
  (subscript) logical subscript too long
> res_coxph <- coxph(formula=Surv(RFS_days2, OV_Had_a_Recurrence_CODE) ~ test[, 
> 6], data=test)
> res_coxphf_cnaRate <- coxphf(formula=Surv(RFS_days2, 
> OV_Had_a_Recurrence_CODE) ~ test[, 6]+ cna.rate, data=test)
> res_coxphf2 <- coxphf(formula=Surv(RFS_days2, OV_Had_a_Recurrence_CODE) ~ 
> test$FAM138A.chr1, data=test)
>



id  cna.rateRFS_days2   OV_Had_a_Recurrence_CODE
DDX11L1.chr1FAM138A.chr1FAM138F.chr1
sn1 150 560 1   0   0   0
sn10216 581 1   0   0   0
sn11191 455 1   0   0   0
sn12135 118 1   0   0   0
sn13199 25500   0   0   0
sn14312 477 1   0   0   0
sn15260 216 1   0   0   0
sn16400 10561   0   0   0
sn17350 398 1   1   1   1
sn18324 583 1   0   0   0
sn19174 136 1   0   0   0
sn20262 98  1   0   0   0
sn21172 516 1   0   0   0
sn22490 14391   0   0   0
sn23165 365 1   0   0   0
sn24185 168 1   0   0   0
sn25396 16631   0   0   0
sn26240 299 1   0   0   0
sn27114 29170   0   0   0
sn28128 50  1   0   0   0
sn29190 654 1   0   0   0
sn3 435 429 1   0   0   0
sn30268 31  1   0   0   0
sn31175 34070   0   0   0
sn32248 277 1   0   0   0
sn33116 306 1   0   0   0
sn34122 52  1   0   0   0
sn35222 77  1   0   0   0
sn36414 242 1   0   0   0
sn37300 10341   1   1   1
sn38268 32980   0   0   0
sn4 556 24240   0   0   0
sn40274 201 1   0   0   0
sn41267 268 1   0   0   0
sn42325 147 1   0   0   0
sn43323 26110   0   0   0
sn44115 573 1   0   0   0
sn45265 215 1   0   0   0
sn48129 259 1   0   0   0
sn5 114 183 1   0   0   0
sn51183 219 1   0   0   0
sn52314 271 1   0   0   0
sn53465 20710   0   0   0
sn54207 44  1   0   0   0
sn55321 347 1   0   0   0
sn56217 12570   0   0   0
sn57209 262 1   0   0   0
sn58227 18110   0   0   0
sn59130 463 1   0   0   0
sn6 320 306 1   0   0   0
sn60136 456 1   0   0   0
sn62208 48  1   0   0   0
sn63253 452 1   0   0   0
sn64326 282 1   0   0   0
sn67260 229 1   0   0   0
sn68329 661 0   0   0   0
sn69478 44  1   0   0   0
sn7 263 582 1   0   0   0
sn70309 741 1   0   0   0
sn8 223 10700   0   0   0
sn9 211 216 1   0   0   0


---

Re: [R] Please help me, I'm trying to update my version of R

2016-08-23 Thread KMNanus
Thanks for getting back to me. Worked like a charm.  


Ken
kmna...@gmail.com
914-450-0816 (tel)
347-730-4813 (fax)



> On Aug 22, 2016, at 11:45 PM, Thomas Mailund  wrote:
> 
> Hi Ken,
> 
> You are trying to install R as a package. That won't work. The .pkg file you 
> downloaded from https://cran.r-project.org/bin/macosx/ is an installer, 
> though, so if you just double-click on it, it should take you through the 
> installation. After that you probably need to install a number of packages, 
> since the ones you have installed for version 3.2 R won't be available in the 
> 3.3 installation, but *those* packages you can install using install.packages.
> 
> Cheers
> 
> -- 
> Thomas Mailund
> On 22 August 2016 at 22:17:50, KMNanus (kmna...@gmail.com 
> ) wrote:
> 
>> I’m a newbie running 3.2.4 on a mac equipped with Yosemite (10.10.5).
>> 
>> I want to update to 3.3.1 and have downloaded the package, but have not been 
>> able to install it. I’ve tried install.packages("R-3.3.1.tar.gz”) and 
>> install.packages("R-3.3.1.pkg”) after downloading both files.
>> 
>> I get an error msg - "package ‘R-3.3.1.pkg’ is not available (for R version 
>> 3.2.4)"
>> 
>> I know this question has shown up on several message boards but I’m having 
>> trouble understanding the process.
>> 
>> Is there a straightforward way to update my version of R and, if successful, 
>> will R automatically work with the packages I’ve installed?
>> 
>> Ken Nanus
>> kmna...@gmail.com
>> 914-450-0816  (tel)
>> 347-730-4813  (fax)
>> 
>> 
>> 
>> __
>> 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] Please help me, I'm trying to update my version of R

2016-08-22 Thread Berend Hasselman
Follow up on my previous mail.

See the FAQ for OS X :https://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html

Read the section  "3.2 Installation of packages". It tells it all.
(reachable from the contents entry "How to install packages").

Berend


> On 23 Aug 2016, at 08:27, Berend Hasselman  wrote:
> 
>> 
>> On 22 Aug 2016, at 22:17, KMNanus  wrote:
>> 
>> I’m a newbie running 3.2.4 on a mac equipped with Yosemite (10.10.5).
>> 
>> I want to update to 3.3.1 and have downloaded the package, but have not been 
>> able to install it.  I’ve tried install.packages("R-3.3.1.tar.gz”) and 
>> install.packages("R-3.3.1.pkg”) after downloading both files.
>> 
>> I get an error msg - "package ‘R-3.3.1.pkg’ is not available (for R version 
>> 3.2.4)"
>> 
>> I know this question has shown up on several message boards but I’m having 
>> trouble understanding the process.
>> 
>> Is there a straightforward way to update my version of R and, if successful, 
>> will R automatically work with the packages I’ve installed?
>> 
> 
> This question is actually for R-SIG-Mac.
> 
> After double clicking on the R-3.3.1.pkg you will have R 3.3.1 installed.
> You don't need to run install.packages to get the packages for R-3.3.1.
> You can have R install the current versions of the packages you had installed.
> 
> Start the R GUI.
> Go to the menu: 
> - Click Packages & Data
> - select Package Installer
> - click Get List
> - click the disclosure triangle in the Package Search input field. And then 
> click Select packages from R.
> 
> This should work if your previous installation of R was installed by the 
> regular installer of R on Mac OS X.
> 
> Berend
> 
>> Ken Nanus
>> kmna...@gmail.com
>> 914-450-0816 (tel)
>> 347-730-4813 (fax)
>> 
>> 
>> 
>> __
>> 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-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] Please help me, I'm trying to update my version of R

2016-08-22 Thread Berend Hasselman

> On 22 Aug 2016, at 22:17, KMNanus  wrote:
> 
> I’m a newbie running 3.2.4 on a mac equipped with Yosemite (10.10.5).
> 
> I want to update to 3.3.1 and have downloaded the package, but have not been 
> able to install it.  I’ve tried install.packages("R-3.3.1.tar.gz”) and 
> install.packages("R-3.3.1.pkg”) after downloading both files.
> 
> I get an error msg - "package ‘R-3.3.1.pkg’ is not available (for R version 
> 3.2.4)"
> 
> I know this question has shown up on several message boards but I’m having 
> trouble understanding the process.
> 
> Is there a straightforward way to update my version of R and, if successful, 
> will R automatically work with the packages I’ve installed?
> 

This question is actually for R-SIG-Mac.

After double clicking on the R-3.3.1.pkg you will have R 3.3.1 installed.
You don't need to run install.packages to get the packages for R-3.3.1.
You can have R install the current versions of the packages you had installed.

Start the R GUI.
Go to the menu: 
- Click Packages & Data
- select Package Installer
- click Get List
- click the disclosure triangle in the Package Search input field. And then 
click Select packages from R.

This should work if your previous installation of R was installed by the 
regular installer of R on Mac OS X.

Berend

> Ken Nanus
> kmna...@gmail.com
> 914-450-0816 (tel)
> 347-730-4813 (fax)
> 
> 
> 
> __
> 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] Please help me, I'm trying to update my version of R

2016-08-22 Thread Thomas Mailund
Hi Ken,

You are trying to install R as a package. That won't work. The .pkg file you 
downloaded from https://cran.r-project.org/bin/macosx/ is an installer, though, 
so if you just double-click on it, it should take you through the installation. 
After that you probably need to install a number of packages, since the ones 
you have installed for version 3.2 R won't be available in the 3.3 
installation, but *those* packages you can install using install.packages.

Cheers

--
Thomas Mailund

On 22 August 2016 at 22:17:50, KMNanus 
(kmna...@gmail.com) wrote:

I’m a newbie running 3.2.4 on a mac equipped with Yosemite (10.10.5).

I want to update to 3.3.1 and have downloaded the package, but have not been 
able to install it. I’ve tried install.packages("R-3.3.1.tar.gz”) and 
install.packages("R-3.3.1.pkg”) after downloading both files.

I get an error msg - "package ‘R-3.3.1.pkg’ is not available (for R version 
3.2.4)"

I know this question has shown up on several message boards but I’m having 
trouble understanding the process.

Is there a straightforward way to update my version of R and, if successful, 
will R automatically work with the packages I’ve installed?

Ken Nanus
kmna...@gmail.com
914-450-0816 (tel)
347-730-4813 (fax)



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

[[alternative HTML version deleted]]

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

[R] Please help me, I'm trying to update my version of R

2016-08-22 Thread KMNanus
I’m a newbie running 3.2.4 on a mac equipped with Yosemite (10.10.5).

I want to update to 3.3.1 and have downloaded the package, but have not been 
able to install it.  I’ve tried install.packages("R-3.3.1.tar.gz”) and 
install.packages("R-3.3.1.pkg”) after downloading both files.

I get an error msg - "package ‘R-3.3.1.pkg’ is not available (for R version 
3.2.4)"

I know this question has shown up on several message boards but I’m having 
trouble understanding the process.

Is there a straightforward way to update my version of R and, if successful, 
will R automatically work with the packages I’ve installed?

Ken Nanus
kmna...@gmail.com
914-450-0816 (tel)
347-730-4813 (fax)



__
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] please help me for my project

2015-09-07 Thread Bert Gunter
... But This list has a *no homework* policy, and this sounds like homework.

Cheers,
Bert


Bert Gunter

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


On Mon, Sep 7, 2015 at 12:17 PM, John Kane  wrote:
> Some suggestions on how to ask a question on the R-help list
>
> John Kane
> Kingston ON Canada
>
>
>> -Original Message-
>> From: ghada.f...@gmail.com
>> Sent: Mon, 7 Sep 2015 16:57:19 +0300
>> To: r-help@r-project.org
>> Subject: [R] please help me for my project
>>
>> Hello dears member
>> I have project to analysis clusters algorithm in R
>> "K-mean, Hierarchical, Density based and EM"
>> I want to calculate
>> Cluster instance , number of iteration , sum of squared error SSE and the
>> accuracy for each cluster algorithms that i mention above
>> And the log likelihood for EM and DBSCAN
>>
>>   [[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.
>
> 
> FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
> family!
> Visit http://www.inbox.com/photosharing to find out more!
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] please help me for my project

2015-09-07 Thread John Kane
Some suggestions on how to ask a question on the R-help list

John Kane
Kingston ON Canada


> -Original Message-
> From: ghada.f...@gmail.com
> Sent: Mon, 7 Sep 2015 16:57:19 +0300
> To: r-help@r-project.org
> Subject: [R] please help me for my project
> 
> Hello dears member
> I have project to analysis clusters algorithm in R
> "K-mean, Hierarchical, Density based and EM"
> I want to calculate
> Cluster instance , number of iteration , sum of squared error SSE and the
> accuracy for each cluster algorithms that i mention above
> And the log likelihood for EM and DBSCAN
> 
>   [[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.


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

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


[R] please help me for my project

2015-09-07 Thread Ghada Almousa
Hello dears member
I have project to analysis clusters algorithm in R
"K-mean, Hierarchical, Density based and EM"
I want to calculate
Cluster instance , number of iteration , sum of squared error SSE and the
accuracy for each cluster algorithms that i mention above
And the log likelihood for EM and DBSCAN

[[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] please help me in r

2015-04-28 Thread Jim Lemon
Hi Ghada,
The value returned by Mclust ("m" in your example) has different
components from say the hierarchical clustering. The second argument
for "cluster.stats" is the cluster IDs of the objects in the initial
set. Perhaps if you call it like this:

cluster.stats(d,m$classification)

I don't have the mclust package, so this is a guess.

Jim


On Wed, Apr 29, 2015 at 3:39 AM, Ghada Almousa  wrote:
> Hello dears
>
> I using (R tool) in my project
> and I want to compare the results betwen k-mean cluster ,Hierarchical
> cluster and EM cluster
>   I use cluster.stats() it's work on k-mean cluster and hrarichal cluster
> but not work in EM
>
> Hello Dears
>  I Use R tool in my project
> I want to do comparison of the results between the k-mean cluster
> ,Hierarchical cluster and EM cluster
>I use cluster.stats () function that it is working on a the k-mean
> cluster ,Hierarchical cluster  But do not work in EM
> mydata<-(data)
> my <-data.matrix(mydata)
> d<-dist(as.matrix(my
>  library(mclust)
> m <- Mclust(d, G =2)
> cluster.stats(d, m
> Error in max(clustering) : invalid 'type' (list) of argument
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


[R] please help me in r

2015-04-28 Thread Ghada Almousa
Hello dears

I using (R tool) in my project
and I want to compare the results betwen k-mean cluster ,Hierarchical
cluster and EM cluster
  I use cluster.stats() it's work on k-mean cluster and hrarichal cluster
but not work in EM

Hello Dears
 I Use R tool in my project
I want to do comparison of the results between the k-mean cluster
,Hierarchical cluster and EM cluster
   I use cluster.stats () function that it is working on a the k-mean
cluster ,Hierarchical cluster  But do not work in EM
mydata<-(data)
my <-data.matrix(mydata)
d<-dist(as.matrix(my
 library(mclust)
m <- Mclust(d, G =2)
cluster.stats(d, m
Error in max(clustering) : invalid 'type' (list) of argument

[[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] Please help me to short my code

2013-11-08 Thread arun
Hi,
Try either:
Ceramic <- read.table("ceramic.dat",header=TRUE)
Ceramic1 <- Ceramic
Ceramic$indx <- ((seq_len(nrow(Ceramic))-1)%/%60)+1
library(plyr)
DF1 <- data.frame(M=as.vector(t(ddply(Ceramic,.(indx), colwise(mean))[,-1])), 
S=as.vector(t(ddply(Ceramic,.(indx),colwise(sd))[,-1])),Rep = 60)
 colnames(DF)[3] <- colnames(DF1)[3]
 identical(DF,DF1)
#[1] TRUE


#or
 indx <- ((seq_len(nrow(Ceramic))-1)%/%60)+1
Ceramic2 <-  do.call(data.frame, c(aggregate(.~indx,data=Ceramic1,function(x) 
c(mean(x),sd(x))), check.names=FALSE))[,-1]
 DF2 <- data.frame(M= as.vector(t(Ceramic2[,seq(1,ncol(Ceramic2),by=2)])), S= 
as.vector(t(Ceramic2[,seq(2,ncol(Ceramic2),by=2)])),Rep =60)
identical(DF,DF2)
#[1] TRUE



A.K.


please help me to short the code 

#To import data onto R 
Ceramic<-read.table("D:/ceramic.dat",header=T) 
#to obtain mean, standard deviation and number of observations- 
LAB1<-Ceramic[1:60,] 
LAB2<-Ceramic[61:120,] 
LAB3<-Ceramic[121:180,] 
LAB4<-Ceramic[181:240,] 
LAB5<-Ceramic[241:300,] 
LAB6<-Ceramic[301:360,] 
LAB7<-Ceramic[361:420,] 
LAB8<-Ceramic[421:480,] 
M1<-sapply(LAB1,mean) 
M2<-sapply(LAB2,mean) 
M3<-sapply(LAB3,mean) 
M4<-sapply(LAB4,mean) 
M5<-sapply(LAB5,mean) 
M6<-sapply(LAB6,mean) 
M7<-sapply(LAB7,mean) 
M8<-sapply(LAB8,mean) 
S1<-sapply(LAB1,sd) 
S2<-sapply(LAB2,sd) 
S3<-sapply(LAB3,sd) 
S4<-sapply(LAB4,sd) 
S5<-sapply(LAB5,sd) 
S6<-sapply(LAB6,sd) 
S7<-sapply(LAB7,sd) 
S8<-sapply(LAB8,sd) 
#tabulating results- 
M<-c(M1,M2,M3,M4,M5,M6,M7,M8) 
S<-c(S1,S2,S3,S4,S5,S6,S7,S8) 
DF<-data.frame(M,S,c(rep(60)))

__
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] Please help me

2012-11-24 Thread emable_wahid
i want to generate an odf report using R,
the report is generated but the run stop just after the instruction:
odfWeave(inputFile,outputFile)
and i get this error:

Error in odfWeave(inf, outf) : Error removing work dir

please help me it's an emergency.
thanks



--
View this message in context: 
http://r.789695.n4.nabble.com/Please-help-me-tp4650674.html
Sent from the R help mailing list archive at Nabble.com.

__
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] please help me

2012-05-02 Thread Uwe Ligges



On 02.05.2012 02:55, Ulfa Hasanah wrote:

hi all,can you help me? index moran is very difficut for me, i have data n 
neighbor as enclosure:
please help me to make the program for find index moran value each 
variabel,...thank very much



Which translates to:

please help me, and note that

- I have to do some homework
- I do not want to read the posting guide
- I do not want to read a stats textbook about the methods I have to apply
- I do not want to read An Introduction to R
- I do not want to fix the broken shift key of my keyboard
- I am too lazy to type what I did so far


Now, I think we can assume that it is impossible to help you with a 
simple e-mail response. Please ask your supervisor.


Uwe Ligges





__
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-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] please help me

2012-05-01 Thread Ulfa Hasanah
hi all,can you help me? index moran is very difficut for me, i have data n 
neighbor as enclosure:
please help me to make the program for find index moran value each 
variabel,...thank very much
__
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] please Help me on a repeated measures anova

2010-12-30 Thread David Winsemius


On Dec 30, 2010, at 10:11 AM, David Winsemius wrote:



On Dec 30, 2010, at 5:38 AM, soileil wrote:



So far I've done this:



tableau = read.table("Classeur1.txt", h=T)
tableau

  Temps.s. Modalite  AchE
1 15   ER   0,1


snipped data

103  120   SED+ED  0,19
104  120   SED+ED 0,172

attach (tableau)




tableau <- lm (AchE ~ Temps.s. * Modalite, random = ~ 1 | individu)

Erreur dans storage.mode(y) <- "double" :
la modification du mode de stockage


Even without an English translation, it seems very likely that the  
AchE variable is not of numeric class,  but rather a factor. You may  
want to redo your data input step with a setting for the decimal  
separator set properly for the conventions of your locale settings.  
See help(read.table)


And the other _big_  problem that I did not notice at first is that  
you are overwriting your data with the model output. This isn't  
exactly the problem addressed by fortune("dog") but an even more  
severe case of identity conflation. This is even a further example of  
why it is a bad idea to use the attach function.




You may also want to look at the settings for locale if you will  
typically be using "," as a decimal separator.


?options
?locales



d'un objet 'factor' n'est pas
autorisée
De plus : Messages d'avis :
1: In model.response(mf, "numeric") :
l'utilisation de type="numeric" avec une réponse de type facteur sera
ignorée
2: In lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
les arguments surnuméraires random sont ignorés.

What is my mistake?
--
View this message in context: 
http://r.789695.n4.nabble.com/please-Help-me-on-a-repeated-measures-anova-tp3159868p3168134.html
Sent from the R help mailing list archive at Nabble.com.


--

David Winsemius, MD
West Hartford, CT

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


David Winsemius, MD
West Hartford, CT

__
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] please Help me on a repeated measures anova

2010-12-30 Thread David Winsemius


On Dec 30, 2010, at 5:38 AM, soileil wrote:



So far I've done this:



tableau = read.table("Classeur1.txt", h=T)
tableau

   Temps.s. Modalite  AchE
1 15   ER   0,1


snipped data

103  120   SED+ED  0,19
104  120   SED+ED 0,172

attach (tableau)




tableau <- lm (AchE ~ Temps.s. * Modalite, random = ~ 1 | individu)

Erreur dans storage.mode(y) <- "double" :
 la modification du mode de stockage


Even without an English translation, it seems very likely that the  
AchE variable is not of numeric class,  but rather a factor. You may  
want to redo your data input step with a setting for the decimal  
separator set properly for the conventions of your locale settings.  
See help(read.table)


You may also want to look at the settings for locale if you will  
typically be using "," as a decimal separator.


?options
?locales



d'un objet 'factor' n'est pas
autorisée
De plus : Messages d'avis :
1: In model.response(mf, "numeric") :
 l'utilisation de type="numeric" avec une réponse de type facteur sera
ignorée
2: In lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
 les arguments surnuméraires random sont ignorés.

What is my mistake?
--
View this message in context: 
http://r.789695.n4.nabble.com/please-Help-me-on-a-repeated-measures-anova-tp3159868p3168134.html
Sent from the R help mailing list archive at Nabble.com.


--

David Winsemius, MD
West Hartford, CT

__
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] please Help me on a repeated measures anova

2010-12-30 Thread soileil

So far I've done this:


> tableau = read.table("Classeur1.txt", h=T)
> tableau
Temps.s. Modalite  AchE
1 15   ER   0,1
2 15   ER 0,112
3 15T+0,5 0,078
4 15T+0,5 0,053
5 15  TED 0,107
6 15  TED 0,117
7 15  TED 0,124
8 15  T+1 0,109
9 15  T+1 0,118
1015   SED+ER 0,158
1115   SER+ED 0,119
1215   SED+ED 0,101
1315   SED+ED 0,129
1430   ER  0,11
1530   ER 0,134
1630T+0,5 0,082
1730T+0,5   0,1
1830  TED 0,126
1930  TED 0,135
2030  TED 0,145
2130  T+1 0,119
2230  T+1 0,134
2330   SED+ER 0,175
2430   SER+ED  0,14
2530   SED+ED 0,113
2630   SED+ED 0,135
2730   ER 0,123
2830   ER 0,153
2930T+0,5 0,088
3030T+0,5 0,109
3130  TED 0,141
3230  TED 0,153
3330  TED 0,163
3430  T+1 0,134
3530  T+1 0,153
3630   SED+ER 0,194
3730   SER+ED 0,157
3830   SED+ED  0,18
3930   SED+ED  0,14
4060   ER 0,135
4160   ER 0,174
4260T+0,5 0,094
4360T+0,5  0,12
4460  TED 0,161
4560  TED 0,169
4660  TED 0,187
4760  T+1 0,148
4860  T+1  0,17
4960   SED+ER 0,208
5060   SER+ED 0,174
5160   SED+ED  0,14
5260   SED+ED 0,146
5375   ER 0,147
5475   ER 0,192
5575T+0,5 0,101
5675T+0,5 0,127
5775  TED 0,172
5875  TED 0,183
5975  TED 0,208
6075  T+1 0,163
6175  T+1 0,184
6275   SED+ER 0,226
6375   SER+ED 0,192
6475   SED+ED 0,154
6575   SED+ED 0,153
6690   ER 0,159
6790   ER 0,208
6890T+0,5 0,108
6990T+0,5 0,136
7090  TED 0,184
7190  TED 0,201
7290  TED 0,227
7390  T+1 0,174
7490  T+1 0,197
7590   SED+ER  0,24
7690   SER+ED 0,208
7790   SED+ED 0,166
7890   SED+ED 0,159
79   105   ER 0,171
80   105   ER 0,226
81   105T+0,5 0,113
82   105T+0,5 0,145
83   105  TED   0,2
84   105  TED 0,218
85   105  TED 0,244
86   105  T+1 0,187
87   105  T+1 0,214
88   105   SED+ER 0,259
89   105   SER+ED 0,225
90   105   SED+ED 0,179
91   105   SED+ED 0,165
92   120   ER 0,182
93   120   ER 0,251
94   120T+0,5  0,12
95   120T+0,5 0,154
96   120  TED 0,213
97   120  TED 0,229
98   120  TED 0,259
99   120  T+1 0,202
100  120  T+1 0,228
101  120   SED+ER 0,268
102  120   SER+ED  0,24
103  120   SED+ED  0,19
104  120   SED+ED 0,172
> attach (tableau)


> tableau <- lm (AchE ~ Temps.s. * Modalite, random = ~ 1 | individu)
Erreur dans storage.mode(y) <- "double" : 
  la modification du mode de stockage d'un objet 'factor' n'est pas
autorisée
De plus : Messages d'avis :
1: In model.response(mf, "numeric") :
  l'utilisation de type="numeric" avec une réponse de type facteur sera
ignorée
2: In lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
  les arguments surnuméraires random sont ignorés.

What is my mistake?
-- 
View this message in context: 
http://r.789695.n4.nabble.com/please-Help-me-on-a-repeated-measures-anova-tp3159868p3168134.html
Sent from the R help mailing list archive at Nabble.com.

__
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] please Help me on a repeated measures anova

2010-12-30 Thread soileil

In fact, the imbalance of repetitions is a time effect. Indeed, some measures
have been carried out in the morning and another in the afternoon. And we
could show this difference with a Friedman. So the question I ask myself
after what I had just read is that there is no difference? Increasing the
enzyme concentration was correlated with time?
-- 
View this message in context: 
http://r.789695.n4.nabble.com/please-Help-me-on-a-repeated-measures-anova-tp3159868p3168096.html
Sent from the R help mailing list archive at Nabble.com.

__
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] please Help me on a repeated measures anova

2010-12-21 Thread Dennis Murphy
Hi:

I did the following (note a fix to the assumed typo in t + 0.5 -> T + 0.5)
using the melt() function in package reshape2, the lattice graphics package
and package lme4. I named your input data df.

library(reshape) # or reshape2 if you have it
# Fix the typo:
df[4, 1] <- 'T+0.5'
# Redefine the factor to produce the correct number of levels:
df$traitement <- factor(df$traitement)
# Create a subject variable to distinguish profiles in time
df$subject <- as.numeric(row.names(df))
# reshape the data from wide format to long
dm <- melt(df, id = c('traitement', 'subject'))
# sort the reshaped data frame
dm <- dm[order(dm$traitement, dm$subject, dm$variable), ]
head(dm)
# Create a numeric time variable by stripping off the 't's
dm$time <- as.numeric(sub('^t','', dm$variable))

# Plot the individual profiles over time by treatment type
library(lattice)
xyplot(value ~ time | traitement, data = dm, groups = subject, type = c('p',
'l'))

# The individual profiles are almost uniformly linearly increasing
# with a couple of obvious nonconforming points visible in the plots.
# There are mean differences among treatments,
# but also unbalanced replication in subjects. Treatment (SED + ER) has only
one subject.

# One way to fit a model:
library(lme4)
m1 <- lmer(value ~ traitement  + (1 + time | subject), data = dm, reml = 0)
summary(m1)

This fits a mixed effects model with random subjects and time as a repeated
measures variable, using maximum likelihood to fit the model. This
particular specification treats time as numeric rather than factor because
the linear component is so strong, but it is possible to replace it with the
factor version instead (variable in data frame dm). The output of this model
fit shows a very small residual effect, a strong correlation between time
and subject (the sign seems wrong, though) and about the same amount of
variation between subjects as within subjects. This is a model you should
seriously consider, as it takes proper account of the randomness of subjects
and the nesting of time as a linear effect within subject. I would encourage
you to follow this direction, but there is much to learn if you are to use
the lme4 package.

I suspect, however, you're looking for something more along the lines of
Anova() in the car package, which uses the 'traditional' ANOVA approach to
repeated measures models. If you go in this direction, be sure you
understand the underlying assumptions of the model.

For multiple comparisons, which I presume you'll want to investigate,
there's the TukeyHSD() function that you could use with Anova(), or for more
general methods, the multcomp package, which has a function glht() that can
be used with a mixed effects model per above or with an Anova() object. The
multcomp package has several useful vignettes and a recent book that
describes its essential features.

Refs:
Bretz, Hothorn and Westfall (2010). Multiple Comparisons in R. Chapman &
Hall.
Fox and Weisberg (2011). An R Companion to Applied Regression, 2nd ed. Sage
Publications.  (Just out!)

HTH,
Dennis


On Tue, Dec 21, 2010 at 3:10 PM, soileil  wrote:

>
> I currently work on a draft of an aquatic bioassessment. The conditions
> tested are the following: ER river water T dechlorinated water control 0.5
> +
> 0.5mg / L of malate T + 1 dechlorinated water control + 1g / L of malate T
> ED dechlorinated water control SED + ER + river water sediment SED ED +
> sediment + water dechlorinated. It is the result of AChE in muscle (fillet
> of fish). The production of acetylcholine is followed with a
> spectrophotometer every 15 seconds for two minutes. The results are
> presented in the following table:
>
>
> traitement t15 t30 t45 t60 t75 t90 t105 t120
> ER 0.100 0.110 0.123 0.135 0.147 0.159 0.171 0.182
> ER 0.112 0.134 0.153 0.174 0.192 0.208 0.226 0.251
> T+0.5 0.078 0.082 0.088 0.094 0.101 0.108 0.113 0.120
> t+0.5 0.053 0.100 0.109 0.120 0.127 0.136 0.145 0.154
> TED 0.107 0.126 0.141 0.161 0.172 0.184 0.200 0.213
> TED 0.117 0.135 0.153 0.169 0.183 0.201 0.218 0.229
> TED 0.124 0.145 0.163 0.187 0.208 0.227 0.244 0.259
> T+1 0.109 0.119 0.134 0.148 0.163 0.174 0.187 0.202
> T+1 0.118 0.134 0.153 0.170 0.184 0.197 0.214 0.228
> SED+ER 0.158 0.175 0.194 0.208 0.226 0.240 0.259 0.268
> SED+ED 0.119 0.140 0.157 0.174 0.192 0.208 0.225 0.240
> SED+ED 0.101 0.113 0.180 0.140 0.154 0.166 0.179 0.190
> SED+ED 0.129 0.135 0.140 0.146 0.153 0.159 0.165 0.172
>
>
> The statistical test is considered a repeated measures anova but I do not
> know how to do it in R. I watched the forums and I downloaded the R package
> 'nlme' by which I should be able to use the function 'lm'. But the problem
> is that I can not encode this function. Could you help me?
> --
> View this message in context:
> http://r.789695.n4.nabble.com/please-Help-me-on-a-repeated-measures-anova-tp3159868p3159868.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> R-help@r-project

[R] please Help me on a repeated measures anova

2010-12-21 Thread soileil

I currently work on a draft of an aquatic bioassessment. The conditions
tested are the following: ER river water T dechlorinated water control 0.5 +
0.5mg / L of malate T + 1 dechlorinated water control + 1g / L of malate T
ED dechlorinated water control SED + ER + river water sediment SED ED +
sediment + water dechlorinated. It is the result of AChE in muscle (fillet
of fish). The production of acetylcholine is followed with a
spectrophotometer every 15 seconds for two minutes. The results are
presented in the following table:


traitement t15 t30 t45 t60 t75 t90 t105 t120
ER 0.100 0.110 0.123 0.135 0.147 0.159 0.171 0.182
ER 0.112 0.134 0.153 0.174 0.192 0.208 0.226 0.251
T+0.5 0.078 0.082 0.088 0.094 0.101 0.108 0.113 0.120
t+0.5 0.053 0.100 0.109 0.120 0.127 0.136 0.145 0.154
TED 0.107 0.126 0.141 0.161 0.172 0.184 0.200 0.213
TED 0.117 0.135 0.153 0.169 0.183 0.201 0.218 0.229
TED 0.124 0.145 0.163 0.187 0.208 0.227 0.244 0.259
T+1 0.109 0.119 0.134 0.148 0.163 0.174 0.187 0.202
T+1 0.118 0.134 0.153 0.170 0.184 0.197 0.214 0.228
SED+ER 0.158 0.175 0.194 0.208 0.226 0.240 0.259 0.268
SED+ED 0.119 0.140 0.157 0.174 0.192 0.208 0.225 0.240
SED+ED 0.101 0.113 0.180 0.140 0.154 0.166 0.179 0.190
SED+ED 0.129 0.135 0.140 0.146 0.153 0.159 0.165 0.172


The statistical test is considered a repeated measures anova but I do not
know how to do it in R. I watched the forums and I downloaded the R package
'nlme' by which I should be able to use the function 'lm'. But the problem
is that I can not encode this function. Could you help me?
-- 
View this message in context: 
http://r.789695.n4.nabble.com/please-Help-me-on-a-repeated-measures-anova-tp3159868p3159868.html
Sent from the R help mailing list archive at Nabble.com.

__
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] please help me out

2010-11-30 Thread Dieter Menne


Bill Yang wrote:
> 
> 
> why the following codes do not run
>> weekdays(as.Date('2010-11-30')) == "Monday"[1] FALSE> >
>> weekdays(as.Date('2010-11-29')) == "Monday"[1] FALSE
> 
> 

Because only in the old Mayan calendar 2010-11-30 is a monday. It is a
"Dienstag" on my computer, so as an additional Bonus you should consider
language settings.

Divide and conquer is the method to go

weekdays(as.Date('2010-11-30'))
[1] "Zyschtig" 
(special Swiss language setting)

should have helped.

Dieter


-- 
View this message in context: 
http://r.789695.n4.nabble.com/please-help-me-out-tp3066730p3066778.html
Sent from the R help mailing list archive at Nabble.com.

__
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] please help me out

2010-11-30 Thread Bill Yang



Hi there,
why the following codes do not run
> weekdays(as.Date('2010-11-30')) == "Monday"[1] FALSE> > 
> weekdays(as.Date('2010-11-29')) == "Monday"[1] FALSE

I appreciate,
Bill  
[[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] Please, help me with 'mattern' variogram

2010-11-16 Thread David Cross
I think the problem is with the (2,2) element in your hessian, unless  
that is a typo.


Cheers

David Cross
d.cr...@tcu.edu
www.davidcross.us




On Nov 16, 2010, at 8:33 PM, Jimmy Martina wrote:



Hi, R-folks:

I have been tryin many combination of parameter to make Matern  
variogram to work, but I can't find the available one. I'm near to  
be crazy.

I tiped:
Año2003Selg.lf<- 
likfit 
(Año2003Selg 
,cov 
.model 
= 
"matern 
",ini 
.cov 
.pars 
= 
c 
(1.5,14 
),kappa 
= 
2.5 
,fix 
.kappa=FALSE,nugget=0.08,lambda=0.008,fix.lambda=FALSE,hessian=TRUE)


the hessian shows:

$hessian
 [,1]   [,2][,3]  [,4]
[1,]  9.139986  -8.562736e+00   41.648355 -3.801615
[2,] -8.562736  3.351952e+159 -147.279881 -7.083089
[3,] 41.648355  -1.472799e+02  347.493191 -7.509035
[4,] -3.801615  -7.083089e+00   -7.509035 90.681917

Then, I put:  solve(Año2003Selg.lf$info.minimisation.function$hessian)

...and it's shown as following:

Error in solve.default(Año2003Selg.lf$info.minimisation.function 
$hessian) :
 sistem is computationally singular: number of reciprocity  
condition= 1.05091e-159


on account of I work in Spanish, it's shown:
Error in solve.default(Año2003Selg.lf$info.minimisation.function 
$hessian) :
 sistema es computacionalmente singular: número de condición  
recíproco = 1.05091e-159


I also wander if there is any limit for kappa. Which one would be  
the maximun. As far as I'm concerned, it must be always major than  
cero, right?. I also know that its values depend on the tendency of  
cloud semivariogram, if it flattens slowly (Gaussian) it's major.


I'll thank the one available to answer my desperate question. 		 	
		  


__
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] Please, help me with 'mattern' variogram

2010-11-16 Thread Jimmy Martina

Hi, R-folks:
 
I have been tryin many combination of parameter to make Matern variogram to 
work, but I can't find the available one. I'm near to be crazy.
I tiped:
Año2003Selg.lf<-likfit(Año2003Selg,cov.model="matern",ini.cov.pars=c(1.5,14),kappa=2.5,fix.kappa=FALSE,nugget=0.08,lambda=0.008,fix.lambda=FALSE,hessian=TRUE)
 
the hessian shows:
 
$hessian
  [,1]   [,2][,3]  [,4]
[1,]  9.139986  -8.562736e+00   41.648355 -3.801615
[2,] -8.562736  3.351952e+159 -147.279881 -7.083089
[3,] 41.648355  -1.472799e+02  347.493191 -7.509035
[4,] -3.801615  -7.083089e+00   -7.509035 90.681917

Then, I put:  solve(Año2003Selg.lf$info.minimisation.function$hessian)
 
...and it's shown as following:
 
Error in solve.default(Año2003Selg.lf$info.minimisation.function$hessian) : 
  sistem is computationally singular: number of reciprocity condition= 
1.05091e-159

on account of I work in Spanish, it's shown:
Error in solve.default(Año2003Selg.lf$info.minimisation.function$hessian) : 
  sistema es computacionalmente singular: número de condición recíproco = 
1.05091e-159
 
I also wander if there is any limit for kappa. Which one would be the maximun. 
As far as I'm concerned, it must be always major than cero, right?. I also know 
that its values depend on the tendency of cloud semivariogram, if it flattens 
slowly (Gaussian) it's major.
 
I'll thank the one available to answer my desperate question.   
  __
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] Please help me on a simple avg question

2010-11-16 Thread Henrique Dallazuanna
Try this:

aggregate(TEMP ~ Year + Month + Day, DF, mean)

On Tue, Nov 16, 2010 at 4:48 PM, facehappywy  wrote:

>
> Thanks every one first.
>
> I have a dataset like this
>
> YearMonth   Day HourDIR SPD (m/s)   SKYCOVER
>  TEMP (C)RH(%)
> 20091   1   0   310 13.858243   -5  23
> 20091   1   1   330 14.305283
> -7.226
> 20091   1   2   320 10.728963
> -7.224
> 20091   1   3   320 10.728963
> -6.723
> 20091   1   4   320 10.281923
> -7.226
> 20091   1   5   330 10.281923
> -7.226
> 20091   1   6   330 10.281923
> -7.225
> 20091   1   6   320 12.964163
> -7.226
> 20091   1   7   330 11.176  3   -7.226
> 20091   1   8   330 10.728963
> -7.828
> 20091   1   9   330 10.728963
> -7.827
> 20091   1   9   320 11.176  3   -7.226
> 20091   1   10  320 12.517123
> -7.824
> 20091   1   11  310 9.83488 3   -7.824
> 20091   1   12  310 9.83488 3   -8.325
> 20091   1   12  310 10.728963
> -8.926
> 20091   1   13  320 9.83488 3   -7.826
> 20091   1   14  310 9.83488 3   -7.223
> 20091   1   15  310 9.83488 3   -7.223
> 20091   1   15  320 10.728960
> -7.223
> 20091   1   16  320 8.04672 0   -6.121
> 20091   1   17  300 9.83488 0   -3.918
> 20091   1   18  300 9.83488 0   -4.419
> 20091   1   18  310 9.38784 0   -2.816
> 20091   1   19  320 7.59968 3   -2.816
> 20091   1   20  310 6.25856 3   -2.818
> 20091   1   21  310 6.25856 3   -2.818
> 20091   1   21  310 7.15264 3   -2.816
> 20091   1   22  310 7.59968 3   -2.816
> 20091   1   23  300 5.81152 3   -3.916
>
>
> It is a one year (2009), 12 month, every day, every hour data. Notice that
> there are sometimes several readings  within one hour. I want to calculate
> the hourly avg for each day in each month. Anyone could help me on this.
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Please-help-me-on-a-simple-avg-question-tp3045440p3045440.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> 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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

[[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] Please help me on a simple avg question

2010-11-16 Thread facehappywy

Thanks every one first.

I have a dataset like this

YearMonth   Day HourDIR SPD (m/s)   SKYCOVERTEMP 
(C)RH(%)
20091   1   0   310 13.858243   -5  23
20091   1   1   330 14.305283   -7.2
26
20091   1   2   320 10.728963   -7.2
24
20091   1   3   320 10.728963   -6.7
23
20091   1   4   320 10.281923   -7.2
26
20091   1   5   330 10.281923   -7.2
26
20091   1   6   330 10.281923   -7.2
25
20091   1   6   320 12.964163   -7.2
26
20091   1   7   330 11.176  3   -7.226
20091   1   8   330 10.728963   -7.8
28
20091   1   9   330 10.728963   -7.8
27
20091   1   9   320 11.176  3   -7.226
20091   1   10  320 12.517123   -7.8
24
20091   1   11  310 9.83488 3   -7.824
20091   1   12  310 9.83488 3   -8.325
20091   1   12  310 10.728963   -8.9
26
20091   1   13  320 9.83488 3   -7.826
20091   1   14  310 9.83488 3   -7.223
20091   1   15  310 9.83488 3   -7.223
20091   1   15  320 10.728960   -7.2
23
20091   1   16  320 8.04672 0   -6.121
20091   1   17  300 9.83488 0   -3.918
20091   1   18  300 9.83488 0   -4.419
20091   1   18  310 9.38784 0   -2.816
20091   1   19  320 7.59968 3   -2.816
20091   1   20  310 6.25856 3   -2.818
20091   1   21  310 6.25856 3   -2.818
20091   1   21  310 7.15264 3   -2.816
20091   1   22  310 7.59968 3   -2.816
20091   1   23  300 5.81152 3   -3.916


It is a one year (2009), 12 month, every day, every hour data. Notice that
there are sometimes several readings  within one hour. I want to calculate
the hourly avg for each day in each month. Anyone could help me on this. 
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Please-help-me-on-a-simple-avg-question-tp3045440p3045440.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Please help me about Monte Carlo Permutation

2010-11-02 Thread Łukasz Ręcławowicz
2010/11/2 Chitra 

>
>  yes
>
> >
> >
> > Me too. So you want to do a MC test for Pearson's product-moment
> > correlation, right...?
>
>

So for sample sizes from 3 to about 10 we can use all permutations
[permn(combinat)]- test will be exact! (In our case 7!=5040)

lg<-"lightgreen"
g<-"green"
dg<-"darkgreen"
plot((gamma(1:31)),t="p",main="Suggested tests for r",ylab="Number of
permutations",xlab="n",lwd=2,col=c(rep(lg,10),rep(g,4),rep(dg,17)),log="yx",pch="-",cex=2)
legend(1,range(gamma(4:31))[2],c("exact","MC","cor.test"),col=c(lg,g,dg),pch="-",pt.cex=2)
abline(h=.Machine$integer.max,col=2,lty=3)

We use MC when the number of permutations is very large and we cannot use
them all. Beside, the difference between theoretical distribution for larger
samples >25 will be negligible.
Let's use your data:
> data
Qtot Itot
1 73 684
2 64 451
3 71 378
4 65 284
5 47 179
6 31 117
7 19 69

We get 0.01494540 from cor.test

> cor.test(data[,1],data[,2])

Let's write a function for our test, it might be something like:

cor.test.mc<-function(x,y,n=1e3){
our.data<-cbind(x,y)
if (!is.numeric(our.data[,1]) || !is.numeric(our.data[,2]))
stop("Only numeric variables are allowed.")
l<-length(our.data[,1])
if (l < 3)
stop("At least 3 samples are required.")
DNAME <- paste(deparse(substitute(x)), "and" ,deparse(substitute(y)))
samples<-unique(t(replicate(n,(sample(our.data[,1])
loop<-dim(samples)[1]
correlations<-rep(NA,loop)
for(i in 1:loop){
correlations[i]<-cor(our.data[,2],samples[i,])
}
observed<-cor(our.data[,1],our.data[,2])
GE<-sum(correlations>=observed)
LT<-sum(correlations<(-observed))
two.tailed.p<-(GE+LT)/loop
rea<-(loop/gamma(l+1))*100
RVAL <- list(statistic = c(r = observed), p.value = two.tailed.p, method =
"Monte Carlo Pearson's r test" ,
data.name = DNAME,samples=c(" Number of used unique
permutations"=loop),total=c("Percent of all possible
permutations"=round(rea,2)))
class(RVAL) <- "htest"
#But what kind of plot you wish to have - I don't know...
#hist(correlations,col="blue",xlab="r",xlim=c(-1,1),breaks=50)
return(RVAL)
gc()
}
cor.test.mc(data[,1],data[,2])
test<-cor.test.mc(data[,1],data[,2],6e4)
test
test$samples
test$total
#

And that's it. Our p-value is sum of 7/5040 (GE) and 61/5040 (LT).
You may also take a look @ library(MChtest).
Hope this helps!


-- 
Mi³ego dnia

[[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] Please help me about Monte Carlo Permutation

2010-11-01 Thread Chitra

yes,
and also plotting them.
Thanks.

2010/11/1 Łukasz Ręcławowicz [via R] <
ml-node+3022778-293096829-200...@n4.nabble.com
>

> 2010/10/29 Chitra <[hidden 
> email]>
>
>
> >
> >  I am sorry I got lost here.
>
>
> Me too. So you want to do a MC test for Pearson's product-moment
> correlation, right...?
>
>
> --
> Mi³ego dnia
>
> [[alternative HTML version deleted]]
>
>
> __
> [hidden email] 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.
>
>
> --
>  View message @
> http://r.789695.n4.nabble.com/Please-help-me-about-Monte-Carlo-Permutation-tp3017131p3022778.html
> To unsubscribe from Please help me about Monte Carlo Permutation, click
> here.
>
>
>


-- 
Chitra Bahadur Baniya (PhD)
Lecturer
Central Department of Botany
Tribhuvan University
Kirtipur
Kathmandu, Nepal

-- 
View this message in context: 
http://r.789695.n4.nabble.com/Please-help-me-about-Monte-Carlo-Permutation-tp3017131p3023137.html
Sent from the R help mailing list archive at Nabble.com.

[[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] Please help me about Monte Carlo Permutation

2010-11-01 Thread Łukasz Ręcławowicz
2010/10/29 Chitra 

>
>  I am sorry I got lost here.


Me too. So you want to do a MC test for Pearson's product-moment
correlation, right...?


-- 
Mi³ego dnia

[[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] Please help me about Monte Carlo Permutation

2010-10-29 Thread Chitra

Hi dear Mi³ego dnia,
I am sorry I got lost here.
May be it it sound if I write you about what I am going to do.

"To test such null hypotheses we used the Monte Carlo test, i.e. we chose
randomly (5000 times) a value for the
current dependent characteristic (richness or actual species pool) in the
interval 0 to the maximum possible
value of the dependent variable for each observed value of the current
independent variable. The maximum observed
value was either the calculated size of the regional pool, or the measured
size of the actual pool. Each time,
we calculated the correlation coefficient r between the independent and
dependent variables in order to achieve
the empirical distribution of r for the null hypothesis conditions. The
empirical probability of cases with a correlation
between the two studied variables positive and stronger than that observed
in the real data, served as an estimate
of the significance level for rejecting the null hypotheses. Thus, by saying
that there exists a significant
relationship, we mean that the relationship is significantly stronger than
expected from our null model".


I hope I can get all necessary R code for analyses.
Chitra
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Please-help-me-about-Monte-Carlo-Permutation-tp3017131p3019329.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Please help me about Monte Carlo Permutation

2010-10-29 Thread Łukasz Ręcławowicz
2010/10/29 Chitra 

>
> £ukasz Rêc³awowicz,
> Thanks.
> I got this p-value.
>

It's exact upper tail (>=), for lower you have to add (<(-test.statistic))
to obtain two-sided p-vaule.

> > test()
> [1] P-value: 0.00139
>
> I still could not figure out how to plot 5000 permuted Qtot vs Itot.
>

Result of permuted.Qtot<-permn(data$Qtot) is the list class object, so we
can plot something very strange like a

plot(rep(data$Itot,5040)~unlist(permuted.Qtot))

But I don't think it's what you want to get...







-- 
Mi³ego dnia

[[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] Please help me about Monte Carlo Permutation

2010-10-28 Thread Chitra

Łukasz Ręcławowicz,
Thanks.
I got this p-value.
> test()
[1] P-value: 0.00139

I still could not figure out how to plot 5000 permuted Qtot vs Itot.


-- 
View this message in context: 
http://r.789695.n4.nabble.com/Please-help-me-about-Monte-Carlo-Permutation-tp3017131p3018399.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Please help me about Monte Carlo Permutation

2010-10-28 Thread Łukasz Ręcławowicz
I'm not sure is this correct, but maybe you are looking for something like
this:

test<-function(){
permuted.Qtot<-permn(data$Qtot)
n<-length(permuted.Qtot)
correlation<-rep(NA,n)
for(i in 1:n){
correlation[i]<-cor(data$Itot,permuted.Qtot[[i]])}
p<-sum(correlation>=cor(data$Qtot,data$Itot))/n
print(paste("P-value:", round(p,5)),quote=F)
}
test()

-- 
Mi³ego dnia

[[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] Please help me about Monte Carlo Permutation

2010-10-28 Thread Chitra

Dear Kjetil,
Thanks a lot for your help. I could not get histogram when I ask by R. It
simply gave me blank plot between frequency and test. I want to plot sample
(y) verses xl. Can you please tell me are both variables were permuted or
only x?
Thanking your help,
Chitra
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Please-help-me-about-Monte-Carlo-Permutation-tp3017131p3017634.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Please help me about Monte Carlo Permutation

2010-10-28 Thread Kjetil Halvorsen
This is one way. I read your two columns of data into
two variables, x and y. Then:

 test <- replicate(5000, cor(x, sample(y)))
> hist(test)


Kjetil

On Thu, Oct 28, 2010 at 9:49 AM, Chitra  wrote:
>
>> Dear R experts,
>>I am sorry for my inability.
>>I have the following dataset:
>
>  > Qtot Itot
>>1   73  684
>>2   64  451
>>3   71  378
>>4   65  284
>>5   47  179
>>6   31  117
>>7   19   69
>>
>>Now I need to perform Monte Carlo Pertutation test underlaying the
> following condition.
>>
>>
>>Condition
>>
>>In order to choose randomly (5000 times) for the Qtot in the interval 0 to
> the maximum possible value of
>>
>>Qtot for each observed value of the independent variable (Itot), Monte
> Carlo tests needed to be perform to test the null hypothesis. The
>>maximum observed value is either the calculated size of the regional pool
> (Interpolated value), or the measured size of the actual
>>
>>pool. Each time correlation coefficient (r) between independent and
> dependent variable has to be calculated in order to achieve
>>
>>the empirical distribution of r for the null hypothesis conditions.
>>
>>Now please help me how to do?
>>I have also intalled combinat library in R. But could not perform by
> myself.
>>I will be highly grateful.
>>Thanks.
>>
> -->
> Chitra Bahadur Baniya (PhD)
> Lecturer
> Central Department of Botany
> Tribhuvan University
> Kirtipur
> Kathmandu, Nepal
>
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Please-help-me-about-Monte-Carlo-Permutation-tp3017131p3017131.html
> Sent from the R help mailing list archive at Nabble.com.
>
>        [[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-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] Please help me about Monte Carlo Permutation

2010-10-28 Thread Chitra

> Dear R experts,
>I am sorry for my inability.
>I have the following dataset:

 > Qtot Itot
>1   73  684
>2   64  451
>3   71  378
>4   65  284
>5   47  179
>6   31  117
>7   19   69
>
>Now I need to perform Monte Carlo Pertutation test underlaying the
following condition.
>
>
>Condition
>
>In order to choose randomly (5000 times) for the Qtot in the interval 0 to
the maximum possible value of
>
>Qtot for each observed value of the independent variable (Itot), Monte
Carlo tests needed to be perform to test the null hypothesis. The
>maximum observed value is either the calculated size of the regional pool
(Interpolated value), or the measured size of the actual
>
>pool. Each time correlation coefficient (r) between independent and
dependent variable has to be calculated in order to achieve
>
>the empirical distribution of r for the null hypothesis conditions.
>
>Now please help me how to do?
>I have also intalled combinat library in R. But could not perform by
myself.
>I will be highly grateful.
>Thanks.
>
-->
Chitra Bahadur Baniya (PhD)
Lecturer
Central Department of Botany
Tribhuvan University
Kirtipur
Kathmandu, Nepal

-- 
View this message in context: 
http://r.789695.n4.nabble.com/Please-help-me-about-Monte-Carlo-Permutation-tp3017131p3017131.html
Sent from the R help mailing list archive at Nabble.com.

[[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] Please help me simplify my manipulation and printing of function calls

2010-10-05 Thread Paul Sherliker
Background: 
I use R for a fair-sized graphics program, intended for naïve users.  This 
works, 
but a less-naïve user wants it to generate code producing the graphs that he 
can 
then modify (but which will not contain my numerous manipulations and attempts 
to 
discern what the user wants).

Quite possibly this is a standard R activity, but I've been unable to find it;
likely I have a mental block about search terms.

The natural way to do this seems _to_me_ to be to create wrapper functions for 
R's graphics functions, each of which will, if needed, echo the call to a file. 
 
Then I need only replace graphics function calls with wrapper function calls, 
and 
can avoid complicating my program enormously.  Is there something better that 
will 
maintain this goal?  (If it's relevant, I'm reluctant to tell my naïve users to 
download packages.)

Main question:
My version of a wrapper function, in some valid code(*), follows; I would like 
to simplify 
it if I can.  (other attempts fell down trying to handle the ... argument that 
many 
graphics functions have, probably because I fail to understand the use of ...)
I'm also nervous that my approach may fail to work for some functions; is there 
a hidden flaw?

(*) but you'll have to change the file reference in OnyxEchoFile

esegments<-function(x0, y0, x1=x0, y1=y0, col=par("fg"), lty=par("lty"), 
   lwd=par("lwd"), ...)
   {
   # collect the call as a suitable list, using match.call
   TheCallList <- as.list(match.call())
   # turn it into (list version of) a call to the graphics function we actually 
want
   TheCallList[[1]]<-quote(segments)
   # replace the variable names used with their values
   # (because I do not wish to record all the messy calculation I do)
   if (length(TheCallList)>1)
  {
  for (iarg in seq(2, length(TheCallList)))
 {
 TheCallList[[iarg]]<-eval(TheCallList[[iarg]])
 }
  }
   # make it back into a call
   TheCall<-as.call(TheCallList)
   # and finally call it
   ToReturn<-eval(TheCall)

   # and the purpose of the whole shebang is to be able to record the 
   # raw graphics call for posterity
   if (DoOnyxEcho==TRUE) capture.output(TheCall, file=OnyxEchoFile, append=TRUE)
   
   # mimic the return from segments (NULL in this case, but not generally)
   invisible(ToReturn)
   }

DoOnyxEcho<-TRUE
OnyxEchoFile<-"d:\\ftp\\echotest.r"

plot(1:20)
start<-10
end<-15

esegments(start, start, end, end, lty="dashed", lend=2)

Thank you!

- Paul Sherliker

__
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] please help me....

2010-09-30 Thread Joshua Wiley
Hi,

I am not entirely certain how you think we can help.  Many
theses/dissertations are not widely published, but there is often a
copy stored at the local institution's library.  I would also assume
that Jan Ulbricht has a copy, which if it is not available online and
it is impossible for you to visit the library, is probably your best
bet.

Here is his website:

http://www.statistik.lmu.de/~ulbricht/index.html

and I think this is the address of the statistics department at the university:

Institut für Statistik
Ludwig-Maximilians-Universität München
Ludwigstr. 33
80539 München

Best of luck to you,

Josh

On Thu, Sep 30, 2010 at 11:28 AM, butchman  wrote:
>
> ㅣ recently used laq packages
> author of this package is jan Ulbricht..
> and I must read jan ulbricht's Ph.D thesis
> "variable selection in generalized linear models"
> but I didn't find this thesis on line and there is any method to view this
> thesis??
> If anybody has this thesis file,please send to me...
> I must this guy's Ph.D. thesis...
> I searched LMU online library..but this thesis did not exist...
> please help me...very very very important issue for me..
> mu e-mail address:butchma...@gmail.com
>
>
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/please-help-me-tp2739350p2739350.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> 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.
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/

__
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] please help me....

2010-09-30 Thread butchman

ㅣ recently used laq packages
author of this package is jan Ulbricht..
and I must read jan ulbricht's Ph.D thesis
"variable selection in generalized linear models"
but I didn't find this thesis on line and there is any method to view this
thesis??
If anybody has this thesis file,please send to me...
I must this guy's Ph.D. thesis...
I searched LMU online library..but this thesis did not exist...
please help me...very very very important issue for me..
mu e-mail address:butchma...@gmail.com


-- 
View this message in context: 
http://r.789695.n4.nabble.com/please-help-me-tp2739350p2739350.html
Sent from the R help mailing list archive at Nabble.com.

__
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] please help me on this warning message

2010-07-22 Thread Siri Bjoner

Sorry, I'm getting error messages on your email?

Anyhows... Spellcheck. You're using uncertainy and uncertainTy (the  
latter being correct but the former being what you've programmed).


Good luck!

Siri.

Siterer Na.Ebrahimi :


hi,
When I try to use the function coordProj {mclust}

"  
coordProj(diabetes[,-1],dimens=c(2,3),what="uncertainy",uncertainty=diabetesModel$uncertainty,parameters=diabetesModel$parameters)  
"


to identify uncertainty, it errors and send this warning message:

" Warning message:
In coordProj(diabetes[, -1], dimens = c(2, 3), what = "uncertainy",  :
  what improperly specified  "

I am confuzed and I would be so glad if you help me
thank you in anticipation

[[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-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] please help me on this warning message

2010-07-22 Thread Na.Ebrahimi
hi,
When I try to use the function coordProj {mclust}
 
" 
coordProj(diabetes[,-1],dimens=c(2,3),what="uncertainy",uncertainty=diabetesModel$uncertainty,parameters=diabetesModel$parameters)
 "
 
to identify uncertainty, it errors and send this warning message:
 
" Warning message:
In coordProj(diabetes[, -1], dimens = c(2, 3), what = "uncertainy",  :
  what improperly specified  "
 
I am confuzed and I would be so glad if you help me
thank you in anticipation

[[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] please help me for this Error: cannot listen to TCP port 15259

2010-07-22 Thread Allan Engelhardt
The short-term work-around is probably to use the help_type= argument to 
help, e.g.


help("help", help_type="text")

Hope this helps a little.

Allan

On 22/07/10 07:30, Na.Ebrahimi wrote:

hi,
I get an Error when I try to run function "help" in R,
it says
  "starting httpd help server ...Error: cannot listen to TCP port 15259"
I would be so glad if you help me




__
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] please help me for this Error: cannot listen to TCP port 15259

2010-07-22 Thread Na.Ebrahimi
hi,
I get an Error when I try to run function "help" in R,
it says
 "starting httpd help server ...Error: cannot listen to TCP port 15259"
I would be so glad if you help me

[[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] Please help me

2010-06-09 Thread Joris Meys
Dear Xionqing,

It's still difficult to say without the data, but I guess the error message
reads "System computation is singular", meaning you just have too many
variables or some variables are near-aliases of eachother. I did not ask to
read the posting guide to be difficult. Without some reproducible code and
detailed information on the data, it's impossible to say what is the problem
exactly.

Cheers
Joris

On Wed, Jun 9, 2010 at 2:47 AM, Xiongqing Zhang  wrote:

> Dear Joris,
>
> Thank for your  reply.
>
>
> Firstly, I introduced one dummy variable (eg: u=0, the first group; u=1,
> the second group) to the model, and I got the results (parameter estimators
> and AIC value).
>
> #zero inflated negative binomial model
>
> library(pscl)
>
> dat=read.csv("data.csv",header=T)
>
> zinb <- zeroinfl(y ~x1+x2+x3+x4+x5+u | x1+x2+x3+x4+x5+u, data = dat, link=
> "logit", dist = "negbin")
>
> summary(zinb)
>
>
>
> But the results are not satisfied to me. So I decided to introduce two
> dummy variables (u1,u2) to the model, and then I could not get the results.
>
>
>
> dat=read.csv("data.csv",header=T)
>
> zinb <- zeroinfl(y ~x1+x2+x3+x4+x5+u1+u2 | x1+x2+x3+x4+x5+u1+u2, data =
> dat, link= "logit", dist = "negbin")
>
> summary(zinb)
>
> And the error message is
>
> “error in solve.default(as.matrix(fit$hessian)) :
>
>   System computation is unsigular
>
> moreover: Warning message:
>
> In glm.fit(Z, as.integer(Y0), weights = weights, family = binomial(link =
> linkstr),  :
>
>   algorithm did not converge”
>
>
>
> Again, many thanks for you.
>
>
>
> Sincerely,
>
> Xiongqing
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> --- On *Tue, 6/8/10, Joris Meys * wrote:
>
>
> From: Joris Meys 
> Subject: Re: [R] Please help me
> To: "Xiongqing Zhang" 
> Cc: r-help@r-project.org
> Date: Tuesday, June 8, 2010, 11:22 AM
>
>
> First, read the posting guides.
> Then, supply us with a bit more information, like the package you
> used, example code that reproduces the error, information about the
> data, the complete error message, the traceback (use the function
> traceback() right after you got the error).
>
> Otherwise we ain't going to be able to help you.
>
> Cheers
> Joris
>
> On Tue, Jun 8, 2010 at 9:42 AM, Xiongqing Zhang 
> http://cn.mc453.mail.yahoo.com/mc/compose?to=xqzhan...@yahoo.com>>
> wrote:
> >
> > Dear Mr. or Ms.,
> >
> > I used the R-software to run the zero-inflatoin negative binomial model
> (zeroinfl()) .
> >
> > Firstly, I introduced one dummy variable to the model as an independent
> variable, and I got the estimators of parameters. But the results are not
> satisfied to me. So I introduced three dummy variables to the model. but I
> could not get the results. And the error message is
> "solve.default(as.matrix(fit$gaussian)) ". I do not know the reasons fully.
> And I want to know what method was used to estimate the parameters when I
> called the function zeroinfl() .
> >
> > I will be very appreciate if you can help me. Thank you.
> >
> > Best regards,
> >
> > Sincerely,
> > Xiongqing Zhang
> >
> >
> >
> >[[alternative HTML version deleted]]
> >
> >
> > __
> > R-help@r-project.org<http://cn.mc453.mail.yahoo.com/mc/compose?to=r-h...@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<http://www.r-project.org/posting-guide.html>
> > and provide commented, minimal, self-contained, reproducible code.
> >
> >
>
>
>
> --
> Joris Meys
> Statistical consultant
>
> Ghent University
> Faculty of Bioscience Engineering
> Department of Applied mathematics, biometrics and process control
>
> tel : +32 9 264 59 87
> joris.m...@ugent.be<http://cn.mc453.mail.yahoo.com/mc/compose?to=joris.m...@ugent.be>
> ---
> Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php
>
>
>


-- 
Joris Meys
Statistical consultant

Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control

tel : +32 9 264 59 87
joris.m...@ugent.be
---
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

[[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] Please help me

2010-06-08 Thread Joris Meys
First, read the posting guides.
Then, supply us with a bit more information, like the package you
used, example code that reproduces the error, information about the
data, the complete error message, the traceback (use the function
traceback() right after you got the error).

Otherwise we ain't going to be able to help you.

Cheers
Joris

On Tue, Jun 8, 2010 at 9:42 AM, Xiongqing Zhang  wrote:
>
> Dear Mr. or Ms.,
>
> I used the R-software to run the zero-inflatoin negative binomial model 
> (zeroinfl()) .
>
> Firstly, I introduced one dummy variable to the model as an independent 
> variable, and I got the estimators of parameters. But the results are not 
> satisfied to me. So I introduced three dummy variables to the model. but I 
> could not get the results. And the error message is 
> "solve.default(as.matrix(fit$gaussian)) ". I do not know the reasons fully. 
> And I want to know what method was used to estimate the parameters when I 
> called the function zeroinfl() .
>
> I will be very appreciate if you can help me. Thank you.
>
> Best regards,
>
> Sincerely,
> Xiongqing Zhang
>
>
>
>        [[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.
>
>



-- 
Joris Meys
Statistical consultant

Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control

tel : +32 9 264 59 87
joris.m...@ugent.be
---
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

__
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] Please help me

2010-06-08 Thread Xiongqing Zhang

Dear Mr. or Ms.,
 
I used the R-software to run the zero-inflatoin negative binomial model 
(zeroinfl()) .
 
Firstly, I introduced one dummy variable to the model as an independent 
variable, and I got the estimators of parameters. But the results are not 
satisfied to me. So I introduced three dummy variables to the model. but I 
could not get the results. And the error message is 
"solve.default(as.matrix(fit$gaussian)) ". I do not know the reasons fully. And 
I want to know what method was used to estimate the parameters when I called 
the function zeroinfl() .
 
I will be very appreciate if you can help me. Thank you.
 
Best regards,
 
Sincerely,
Xiongqing Zhang


  
[[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] Please help Me(R Language)

2010-03-26 Thread SADANANDAM MADDELA
Hi

thank you very much for advanced help.
I am new to R language..
I am using  r language with asp.net. while i am  run below code.  the
graphics window open out side of my *.aspx *page(it is opened as a
*pop up*window) .i need to open that window with in my .
*aspx *page(without using( png,jpg  etc...) & any of image formats.)

code:
StatConnector objStatConn = new
STATCONNECTORSRVLib.StatConnectorClass();
objStatConn.Init("R");
objStatConn.Evaluate("x <- 5");
objStatConn.Evaluate("y <- 40");
objStatConn.EvaluateNoReturn("plot(x,y)");




-- 
Thanks & Regards
M.Sadanandam

[[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] Please help me how to make input files in Extremes Toolkit model

2010-03-04 Thread David Winsemius


On Mar 4, 2010, at 5:47 AM, Huyen Quan wrote:


Dear sir/madam

My name is Quan, I am a PhD student in Korea. my major is  
Hydrological in Water Resources Engineering. I am interested in  
Extremes Toolkit model and I known you from information in internet.
I installed successfully this model but I didn't know how to make  
the type of  files input for this model such as: Flood.dat;  
Ozone4H.dat; Flood.R; HEAT.R. (free download these files of example  
and show in attachment files)


No files were attached. Did you read the Posting Guide section that  
describes what sorts of files can be sent through the r-help server?




I want to learn the way make these files from sample files. 
http://www.isse.ucar.edu/extremevalues/evtk.html

but i can not download those files because this link was errored.


Sorry to hear of your difficulties, but don't you think this is an  
issue to be resolved by your local administrator? That link works  
perfectly well for me.




Please help me how to get this file and to make files input, if you  
have some sample files, please send to me to learn and make them.


thank you so much for your help me and hope to see your infomation  
as soon as possible.


Mr. Ngo Quan




David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
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] Please help me how to make input files in Extremes Toolkit model

2010-03-04 Thread Huyen Quan
Dear sir/madam
 
My name is Quan, I am a PhD student in Korea. my major is Hydrological in Water 
Resources Engineering. I am interested in Extremes Toolkit model and I known 
you from information in internet. 
I installed successfully this model but I didn't know how to make the type of  
files input for this model such as: Flood.dat; Ozone4H.dat; Flood.R; 
HEAT.R. (free download these files of example and show in attachment files)
I want to learn the way make these files from sample 
files. http://www.isse.ucar.edu/extremevalues/evtk.html 
 
but i can not download those files because this link was errored. 
 
Please help me how to get this file and to make files input, if you have some 
sample files, please send to me to learn and make them.
 
thank you so much for your help me and hope to see your infomation as soon as 
possible.
 
Mr. Ngo Quan


  __
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] Please help me!!!! Error in `[.data.frame`(x, , retained, drop = FALSE) : undefined columns selected

2010-01-03 Thread bbslover

thanks ,now i reduce the number of the descriptors, It is ok.



在2010-01-03,"Max Kuhn [via R]"  
写道: -原始邮件-
发件人:"Max Kuhn [via R]" 
发送时间:2010年1月3日 星期日
收件人:bbslover 
主题:Re: [R] Please help me Error in `[.data.frame`(x, , retained, drop = 
FALSE) : undefined columns selected

Your data set has 217 predictors and 166 samples. If you read the 
vignette on feature selection for this package, you'll see that the 
default ranking mechanism that it uses for linear models requires a 
linear model fit. The note that: 

   >  prediction from a rank-deficient fit may be misleading 

should tell you something. If it doesn't: the model fit is over 
determined and there is no unique solution, so many of the parameter 
estimates are NA. 

Either create a modified version of lmFuncs that suits your needs or 
remove variables prior to modeling (or try some other method that 
doesn't require more samples than predictors, such as the lasso or 
elasticnet). 

Max 

On Fri, Jan 1, 2010 at 10:14 PM, bbslover <[hidden email]> wrote: 

> 
> I am learning the package "caret", after I do the "rfe" function, I get the 
> error ,as follows: 
> 
> Error in `[.data.frame`(x, , retained, drop = FALSE) : 
>  undefined columns selected 
> In addition: Warning message: 
> In predict.lm(object, x) : 
>  prediction from a rank-deficient fit may be misleading 
> 
> 
> I try to that manual example, that is good, my data is wrong. I do not know 
> what reanson? 
> 
> my code is : 
> 
>  subsets<-c(1:5,10,15,20,25) 
>  ctrl<-rfeControl(functions=lmFuncs, method  = "cv", 
>verbose=FALSE,returnResamp="final") 
>  lmProfile<-rfe(trainDescr,trainY,sizes=subsets,rfeControl=ctrl) 
> 
> before it, I have do some pre-process and my data is in the attachment. 
> 
> Please help me.  thank you! 
> 
> kevinhttp://n4.nabble.com/file/n996068/trainDescr.txt trainDescr.txt 
>http://n4.nabble.com/file/n996068/trainY.txt trainY.txt 
> -- 
> View this message in 
> context:http://n4.nabble.com/Please-help-me-Error-in-data-frame-x-retained-drop-FALSE-undefined-columns-selected-tp996068p996068.html
> Sent from the R help mailing list archive at Nabble.com. 
> 
> __ 
>[hidden email]mailing list 
>https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code. 
> 



-- 

Max 

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



View message 
@http://n4.nabble.com/Please-help-me-Error-in-data-frame-x-retained-drop-FALSE-undefined-columns-selected-tp996068p997387.html
To unsubscribe from Please help me Error in `[.data.frame`(x, , retained, 
drop = FALSE) : undefined columns selected,click here. 


-- 
View this message in context: 
http://n4.nabble.com/Please-help-me-Error-in-data-frame-x-retained-drop-FALSE-undefined-columns-selected-tp996068p997622.html
Sent from the R help mailing list archive at Nabble.com.

[[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] Please help me!!!! Error in `[.data.frame`(x, , retained, drop = FALSE) : undefined columns selected

2010-01-02 Thread bbslover

thanks,
  
  I have reduce the  number of descriptors, and the erroe is none, my major
is qsar, but what is the criterion to select descritors, and how many
descriptors should be selected, It is a problem, I calculate my descriptors
troungh E-dragon, and apply the wonderful package caret,but my result is
poor, how can i improve my performance?

Max is an expert in this field I think ,can you give me some suggestion in
how can I well learn QSAR and build the perfect models based on nonlinear
and linear. Here, only myself do QSAR research study lonely, and I have no
some software to calculate descriptors except free ons, I just know
e-dragon,  have others?

and good tools to do QSAR?   thank you  again.

kevin!

Max Kuhn wrote:
> 
> Your data set has 217 predictors and 166 samples. If you read the
> vignette on feature selection for this package, you'll see that the
> default ranking mechanism that it uses for linear models requires a
> linear model fit. The note that:
> 
>>  prediction from a rank-deficient fit may be misleading
> 
> should tell you something. If it doesn't: the model fit is over
> determined and there is no unique solution, so many of the parameter
> estimates are NA.
> 
> Either create a modified version of lmFuncs that suits your needs or
> remove variables prior to modeling (or try some other method that
> doesn't require more samples than predictors, such as the lasso or
> elasticnet).
> 
> Max
> 
> On Fri, Jan 1, 2010 at 10:14 PM, bbslover  wrote:
>>
>> I am learning the package "caret", after I do the "rfe" function, I get
>> the
>> error ,as follows:
>>
>> Error in `[.data.frame`(x, , retained, drop = FALSE) :
>>  undefined columns selected
>> In addition: Warning message:
>> In predict.lm(object, x) :
>>  prediction from a rank-deficient fit may be misleading
>>
>>
>> I try to that manual example, that is good, my data is wrong. I do not
>> know
>> what reanson?
>>
>> my code is :
>>
>>  subsets<-c(1:5,10,15,20,25)
>>  ctrl<-rfeControl(functions=lmFuncs, method  = "cv",
>>            verbose=FALSE,returnResamp="final")
>>  lmProfile<-rfe(trainDescr,trainY,sizes=subsets,rfeControl=ctrl)
>>
>> before it, I have do some pre-process and my data is in the attachment.
>>
>> Please help me.  thank you!
>>
>> kevin http://n4.nabble.com/file/n996068/trainDescr.txt trainDescr.txt
>> http://n4.nabble.com/file/n996068/trainY.txt trainY.txt
>> --
>> View this message in context:
>> http://n4.nabble.com/Please-help-me-Error-in-data-frame-x-retained-drop-FALSE-undefined-columns-selected-tp996068p996068.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> __
>> 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.
>>
> 
> 
> 
> -- 
> 
> Max
> 
> __
> 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.
> 
> 

-- 
View this message in context: 
http://n4.nabble.com/Please-help-me-Error-in-data-frame-x-retained-drop-FALSE-undefined-columns-selected-tp996068p997526.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Please help me!!!! Error in `[.data.frame`(x, , retained, drop = FALSE) : undefined columns selected

2010-01-02 Thread Max Kuhn
Your data set has 217 predictors and 166 samples. If you read the
vignette on feature selection for this package, you'll see that the
default ranking mechanism that it uses for linear models requires a
linear model fit. The note that:

   >  prediction from a rank-deficient fit may be misleading

should tell you something. If it doesn't: the model fit is over
determined and there is no unique solution, so many of the parameter
estimates are NA.

Either create a modified version of lmFuncs that suits your needs or
remove variables prior to modeling (or try some other method that
doesn't require more samples than predictors, such as the lasso or
elasticnet).

Max

On Fri, Jan 1, 2010 at 10:14 PM, bbslover  wrote:
>
> I am learning the package "caret", after I do the "rfe" function, I get the
> error ,as follows:
>
> Error in `[.data.frame`(x, , retained, drop = FALSE) :
>  undefined columns selected
> In addition: Warning message:
> In predict.lm(object, x) :
>  prediction from a rank-deficient fit may be misleading
>
>
> I try to that manual example, that is good, my data is wrong. I do not know
> what reanson?
>
> my code is :
>
>  subsets<-c(1:5,10,15,20,25)
>  ctrl<-rfeControl(functions=lmFuncs, method  = "cv",
>            verbose=FALSE,returnResamp="final")
>  lmProfile<-rfe(trainDescr,trainY,sizes=subsets,rfeControl=ctrl)
>
> before it, I have do some pre-process and my data is in the attachment.
>
> Please help me.  thank you!
>
> kevin http://n4.nabble.com/file/n996068/trainDescr.txt trainDescr.txt
> http://n4.nabble.com/file/n996068/trainY.txt trainY.txt
> --
> View this message in context: 
> http://n4.nabble.com/Please-help-me-Error-in-data-frame-x-retained-drop-FALSE-undefined-columns-selected-tp996068p996068.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> 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.
>



-- 

Max

__
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] Please help me!!!! Error in `[.data.frame`(x, , retained, drop = FALSE) : undefined columns selected

2010-01-01 Thread bbslover

I am learning the package "caret", after I do the "rfe" function, I get the
error ,as follows:

Error in `[.data.frame`(x, , retained, drop = FALSE) : 
  undefined columns selected
In addition: Warning message:
In predict.lm(object, x) :
  prediction from a rank-deficient fit may be misleading


I try to that manual example, that is good, my data is wrong. I do not know
what reanson?

my code is :

  subsets<-c(1:5,10,15,20,25)
  ctrl<-rfeControl(functions=lmFuncs, method  = "cv", 
verbose=FALSE,returnResamp="final")
  lmProfile<-rfe(trainDescr,trainY,sizes=subsets,rfeControl=ctrl)

before it, I have do some pre-process and my data is in the attachment.

Please help me.  thank you!

kevin http://n4.nabble.com/file/n996068/trainDescr.txt trainDescr.txt 
http://n4.nabble.com/file/n996068/trainY.txt trainY.txt 
-- 
View this message in context: 
http://n4.nabble.com/Please-help-me-Error-in-data-frame-x-retained-drop-FALSE-undefined-columns-selected-tp996068p996068.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Please Help me!

2009-10-02 Thread jim holtman
try this:  (?try)

name_c<-Sys.glob("C:/Documents and Settings/lma/My
Documents/habitdata/*/calllog/*")

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

log1<-try(readLines(name_c[i]))
if (inherits(log1, 'try-error')) next  # skip if error


write.table(Temps, file=paste("C:/Documents and Settings/lma/My
Documents/habitdata1",pname,lname,basename(name_c[i]),sep="/"))

}

On Fri, Oct 2, 2009 at 7:04 AM, Tammy Ma  wrote:
>
> Hi, R-users,
>
>
> I have a problem: Because there are few files which can't be readed
> into R completely, so on the following subsequence programme, I use
> write.table, which creates the "NA" files for those incomplete files
> autimatically.
> I don't want those NA files.
>
> My programes formats looks like:
>
>
>
> name_c<-Sys.glob("C:/Documents and Settings/lma/My 
> Documents/habitdata/*/calllog/*")
>
> for (i in 1:length(name_c)){
>
> log1<-readLines(name_c[i])
> 
>
> write.table(Temps, file=paste("C:/Documents and Settings/lma/My 
> Documents/habitdata1",pname,lname,basename(name_c[i]),sep="/"))
>
> }
>
>
> Error Information:
> Error in file(file, ifelse(append, "a", "w")) :
>  cannot open the connection
>
>  In file(file, ifelse(append, "a", "w")) :
>  cannot open file 'C:/Documents and Settings/lma/My 
> Documents/habitdata1/NA/NA/NA': Permission denied
>
>
> I have checked why the error appears, because  when I use "readLines" to read 
> data, but when processing the large data set, there are few files which can 
> not be readed in completely:
>
> 48: In readLines(name_c[i]) ... :
>
> incomplete final line found on 'C:/Documents and Settings/lma/My
> Documents/habitdata/244052900243997/calllog/calllog_log-20050505T121611.txt'
> ...
>
>
> So it create the "NA" file when implementing the subsequence procedure by 
> write.table.How can I do: whenever readLines can't completely read one file, 
> then autimatically doesn't implement the subsequence programmes?
>
> Thanks.
> Tammy
> _
> More than messages–check out the rest of the Windows Live™.
> http://www.microsoft.com/windows/windowslive/
>        [[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.
>
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

__
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] Please Help me!

2009-10-02 Thread Tammy Ma

Hi, R-users,


I have a problem: Because there are few files which can't be readed
into R completely, so on the following subsequence programme, I use
write.table, which creates the "NA" files for those incomplete files
autimatically. 
I don't want those NA files.

My programes formats looks like:



name_c<-Sys.glob("C:/Documents and Settings/lma/My 
Documents/habitdata/*/calllog/*")

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

log1<-readLines(name_c[i])


write.table(Temps, file=paste("C:/Documents and Settings/lma/My 
Documents/habitdata1",pname,lname,basename(name_c[i]),sep="/"))

}


Error Information:
Error in file(file, ifelse(append, "a", "w")) : 
  cannot open the connection

 In file(file, ifelse(append, "a", "w")) :
  cannot open file 'C:/Documents and Settings/lma/My 
Documents/habitdata1/NA/NA/NA': Permission denied


I have checked why the error appears, because  when I use "readLines" to read 
data, but when processing the large data set, there are few files which can not 
be readed in completely:

48: In readLines(name_c[i]) ... :
 
incomplete final line found on 'C:/Documents and Settings/lma/My
Documents/habitdata/244052900243997/calllog/calllog_log-20050505T121611.txt'
...


So it create the "NA" file when implementing the subsequence procedure by 
write.table.How can I do: whenever readLines can't completely read one file, 
then autimatically doesn't implement the subsequence programmes?

Thanks.
Tammy 
_
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/
[[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] please help me about data format.

2009-06-30 Thread Jim Lemon

yongkook Kwon wrote:

Hi~ helpers.

I was surprised by R data type.

I use to data type like table.

I don't know R allow several data type such as list, number, matrix in the
same matrix.

I want to use plsr in pls package to anlaysis data.

So, I read R help and example of plsr.

that example show me that data as yarn has three colname as NIR, density and
train.

the NIR was 268(No. of col) X 71(No. of row) matrix, but  density was just
71 list

yarn[1] indicate NIR, and yarn[2] indicate density

so I just tested like that TEST=c(matrix , list)

But It was wrong.

how can I make like matrix?

Of cource, the python, perl or JAVA could like that.

just simplely but  I don't know in R.

please tell me about that.

  

Hi yongkook,
The easiest way is:

yarn.mat<-as.matrix(yarn)

yarn.mat will now contain the values but in a matrix format.

Jim

__
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] please help me about data format.

2009-06-30 Thread yongkook Kwon
Hi~ helpers.

I was surprised by R data type.

I use to data type like table.

I don't know R allow several data type such as list, number, matrix in the
same matrix.

I want to use plsr in pls package to anlaysis data.

So, I read R help and example of plsr.

that example show me that data as yarn has three colname as NIR, density and
train.

the NIR was 268(No. of col) X 71(No. of row) matrix, but  density was just
71 list

yarn[1] indicate NIR, and yarn[2] indicate density

so I just tested like that TEST=c(matrix , list)

But It was wrong.

how can I make like matrix?

Of cource, the python, perl or JAVA could like that.

just simplely but  I don't know in R.

please tell me about that.

[[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] Please help me subset this dataframe, thanks...

2009-05-03 Thread Tal Galili
Hi Mark.
Have a look at the commands:
merge
and
cbind

I believe they may hold the key.

I hope this helps :-)
Tal







On Mon, May 4, 2009 at 5:38 AM, Mark Na  wrote:

> Dear R-helpers,
>
> I have a dataframe called "trackpoints" with several columns including
> a column called "time", eg:
>
> > trackpoints
> time
> 1   12:00:00
> 2   12:00:01
> 3   12:00:02
> .
> .
> .
> 298 12:04:57
> 299 12:04:58
> 300 12:04:59
>
> I also have a dataframe called "data" that contains columns called
> "ID", "start" and "stop", eg:
>
> > data
>   IDstart stop
> 1  1 12:00:00 12:01:30
> 2  2 12:02:16 12:03:01
> 3  3 12:03:58 12:04:31
>
> I wish to make a dataframe called "extracted" containing only the rows
> in "trackpoints" with a value of "time" bounded by the times in
> data$start and data$stop and a column called "ID" containing the value
> from data$ID, eg:
>
> > extracted
> Time ID
> 1   12:00:00  1
> 2   12:00:01  1
> 3   12:00:02  1
> .
> .
> .
> 89  12:01:28  1
> 90  12:01:29  1
> 91  12:01:30  1
>
> I have the vague notion that I might have to loop this, but I think it
> would be cleaner to use logical subscripts, if possible.
> I'd appreciate any help you might be able to provide.
>
> Thanks! Mark Na
>
> __
> 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.
>



-- 
--


My contact information:
Tal Galili
Phone number: 972-50-3373767
FaceBook: Tal Galili
My Blogs:
http://www.r-statistics.com/
http://www.talgalili.com
http://www.biostatistics.co.il

[[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] Please help me subset this dataframe, thanks...

2009-05-03 Thread Mark Na
Dear R-helpers,

I have a dataframe called "trackpoints" with several columns including
a column called "time", eg:

> trackpoints
        time
1   12:00:00
2   12:00:01
3   12:00:02
.
.
.
298 12:04:57
299 12:04:58
300 12:04:59

I also have a dataframe called "data" that contains columns called
"ID", "start" and "stop", eg:

> data
  ID    start     stop
1  1 12:00:00 12:01:30
2  2 12:02:16 12:03:01
3  3 12:03:58 12:04:31

I wish to make a dataframe called "extracted" containing only the rows
in "trackpoints" with a value of "time" bounded by the times in
data$start and data$stop and a column called "ID" containing the value
from data$ID, eg:

> extracted
        Time ID
1   12:00:00  1
2   12:00:01  1
3   12:00:02  1
.
.
.
89  12:01:28  1
90  12:01:29  1
91  12:01:30  1

I have the vague notion that I might have to loop this, but I think it
would be cleaner to use logical subscripts, if possible.
I'd appreciate any help you might be able to provide.

Thanks! Mark Na

__
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] Please help me to understand environments

2009-03-15 Thread David Winsemius
You might want to look at rm to see how that function handles the  
problem.


--
David Winsemius

On Mar 15, 2009, at 3:14 AM, Ajay Shah wrote:


I want to write:

zap <- function(v) {
 if (exists(v)) {rm(v)}
}

But of course this doesn't work because the rm() acts on v which is
within zap() and doesn't affect the parent environment:


x <- 1
zap("x")
x

[1] 1

How would I make this zap() function work?

--
Ajay Shah


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
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] Please help me to understand environments

2009-03-15 Thread Ajay Shah
I want to write:

zap <- function(v) {
  if (exists(v)) {rm(v)}
}

But of course this doesn't work because the rm() acts on v which is
within zap() and doesn't affect the parent environment:

> x <- 1
> zap("x")
> x
[1] 1

How would I make this zap() function work?

-- 
Ajay Shah  http://www.mayin.org/ajayshah  
ajays...@mayin.org http://ajayshahblog.blogspot.com
<*(:-? - wizard who doesn't know the answer.

__
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] Please help me in Converting this from C# to R [C1]

2008-12-13 Thread Dieter Menne
Taoufik NADIFI  sgcib.com> writes:

> 
> Please, can you tell me if you know how can i use the library Igraph in C# 
> ?

Not easy, but possible. Try to google for "rcom c#" and watch the list

http://www.mail-archive.com/rco...@mailman.csd.univie.ac.at/

where some problems with more the latest R and COM are discussed.

In each case, you should first try all RDCOM example with Visual Basic on your
computer to check if the installation works ok.

Dieter

__
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] Please help me in Converting this from C# to R [C1]

2008-12-12 Thread Taoufik NADIFI
Please, can you tell me if you know how can i use the library Igraph in C# 
?

Thanks
Nadifi Taoufik
*
This message and any attachments (the "message") are con...{{dropped:15}}

__
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] Please help me about the regress models!

2008-11-12 Thread Greg Snow
I think what you need is a good consultant, and with that deadline don't expect 
any bargains.

You have not specified your problem with enough detail yet, 2 options (there 
are probably many more) include:

Use the nls function with the model as stated

Use the lm function starting as lm( log( 100/y - 1 ) ~ x,

Those 2 options are based on different models of how the error comes into play, 
which is more appropriate depends on things that we cannot guess at based on 
your description.  What to do with either model once fit also depends on the 
question you want answered.

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
801.408.8111


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> project.org] On Behalf Of Leon_Long
> Sent: Tuesday, November 11, 2008 8:33 PM
> To: r-help@r-project.org
> Subject: [R] Please help me about the regress models!
>
>
> I am a bigginer of R language.I need to prepare a PPT which deadline is
> 15
> Nov. 2008.  I want to build a regress model with my own formula. The
> formula
> is y=100/(1+exp(a+b*X)). I have no idea of the R program,please
> demonstrate
> how to do it or give a good sample.
> Anyone would help me? Thank you very much!
> --
> View this message in context: http://www.nabble.com/Please-help-me-
> about-the-regress-models%21-tp20453522p20453522.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> 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-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] Please help me about the regress models!

2008-11-12 Thread Gabor Grothendieck
Check out
  ?nls
for a description and examples.

On Tue, Nov 11, 2008 at 10:33 PM, Leon_Long <[EMAIL PROTECTED]> wrote:
>
> I am a bigginer of R language.I need to prepare a PPT which deadline is 15
> Nov. 2008.  I want to build a regress model with my own formula. The formula
> is y=100/(1+exp(a+b*X)). I have no idea of the R program,please demonstrate
> how to do it or give a good sample.
> Anyone would help me? Thank you very much!

__
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] Please help me about the regress models!

2008-11-12 Thread Leon_Long

I am a bigginer of R language.I need to prepare a PPT which deadline is 15
Nov. 2008.  I want to build a regress model with my own formula. The formula
is y=100/(1+exp(a+b*X)). I have no idea of the R program,please demonstrate
how to do it or give a good sample.
Anyone would help me? Thank you very much!
-- 
View this message in context: 
http://www.nabble.com/Please-help-me-about-the-regress-models%21-tp20453522p20453522.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Please help me to produce smoothed contour plots

2008-10-01 Thread Simon Wood
One approach would be to smooth the data using `gam' from package `mgcv'. 
`vis.gam' will contour the resulting smoothed fit if you select 
`plot.type="contour"'. If the results look ok but you want finer control of 
what the plot looks like then `predict.gam' can be used to predict from the 
fitted smooth on any regular grid suitable for supplying to `contour' 
(although you have to supply the grid!).

On Wednesday 01 October 2008 13:05, Mark wrote:
> Please help me to produce smoothed contour plots.
>
> I have dependent data generated at regular intervals of two independent
> variables and would like to produce smoothed contour plots - I cannot get
> interp (alima) to produce cubic interpolations of the data, only linear
> ones. I'm interested in smoothing as the data generation process is
> stochastic and produces small variations which I'd rather 'smooth' away. I
> cannot spot what is different about my data from the examples in (akima)
> which prevents this working.
>
> here is an example of my data:
> > x
>
>0  50 100 150 200 250 300 350 400 450 500   0  50 100 150 200 250 300
> 350 400
>  [21] 450 500   0  50 100 150 200 250 300 350 400 450 500   0  50 100 150
> 200 250 300
>  [41] 350 400 450 500   0  50 100 150 200 250 300 350 400 450 500   0  50
> 100 150 200
>  [61] 250 300 350 400 450 500   0  50 100 150 200 250 300 350 400 450 500
> 0  50 100
>  [81] 150 200 250 300 350 400 450 500   0  50 100 150 200 250 300 350 400
> 450 500   0
> [101]  50 100 150 200 250 300 350 400 450 500   0  50 100 150 200 250 300
> 350 400 450
> [121] 500
>
> > y
>
>   [1] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.05 0.05 0.05
> 0.05 0.05
>  [17] 0.05 0.05 0.05 0.05 0.05 0.05 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10
> 0.10 0.10
>  [33] 0.10 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.20 0.20
> 0.20 0.20
>  [49] 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.25 0.25 0.25 0.25 0.25 0.25 0.25
> 0.25 0.25
>  [65] 0.25 0.25 0.30 0.30 0.30 0.30 0.30 0.30 0.30 0.30 0.30 0.30 0.30 0.35
> 0.35 0.35
>  [81] 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.40 0.40 0.40 0.40 0.40 0.40
> 0.40 0.40
>  [97] 0.40 0.40 0.40 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45
> 0.50 0.50
> [113] 0.50 0.50 0.50 0.50 0.50 0.50 0.50 0.50 0.50
>
> > zz
>
>   [1] 105136  98444  95021  79375  72532  64392  57819  44413  40610  26083
> 18077
>  [12]  96188  87863  80205  69503  61000  50387  44306  33432  22958  17575
> 10892
>  [23]  88402  75263  65109  63717  50998  39837  28576  25960  17531
> 8510   5733
>  [34]  70806  59245  53970  46113  38455  30492  23836  17870  10954
> 5218   2266
>  [45]  68272  58610  47854  34834  32363  24238  19236  11789   6206
> 2515   2141
>  [56]  58448  47706  43001  39592  22840  18264  11564   6292   2915
> 2228   2090
>  [67]  55817  47680  38460  31693  21331  13161   8050   3162   2302
> 2120   1990
>  [78]  54078  43720  32828  22618  17039   8524   4846   2392   2154
> 2068   2008
>  [89]  47459  39734  29525  21325  10602   6406   3525   2207   2062
> 2014   1952
> [100]  47630  34965  28452  18966   8386   5726   2351   2145   2052
> 1999   1960
> [111]  42173  34339  27449  16743   9643   2866   2208   2096   2018
> 1937   1886
>
>   [[alternative HTML version deleted]]
>
>   [[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.

-- 
> Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK
> +44 1225 386603  www.maths.bath.ac.uk/~sw283

__
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] Please help me to produce smoothed contour plots

2008-10-01 Thread Mark
Please help me to produce smoothed contour plots.

I have dependent data generated at regular intervals of two independent
variables and would like to produce smoothed contour plots - I cannot get
interp (alima) to produce cubic interpolations of the data, only linear
ones. I'm interested in smoothing as the data generation process is
stochastic and produces small variations which I'd rather 'smooth' away. I
cannot spot what is different about my data from the examples in (akima)
which prevents this working.

here is an example of my data:
> x
   0  50 100 150 200 250 300 350 400 450 500   0  50 100 150 200 250 300 350
400
 [21] 450 500   0  50 100 150 200 250 300 350 400 450 500   0  50 100 150
200 250 300
 [41] 350 400 450 500   0  50 100 150 200 250 300 350 400 450 500   0  50
100 150 200
 [61] 250 300 350 400 450 500   0  50 100 150 200 250 300 350 400 450 500
0  50 100
 [81] 150 200 250 300 350 400 450 500   0  50 100 150 200 250 300 350 400
450 500   0
[101]  50 100 150 200 250 300 350 400 450 500   0  50 100 150 200 250 300
350 400 450
[121] 500
> y
  [1] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.05 0.05 0.05
0.05 0.05
 [17] 0.05 0.05 0.05 0.05 0.05 0.05 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10
0.10 0.10
 [33] 0.10 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.20 0.20
0.20 0.20
 [49] 0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.25 0.25 0.25 0.25 0.25 0.25 0.25
0.25 0.25
 [65] 0.25 0.25 0.30 0.30 0.30 0.30 0.30 0.30 0.30 0.30 0.30 0.30 0.30 0.35
0.35 0.35
 [81] 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.40 0.40 0.40 0.40 0.40 0.40
0.40 0.40
 [97] 0.40 0.40 0.40 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45
0.50 0.50
[113] 0.50 0.50 0.50 0.50 0.50 0.50 0.50 0.50 0.50
> zz
  [1] 105136  98444  95021  79375  72532  64392  57819  44413  40610  26083
18077
 [12]  96188  87863  80205  69503  61000  50387  44306  33432  22958  17575
10892
 [23]  88402  75263  65109  63717  50998  39837  28576  25960  17531
8510   5733
 [34]  70806  59245  53970  46113  38455  30492  23836  17870  10954
5218   2266
 [45]  68272  58610  47854  34834  32363  24238  19236  11789   6206
2515   2141
 [56]  58448  47706  43001  39592  22840  18264  11564   6292   2915
2228   2090
 [67]  55817  47680  38460  31693  21331  13161   8050   3162   2302
2120   1990
 [78]  54078  43720  32828  22618  17039   8524   4846   2392   2154
2068   2008
 [89]  47459  39734  29525  21325  10602   6406   3525   2207   2062
2014   1952
[100]  47630  34965  28452  18966   8386   5726   2351   2145   2052
1999   1960
[111]  42173  34339  27449  16743   9643   2866   2208   2096   2018
1937   1886

[[alternative HTML version deleted]]

[[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] Please help me interpret these results (fitting distributions to real data)

2008-09-25 Thread Ted Byers

I just thought of a useful metaphore for the problem I face.  I am dealing
with a problem in business finance, with two kinds of related events. 
However, imagine you have a known amount of carbon (so many kilograms), but
you do not know what fraction is C14 (and thus radioactive).  Only the C14
will give decay events (and once that event has occurred, the atom that
decayed will never decay again).  C12 will never decay.  What you want to
know is a) what is the ratio of C12 to C14 at time 0, and b) how many decay
events will happen between time X and time y, or how many decay events will
happen after time z.  That integral, is, IIRC, quite simple.

The data you get from your equipment will be a number of decay events in
time period n (could be a specific week or a specific day).  How would you
get this data into R so that you can use, say, fitdistr(MASS) to estimate
the decay rate, and then proceed to answer the questions of interest?

Anyway, in my early tests (before I figured out which distribution is most
appropriate in this case), I got the following results (this is for one
week's data, but other weeks' result are similar).

==curious results=
> ex15 = fitdistr(x15,"exponential")
> str(ex15)
List of 4
 $ estimate: Named num 0.0653
  ..- attr(*, "names")= chr "rate"
 $ sd  : Named num 0.00356
  ..- attr(*, "names")= chr "rate"
 $ n   : int 337
 $ loglik  : num -1256
 - attr(*, "class")= chr "fitdistr"
> ge15 = fitdistr(x15,"geometric")
> str(ge15)
List of 4
 $ estimate: Named num 0.0613
  ..- attr(*, "names")= chr "prob"
 $ sd  : Named num 0.00324
  ..- attr(*, "names")= chr "prob"
 $ n   : int 337
 $ loglik  : num -1257
 - attr(*, "class")= chr "fitdistr"
> po15 = fitdistr(x15,"poisson")
> str(po15)
List of 4
 $ estimate: Named num 15.3
  ..- attr(*, "names")= chr "lambda"
 $ sd  : Named num 0.213
  ..- attr(*, "names")= chr "lambda"
 $ n   : int 337
 $ loglik  : num -2721
 - attr(*, "class")= chr "fitdistr"
> nb15 = fitdistr(x15,"negative binomial")
Warning messages:
1: In dnbinom(x, size, prob, log) : NaNs produced
2: In dnbinom(x, size, prob, log) : NaNs produced
3: In dnbinom(x, size, prob, log) : NaNs produced
> str(nb15)
List of 4
 $ estimate: Named num [1:2]  0.973 15.309
  ..- attr(*, "names")= chr [1:2] "size" "mu"
 $ sd  : Named num [1:2] 0.0786 0.8719
  ..- attr(*, "names")= chr [1:2] "size" "mu"
 $ loglik  : num -1267
 $ n   : int 337
 - attr(*, "class")= chr "fitdistr"
> AIC(ex15)
[1] 2514.952
> AIC(ge15)
[1] 2516.273
> AIC(po15)
[1] 5444.62
> AIC(nb15)
[1] 2538.385
>
=end curious results=

Notice that the AIC for the exponential and geometric distributions are
almost idential, and that for the negative binomial is not much different.

This now makes some sense; the geometric being a discrete equivalent of the
exponential, as well as being a special case of the negative binomial. 
Right?  With such relationships among them, it would not be surprising to
see them give similar values of AIV.  Right?

Thanks

Ted
-- 
View this message in context: 
http://www.nabble.com/Please-help-me-interpret-these-results-%28fitting-distributions-to-real-data%29-tp19678782p19678782.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Please help me in Converting this from C# to R

2008-09-14 Thread Simon Knapp
# bit hard to provide a simple conversion without definitions of the
class 'Node', the template 'DirectedGraph' and the function 'Writed'!
# I've used the package 'igraph' as a drop in - hope it is still clear.
#
# by the way:
# - your curly braces don't match,
# - not all elements of P are initialised before they are used.

#
# original code (cleaned to make comparison easier).
#
#Random r = new Random();
#DirectedGraph graph = GetGraph();
#decimal B = 0.1m;
#decimal D = 0.05m;
#int nodes = graph.NodesCount;
#decimal[] E = new decimal[nodes];
#decimal[] P = new decimal[nodes];
#
#for (int i = 7; i <= 10; ++i) P[i] = (decimal)r.NextDouble();
#
#for (int t = 0; t < 100; ++t){
#Writed(P, "P");
#
#foreach (SimpleNode n in graph.Nodes) {
#int id = graph.index[n];
#
#decimal product = 1;
#foreach (var item in graph.GetAdjacentNodes(n)){
#int j = graph.index[item];
#product *= (1 - B * P[j]);
#}
#
#E[id] = product;
#}
#
#foreach (SimpleNode n in graph.Nodes){
#int i = graph.index[n];
#P[i] = 1 - ((1 - P[i]) * E[i] + D * (1 - P[i]) * E[i] + 0.5m
* D * P[i] * (1 - E[i]));
#if (P[i] < 0) P[i] = 0;
#}
#}
#
#}


#
# drop-in for your method getGraph (produces a 10 'random' node
directed graph). I only assign to temporary so I can use the same
'grph' and 'P' in both implementations.
#
library(igraph)
GetGraph <- function() graph.adjacency(matrix(sample(0:1, size=100,
replace=T), nrow=10))
grph.t <- GetGraph()
P.t <- runif(nodes) # assume you meant to initialise all elements of P

#
# IMPLEMENTATON 1.
# A 'mirror' implementation. Some of the code relies
# on the specifics of package igraph, but I've tried to
# be as similar as possible. Hope it still makes sense!
#
B <- 0.1
D <- 0.05
grph <- grph.t
nodes <- vcount(grph)
E <- numeric(nodes)
P <- P.t

for(t in 0:99){
cat('P:', P, '\n')# is this equivalent to 'Writed(P, "P")' ???
graph.Nodes <- get.adjlist(grph) # returns a list of vectors,
where each vector is the nodes a node is connected to.
id <- 0 # we loop over the vectors and so must index separately
for(n in graph.Nodes){ # n is a vector containing the verticies
the vertex at index id+1 is connected to.
id <- id+1
product <- 1;
for(item in n){
product <- product * (1 - B * P[item+1]); # verticies are
indexed from 0. no operator*= in R.
}
E[id] <- product;
}

at <- 0
for(i in 1:nodes){
P[i] <- 1 - ((1 - P[i]) * E[i] + D * (1 - P[i]) * E[i] + 0.5 *
D * P[i] * (1 - E[i])); # we are accessing nodes in order so the
indexes are also ordered.
if (P[i] < 0) P[i] <- 0;
}
}

P # print the result

#
# IMPLEMENTATION 2.
# a more 'R-ish' implementation.
#
B <- 0.1
D <- 0.05
P <- P.t
grph <- grph.t

for(t in 0:99){
E <- sapply(get.adjlist(grph), function(node) prod(1-B*P[node+1]))
P <- 1 - ((1 - P) * E + D * (1 - P) * E + 0.5 * D * P * (1 - E))
}

P # print the result

__
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] Please help me in Converting this from C# to R

2008-09-14 Thread Barry Rowlingson
2008/9/14 rajivv <[EMAIL PROTECTED]>:
>
> Random r = new Random();
>DirectedGraph graph = GetGraph();
>decimal B = 0.1m;
>decimal D = 0.05m;
 [ deletia ]
>if (P[i] < 0)
>P[i] = 0;
>}
>}
>
>}

 If you convert it into English first, then more people will be able
to help. It's much easier to convert English to any programming
language than from programming language A to programming language B.
Given that this code must have derived from a specification written in
a human language (such as English) just supply us with that. Sometimes
you don't need the original spec if the code is well-commented. But
this code is null-commented.

 At a guess, it seems to get a graph from out of nowhere
(graph=GetGraph()) and then do 100 iterations of some calculation
based on the graph adjacency. This should not be too difficult to
convert to R, but with any conversion problem there are always hidden
traps to beware of. Here's one in your code:

 You have:

  for (int i = 7; i <= 10; ++i)

 in one loop, and:

  for (int t = 0; t < 100; ++t)

 Now, much as C style loop specifications are concise and elegant,
they can cause confusion. The subtle differences here (using < instead
of <=, and the 'preincrement' ++i) confuse me as to what values the
loop variable takes in the loop.

 The way to get by all these issues in any conversion problem is to
have a good set of test cases. You run the test cases in language A
and get a set of answers. You then run the test cases using the
converted code in language B and if you don't get the same answers
then the conversion has failed.

 If you can describe what the code does, add some meaningful comments,
and produce a set of sample data test cases and results then perhaps
you'll get more help than just pasting the code in and asking nicely
(you did say 'please', which is more than some people do on this
list!).

Barry

__
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] Please help me in Converting this from C# to R

2008-09-13 Thread rajivv

Random r = new Random();
DirectedGraph graph = GetGraph();
decimal B = 0.1m;
decimal D = 0.05m;
int nodes = graph.NodesCount;
decimal[] E = new decimal[nodes];
decimal[] P = new decimal[nodes];

for (int i = 7; i <= 10; ++i)
P[i] = (decimal)r.NextDouble();


for (int t = 0; t < 100; ++t)
{
  //  Writed(E, "E");
Writed(P, "P");

foreach (SimpleNode n in graph.Nodes)
{
int id = graph.index[n];

decimal product = 1;
foreach (var item in graph.GetAdjacentNodes(n))
{
int j = graph.index[item];
product *= (1 - B * P[j]);
}

E[id] = product;
}

foreach (SimpleNode n in graph.Nodes)
{
int i = graph.index[n];

P[i] = 1 - ((1 - P[i]) * E[i] + D * (1 - P[i]) *
E[i] + 0.5m * D * P[i] * (1 - E[i]));

if (P[i] < 0)
P[i] = 0;
}
}

}
-- 
View this message in context: 
http://www.nabble.com/Please-help-me-in-Converting-this-from-C--to-R-tp19477464p19477464.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Please help me

2008-04-14 Thread chenxh007
try

?image

Xiaohui

merca duria wrote:
> I have a matrix with N x N points, that I would like to represent on a map.
> 
> The points are an estimation of the bidimensional density of certain
> quantity observed on a geographical region.
> I am interested in a map with several colours displaying several values of
> the density
> 
> Can you help me about this,please?
> 
> thanks
> juanolo
> 
>   [[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-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] Please help me

2008-04-14 Thread merca duria
I have a matrix with N x N points, that I would like to represent on a map.

The points are an estimation of the bidimensional density of certain
quantity observed on a geographical region.
I am interested in a map with several colours displaying several values of
the density

Can you help me about this,please?

thanks
juanolo

[[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] Please help me

2008-01-25 Thread alyaa wakf
Hi,  The following code, from Angelo Canty article on line 
"Resampling Methods in R: the boot Package, 2002",  works fine for Angelo Canty 
using  R 2.6.0 on Windows XP.   
  It also works for me using  R 1.2.1 and S-PLUS 2000 on  Windows XP after 
installing the S-PLUS  bootstrap library, with slight differences in my outputs.
   
  > library(boot)
> library(survival)
> set.seed(12345)
  > mel <- melanoma[melanoma$ulcer==1,]
  > mel$cens <- 1*(mel$status==1)
  > mel.cox <- coxph(Surv(time, status==1)~thickness,
  + data=mel)
  > mel.surv <- survfit(mel.cox)
  > mel.cens <- survfit(Surv(time-0.001*(status==1),status!=1)~1,
  + data=mel)
  > mel.fun <- function(d) {
  + cox <- coxph(Surv(time, status==1)~thickness,
  + data=d)
  + cox$coefficients}
  > mel.boot.con <- censboot(mel, mel.fun, R=999, sim="cond", 
  + F.surv=mel.surv, G.surv=mel.cens,
  + cox=mel.cox, index=c(1,8))
  > mel.boot.con
   
  CONDITIONAL BOOTSTRAP FOR CENSORED DATA

Call:
censboot(data = mel, statistic = mel.fun, R = 999, F.surv = mel.surv, 
G.surv = mel.cens, sim = "cond", cox = mel.cox, index = c(1, 
8))

Bootstrap Statistics :
  original biasstd. error
t1* 0.09967665 0.03579701  0.04973614

   
  I want to apply the Fast bootstrap method from Salibian-Barrera and Zamar 
(2003) and  Salibian-Barrera, M., Van Aels, S. and Willems, G. (2007) to the 
previous example, i.e., to produce a confidence interval for the exponent of 
the coefficient of tumour thickness in the Melanoma dataset .  Moreover,  I 
want to compare the performance of the Fast bootstrap with that of the 
classical bootstrap, which requires of course computing power and time. How  I 
can adjust the previous code to do what I want. I asked Angelo Canty for 
helping me to do this, but he told me that he is afraid that he does not know 
anything about the Fast Bootstrap to which I refer. He suspects that one could 
force his boot package to do something like this but he is not sure if that 
would be possible through censboot or not.  Although my problem does seem 
interesting for him, he is afraid that he is not currently in a position to 
take on any new collaborations.  He remains available to answer any
 questions about the boot package itself as it is currently written, he just 
does not have the time to consider including new elements into the library at 
this time.   Salibian-Barrera and Zamar ( 2003) have studied in their paper the 
problem of estimating the distribution of statistics defined by estimating 
equations. In particular, they have considered two cases: robust regression 
estimates and quasi-likelihood estimates.Their approach applies in principle to 
the wider class of estimates defined by estimating equations. The Fast 
bootstrap povides an inference procedure that is notably faster than the 
classical bootstrap (where the estimating equations have to be fully solved for 
each bootstrap sample).  Salibian-Barrera and Zamar  simulation studies have 
shown that this Fast bootstrap method is more efficient and more robust to 
model departures. I think that the paper of Salibian-barrera and Zamar (2003) 
is not published till now.  Now I do not have an electronic copy of
 this paper draft but I have a hard copy. And so I can send you an attachment 
including  some written sections from this paper  "Fast and Stable Bootstrap 
Methods for Statistics Defined by Estimating Equations, Salibian-Barrera and 
Zamar  (2003)".  Please tell me If you want to send you this  attachment, which 
can also includes what I want to do, and what I suggest.
  I need the adjusted code bad. I hope you help me. If you can not help me, 
please guide me to anyone who can help me. Thank you in advance.
   
  Alyaa Mohammad El-wakf
  Assistant Lecturer
  Department of Applied Statistics and Insurance
  Faculty of Commerce 
  Mansoura University
  Egypt









   
-

[[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] please help me

2007-11-08 Thread James W. MacDonald
Well Sadeghian, I have to give you credit for perseverance. This must be 
the fifth email you have sent to R-help for this one question.

Unfortunately, with each additional message, your chances of getting any 
help are becoming asymptotically closer to zero. So some advice:

 > PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
 > and provide commented, minimal, self-contained, reproducible code.

I think you definitely need to read the posting guide, and then maybe 
you could try to come up with some code using a small portion of your 
data set that would illustrate your problem? As it stands, nobody can 
attempt to reproduce your error to see what the problem is, so how can 
anybody possibly help?

Best,

Jim



azadeh sadeghian wrote:
> Dear list.
>  I am student M.S. statistics in department statistics .I have thise problem 
> in work with the function variofit and nls and dont know how to solve it.
> var1<-variog(data,option="bin")
> var2<-variog(data,option="cloud")
> v1<-var1$v
> u1<-var1^u
> v2<-var2$v
> u2<-var2$u
> variofit(var1,ini.cov.pars=c(0.005,1.5),cov.model="power",fix.nugget=F,weight="equal")
> variofit: weights used: equal 
> variofit: minimisation function used: optim 
> Error in if (loss > (.Machine$double.xmax^0.5) | loss == Inf | loss ==  : 
> missing value where TRUE/FALSE needed
> In addition: Warning message:
> unreasonable initial value for sigmasq + nugget (too low) in: variofit(var1, 
> ini.cov.pars = c(0.005, 1.5), cov.model = "power", 
> ...
> variofit(var2,ini.cov.pars=c(0.005,1.5),cov.model="power",fix.nugget=F,weight="equal")
> variofit: weights used: equal 
> warning: minimisation function nls can not be used with given cov.model.
>   changing for "optim".
> variofit: minimisation function used: optim 
> Error in if (loss > (.Machine$double.xmax^0.5) | loss == Inf | loss ==  : 
>   missing value where TRUE/FALSE needed
> In addition: Warning message:
> In variofit(var2, ini.cov.pars = c(0.005, 1.5), cov.model = "power",  :
>   unreasonable initial value for sigmasq + nugget (too low)
> ...
>  nls(v2~c0+ce*(1-exp(-(u2^2)/(ae^2))),start=list(c0=0,ae=3,ce=2))
> Error in nls(v2 ~ c0 + ce * (1 - exp(-(u2^2)/(ae^2))), start = list(c0 = 0,  
> : 
>   number of iterations exceeded maximum of 50
> best regards.
> Sadeghian.
> 
>  __
> 
> 
> 
>   [[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.

-- 
James W. MacDonald, M.S.
Biostatistician
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109
734-647-5623

__
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] please help me

2007-11-08 Thread Julian Burgos
Hi Azadeh,

As the warning message is telling you, it seems that your initial 
parameters for the covariance functions are not very good.  Something 
that you can do is to use the eyefit() function (package geoR) to fit 
your variogram "by eye" and get a first approximation for your 
covariance parameter values (or to test if the values you are using do 
generate a variogram curve that is close to your data).  Then you can 
use these parameters values as initial values in the variofit() function.

Julian

azadeh sadeghian wrote:
> I have thise problem in work with the function variofit and nls and dont know 
> how to solve it.
> var1<-variog(data,option="bin")
> var2<-variog(data,option="cloud")
> v1<-var1$v
> u1<-var1^u
> v2<-var2$v
> u2<-var2$u
>   
> variofit(var1,ini.cov.pars=c(0.005,1.5),cov.model="power",fix.nugget=F,weight="equal")
> variofit: weights used: equal 
> variofit: minimisation function used: optim 
> Error in if (loss > (.Machine$double.xmax^0.5) | loss == Inf | loss ==  : 
> missing value where TRUE/FALSE needed
> In addition: Warning message:
> unreasonable initial value for sigmasq + nugget (too low) in: variofit(var1, 
> ini.cov.pars = c(0.005, 1.5), cov.model = "power", 
> ...
> variofit(var2,ini.cov.pars=c(0.005,1.5),cov.model="power",fix.nugget=F,weight="equal")
> variofit: weights used: equal 
> warning: minimisation function nls can not be used with given cov.model.
>   changing for "optim".
> variofit: minimisation function used: optim 
> Error in if (loss > (.Machine$double.xmax^0.5) | loss == Inf | loss ==  : 
>   missing value where TRUE/FALSE needed
> In addition: Warning message:
> In variofit(var2, ini.cov.pars = c(0.005, 1.5), cov.model = "power",  :
>   unreasonable initial value for sigmasq + nugget (too low)
> ...
>  nls(v2~c0+ce*(1-exp(-(u2^2)/(ae^2))),start=list(c0=0,ae=3,ce=2))
> Error in nls(v2 ~ c0 + ce * (1 - exp(-(u2^2)/(ae^2))), start = list(c0 = 0,  
> : 
>   number of iterations exceeded maximum of 50
>   best regards.
>   Sadeghian.
>
> 
>  __
> 
> 
> 
>   [[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-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] please help me

2007-11-08 Thread azadeh sadeghian
Dear list.
 I am student M.S. statistics in department statistics .I have thise problem in 
work with the function variofit and nls and dont know how to solve it.
var1<-variog(data,option="bin")
var2<-variog(data,option="cloud")
v1<-var1$v
u1<-var1^u
v2<-var2$v
u2<-var2$u
variofit(var1,ini.cov.pars=c(0.005,1.5),cov.model="power",fix.nugget=F,weight="equal")
variofit: weights used: equal 
variofit: minimisation function used: optim 
Error in if (loss > (.Machine$double.xmax^0.5) | loss == Inf | loss ==  : 
missing value where TRUE/FALSE needed
In addition: Warning message:
unreasonable initial value for sigmasq + nugget (too low) in: variofit(var1, 
ini.cov.pars = c(0.005, 1.5), cov.model = "power", 
...
variofit(var2,ini.cov.pars=c(0.005,1.5),cov.model="power",fix.nugget=F,weight="equal")
variofit: weights used: equal 
warning: minimisation function nls can not be used with given cov.model.
  changing for "optim".
variofit: minimisation function used: optim 
Error in if (loss > (.Machine$double.xmax^0.5) | loss == Inf | loss ==  : 
  missing value where TRUE/FALSE needed
In addition: Warning message:
In variofit(var2, ini.cov.pars = c(0.005, 1.5), cov.model = "power",  :
  unreasonable initial value for sigmasq + nugget (too low)
...
 nls(v2~c0+ce*(1-exp(-(u2^2)/(ae^2))),start=list(c0=0,ae=3,ce=2))
Error in nls(v2 ~ c0 + ce * (1 - exp(-(u2^2)/(ae^2))), start = list(c0 = 0,  : 
  number of iterations exceeded maximum of 50
best regards.
Sadeghian.

 __



[[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] please help me

2007-11-08 Thread azadeh sadeghian
I have thise problem in work with the function variofit and nls and dont know 
how to solve it.
var1<-variog(data,option="bin")
var2<-variog(data,option="cloud")
v1<-var1$v
u1<-var1^u
v2<-var2$v
u2<-var2$u
  
variofit(var1,ini.cov.pars=c(0.005,1.5),cov.model="power",fix.nugget=F,weight="equal")
variofit: weights used: equal 
variofit: minimisation function used: optim 
Error in if (loss > (.Machine$double.xmax^0.5) | loss == Inf | loss ==  : 
missing value where TRUE/FALSE needed
In addition: Warning message:
unreasonable initial value for sigmasq + nugget (too low) in: variofit(var1, 
ini.cov.pars = c(0.005, 1.5), cov.model = "power", 
...
variofit(var2,ini.cov.pars=c(0.005,1.5),cov.model="power",fix.nugget=F,weight="equal")
variofit: weights used: equal 
warning: minimisation function nls can not be used with given cov.model.
  changing for "optim".
variofit: minimisation function used: optim 
Error in if (loss > (.Machine$double.xmax^0.5) | loss == Inf | loss ==  : 
  missing value where TRUE/FALSE needed
In addition: Warning message:
In variofit(var2, ini.cov.pars = c(0.005, 1.5), cov.model = "power",  :
  unreasonable initial value for sigmasq + nugget (too low)
...
 nls(v2~c0+ce*(1-exp(-(u2^2)/(ae^2))),start=list(c0=0,ae=3,ce=2))
Error in nls(v2 ~ c0 + ce * (1 - exp(-(u2^2)/(ae^2))), start = list(c0 = 0,  : 
  number of iterations exceeded maximum of 50
  best regards.
  Sadeghian.
   

 __



[[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] please help me

2007-11-08 Thread azadeh sadeghian
Hello.
  Error in optim(ini, .loss.vario, method = "L-BFGS-B", hessian = TRUE,  : 
non-finite value supplied by optim
I have this errore in fit the model"power" in simulation with the function 
g<-function(n=100,max=100,c0=0,ce=.005,ae=1.5,nsim=1000){
var.exp<-function(c0,ce,ae,h){
f<-c0+ce*(h^ae)
return(f)
}
ms1<-ms2<-rep(NA,nsim)
integrand1<-function(h)
{(var.exp(c0,ce,ae,h)-var.exp(c0HAT1,ceHAT1,aeHAT1,h))^2}
  integrand2<-function(z)
{(var.exp(c0,ce,ae,z)-var.exp(c0HAT2,ceHAT2,aeHAT2,z))^2}
data<-grf(n=n,grid="reg",nsim=nsim,cov.model="power",xlim=c(0,max),ylim=c(0,max),cov.pars=c(ce,ae))
var1<-variog(data,option="bin")
var2<-variog(data,option="cloud")
for(i in (1:nsim)){
cat(i,"\n")
ww1<-variofit(var1,ini.cov.pars=c(ce,ae),cov.model="power",simul.number=i,fix.nugget=F,weight="cressie")
ww2<-variofit(var2,ini.cov.pars=c(ce,ae),cov.model="power",simul.number=i,fix.nugget=F,weight="equal")
c0HAT1<-ww1$nugget
ceHAT1<-ww1$cov.pars[1]
aeHAT1<-ww1$cov.pars[2]
c0HAT2<-ww2$nugget
ceHAT2<-ww2$cov.pars[1]
aeHAT2<-ww2$cov.pars[2]
  MISEmodel1<-integrate(integrand1,.1,max)$value
MISEmodel2<-integrate(integrand2,.1,max)$value
  ms1[i]<-MISEmodel1
ms2[i]<-MISEmodel2
}
plot(data)
lines(ww1,type="l")
lines(ww2,lty=2,lwd=2)
return(MISEmodel1,MISEmodel2)
}
...
when i simulation n=150 data with nsim=1000 i have thise problem in work with 
the function(g)
Error: cannot allocate vector of size 80437 Kb
In addition: Warning messages:
1: Reached total allocation of 255Mb
how i can solve it?
  best regards.
  Sadeghian.
   

 __



[[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] please help me

2007-11-08 Thread azadeh sadeghian
Hello.
  Error in optim(ini, .loss.vario, method = "L-BFGS-B", hessian = TRUE,  : 
non-finite value supplied by optim
I have this errore in fit the model"power" in simulation with the function 
g<-function(n=100,max=100,c0=0,ce=.005,ae=1.5,nsim=1000){
var.exp<-function(c0,ce,ae,h){
f<-c0+ce*(h^ae)
return(f)
}
ms1<-ms2<-rep(NA,nsim)
integrand1<-function(h)
{(var.exp(c0,ce,ae,h)-var.exp(c0HAT1,ceHAT1,aeHAT1,h))^2}
  integrand2<-function(z)
{(var.exp(c0,ce,ae,z)-var.exp(c0HAT2,ceHAT2,aeHAT2,z))^2}
data<-grf(n=n,grid="reg",nsim=nsim,cov.model="power",xlim=c(0,max),ylim=c(0,max),cov.pars=c(ce,ae))
var1<-variog(data,option="bin")
var2<-variog(data,option="cloud")
for(i in (1:nsim)){
cat(i,"\n")
ww1<-variofit(var1,ini.cov.pars=c(ce,ae),cov.model="power",simul.number=i,fix.nugget=F,weight="cressie")
ww2<-variofit(var2,ini.cov.pars=c(ce,ae),cov.model="power",simul.number=i,fix.nugget=F,weight="equal")
c0HAT1<-ww1$nugget
ceHAT1<-ww1$cov.pars[1]
aeHAT1<-ww1$cov.pars[2]
c0HAT2<-ww2$nugget
ceHAT2<-ww2$cov.pars[1]
aeHAT2<-ww2$cov.pars[2]
  MISEmodel1<-integrate(integrand1,.1,max)$value
MISEmodel2<-integrate(integrand2,.1,max)$value
  ms1[i]<-MISEmodel1
ms2[i]<-MISEmodel2
}
plot(data)
lines(ww1,type="l")
lines(ww2,lty=2,lwd=2)
return(MISEmodel1,MISEmodel2)
}
...
when i simulation n=150 data with nsim=1000 i have thise problem in work with 
the function(g)
Error: cannot allocate vector of size 80437 Kb
In addition: Warning messages:
1: Reached total allocation of 255Mb
how i can solve it?
  best regards.
  Sadeghian.
   

 __



[[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] please help me

2007-10-20 Thread Ben Bolker



azadeh sadeghian wrote:
> 
> dear list
>   I am student M.S. statistics in department statistics . I am working in 
> the function "nls" in the [R 2.3.1] with 246 data and want to fit a model
> to vectors( v and u ) but I have 
> a problem to use it
> u
> 
> 
> 


  PS  -- I just looked back at the list and noticed that you
have posted several messages, all with the title "please help me"
(or "help me"), and all about the same kinds of problems
with nls (and the previous respondents also suggested
that you think more carefully about what you're doing and
what your starting conditions are).  
   Please use more informative subject lines, and please help yourself ...

  Ben Bolker

-- 
View this message in context: 
http://www.nabble.com/please-help-me-tf4657131.html#a13309309
Sent from the R help mailing list archive at Nabble.com.

__
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] please help me

2007-10-20 Thread Ben Bolker



azadeh sadeghian wrote:
> 
> dear list
>   I am student M.S. statistics in department statistics . I am working in 
> the function "nls" in the [R 2.3.1] with 246 data and want to fit a model
> to vectors( v and u ) but I have 
> a problem to use it
> 
> 

  Thanks for providing a reproducible example.  Your version of R is
_really_ old:
you should probably update (or ask you administrator to update) to make sure
that all possible bugs etc. are fixed.

u=c(5.00e-13,2.179057e+03,6.537171e+03,1.089529e+04,1.525340e+04,
  1.91151e+04,2.396963e+04,2.832774e+04,3.268586e+04,3.704397e+04,
  4.140209e+04,4.576020e+04,5.011831e+04,5.447643e+04)
v=c(8.382562e-01,4.090868e+02,1.311053e+03,2.124143e+03,3.365494e+03,
  2.138903e+03,7.687774e+03,1.028396e+04,1.004186e+04,2.059798e+04,
  1.438464e+04,2.861373e+04,2.294919e+04,2.807701e+04)

## always a good idea to look at the data
plot(v~u)

## your code: error
nls(v~c0+.5(a^2)*(u^2),start=list(c0=0,a=.3))

## you need a * between ".5" and "(a^2)"
m2 = nls(v~c0+.5*(a^2)*(u^2),start=list(c0=0,a=.3))
coef(n2)

## you can also fit this (quadratic regression) with lm
m3 = lm(v~I(u^2))
## converting the coefficient
sqrt(2*coef(m3)[2])

## you need to use sensible starting conditions!
##   one way to get is to look at the plot and
##take a guess.  Another would be to assume
##   c0=0 and fit a linear model to log(v) as a function
##   of log(u)

nls(v~c0+a*(u^s),start=list(c0=0,a=1,s=2))
-- 
View this message in context: 
http://www.nabble.com/please-help-me-tf4657131.html#a13309307
Sent from the R help mailing list archive at Nabble.com.

__
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] please help me

2007-10-20 Thread azadeh sadeghian
dear list
  I am student M.S. statistics in department statistics . I am working in  the 
function "nls" in the [R 2.3.1] with 246 data and want to fit a model to 
vectors( v and u ) but I have 
a problem to use it
u
  5.00e-13 2.179057e+03 6.537171e+03 1.089529e+04 1.525340e+04
  1.961151e+04 2.396963e+04 2.832774e+04 3.268586e+04 3.704397e+04
 4.140209e+04 4.576020e+04 5.011831e+04 5.447643e+04
v
 8.382562e-01 4.090868e+02 1.311053e+03 2.124143e+03 3.365494e+03
 2.138903e+03 7.687774e+03 1.028396e+04 1.004186e+04 2.059798e+04
 1.438464e+04 2.861373e+04 2.294919e+04 2.807701e+04
  
nls(v~c0+.5(a^2)*(u^2),start=list(c0=0,a=.3))
Error in eval(expr, envir, enclos) : attempt to apply non-function
...
   nls(v~c0+a*(u^s),start=list(c0=0,a=1,s=5000))
Error in numericDeriv(form[[3]], names(ind), env) : 
Missing value or an infinity produced when evaluating the model


  

  i dont know how to solve it, please help me .
 best regards
Sadeghian.

 __



[[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] please help me

2007-10-20 Thread azadeh sadeghian
dear list
  I am student M.S. statistics in department statistics . I am working in  the 
function "nls" in the [R 2.3.1] with 246 data and want to fit a model to 
vectors( v and u ) but I have 
a problem to use it
u
  5.00e-13 2.179057e+03 6.537171e+03 1.089529e+04 1.525340e+04
  1.961151e+04 2.396963e+04 2.832774e+04 3.268586e+04 3.704397e+04
 4.140209e+04 4.576020e+04 5.011831e+04 5.447643e+04
v
 8.382562e-01 4.090868e+02 1.311053e+03 2.124143e+03 3.365494e+03
 2.138903e+03 7.687774e+03 1.028396e+04 1.004186e+04 2.059798e+04
 1.438464e+04 2.861373e+04 2.294919e+04 2.807701e+04
  
nls(v~c0+.5(a^2)*(u^2),start=list(c0=0,a=.3))
Error in eval(expr, envir, enclos) : attempt to apply non-function
...
   nls(v~c0+a*(u^s),start=list(c0=0,a=1,s=5000))
Error in numericDeriv(form[[3]], names(ind), env) : 
Missing value or an infinity produced when evaluating the model


  

  i dont know how to solve it, please help me .
 best regards
Sadeghian.

 __



[[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] please help me

2007-10-10 Thread Dieter Menne
azadeh sadeghian  yahoo.com> writes:

> 
>   I am student M.S. statistics in department statistics . I am working in  the
function "nls" in the [R 2.3.1]

You should update to a more recent version of R (2.6.0 is current)

> with 246 data and want to fit the "exp" model to vectors( v and u ) but I 
> have 
> a problem to use it
You note 246 data, but I count much less

>   u
>   5.00e-13 2.179057e+03 6.537171e+03 1.089529e+04 1.525340e+04
>   1.961151e+04 2.396963e+04 2.832774e+04 3.268586e+04 3.704397e+04
>  4.140209e+04 4.576020e+04 5.011831e+04 5.447643e+04
>   v
>  8.382562e-01 4.090868e+02 1.311053e+03 2.124143e+03 3.365494e+03
>  2.138903e+03 7.687774e+03 1.028396e+04 1.004186e+04 2.059798e+04
>  1.438464e+04 2.861373e+04 2.294919e+04 2.807701e+04
> data1<-data.frame(u=u ,v=v)
> 
> nls(v~c0+(ce*(1-exp((-u)/ae))),data=data1,start=list(c0=0,ce=1000,ae=3000))
> Error in nls(v ~ c0 + (ce * (1 - exp((-u)/ae))), data = data1, start = list(c0
= 0,  : 
> step factor 0.000488281 reduced below 'minFactor' of 0.000976563

To find out what was wrong, plot your data and your start value fit. You can see
that the start values are far off. But, more importantly, note that you data go
up exponential-like and don't level off, while you model function does. So even
if you find better start values, you result may be unreasonable: how should the
poor fitting function know when to bend down? This might be caused by the subset
of the 246 data points you presented here.

Dieter

u = c(
  5.00e-13, 2.179057e+03, 6.537171e+03, 1.089529e+04, 1.525340e+04,
  1.961151e+04, 2.396963e+04, 2.832774e+04, 3.268586e+04, 3.704397e+04,
 4.140209e+04, 4.576020e+04, 5.011831e+04, 5.447643e+04)
v = c(
 8.382562e-01, 4.090868e+02, 1.311053e+03, 2.124143e+03, 3.365494e+03,
 2.138903e+03, 7.687774e+03, 1.028396e+04, 1.004186e+04, 2.059798e+04,
 1.438464e+04, 2.861373e+04, 2.294919e+04, 2.807701e+04)
data1 = data.frame(u=u ,v=v)
start=list(c0=0,ce=1000,ae=3000)
v1= with(start,c0+(ce*(1-exp((-u)/ae
plot(u,v)
lines(u,v1)
v1= nls(v~c0+(ce*(1-exp((-u)/ae))),data=data1,start=start,trace=TRUE)

__
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] please help me

2007-10-10 Thread Gabor Grothendieck
You need better starting values:

f <- function(x) { c0 <- x[1]; ce <- x[2]; ae <- x[3]
   sum((v - c0+(ce*(1-exp((-u)/ae^2)
}
g <- 4^(0:8)
g <- c(-g, g)
g <- expand.grid(c0 = g, ce = g, ae = g)
start <- g[which.min(apply(g, 1, f)), ]
nls(v ~ c0+(ce*(1-exp((-u)/ae))), data = data1, start = start)


On 10/10/07, azadeh sadeghian <[EMAIL PROTECTED]> wrote:
> dear list
>  I am student M.S. statistics in department statistics . I am working in  the 
> function "nls" in the [R 2.3.1] with 246 data and want to fit the "exp" model 
> to vectors( v and u ) but I have
> a problem to use it
>  u
>  5.00e-13 2.179057e+03 6.537171e+03 1.089529e+04 1.525340e+04
>  1.961151e+04 2.396963e+04 2.832774e+04 3.268586e+04 3.704397e+04
>  4.140209e+04 4.576020e+04 5.011831e+04 5.447643e+04
>  v
>  8.382562e-01 4.090868e+02 1.311053e+03 2.124143e+03 3.365494e+03
>  2.138903e+03 7.687774e+03 1.028396e+04 1.004186e+04 2.059798e+04
>  1.438464e+04 2.861373e+04 2.294919e+04 2.807701e+04
> data1<-data.frame(u=u ,v=v)
>nls(v~c0+(ce*(1-exp((-u)/ae))),data=data1,start=list(c0=0,ce=1000,ae=3000))
> Error in nls(v ~ c0 + (ce * (1 - exp((-u)/ae))), data = data1, start = 
> list(c0 = 0,  :
>step factor 0.000488281 reduced below 'minFactor' of 0.000976563
>  i dont know how to solve it, please help me .
>  best regards
> Sadeghian
>
>
>
>
> -
>
>[[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-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] please help me

2007-10-10 Thread azadeh sadeghian
dear list
  I am student M.S. statistics in department statistics . I am working in  the 
function "nls" in the [R 2.3.1] with 246 data and want to fit the "exp" model 
to vectors( v and u ) but I have 
a problem to use it
  u
  5.00e-13 2.179057e+03 6.537171e+03 1.089529e+04 1.525340e+04
  1.961151e+04 2.396963e+04 2.832774e+04 3.268586e+04 3.704397e+04
 4.140209e+04 4.576020e+04 5.011831e+04 5.447643e+04
  v
 8.382562e-01 4.090868e+02 1.311053e+03 2.124143e+03 3.365494e+03
 2.138903e+03 7.687774e+03 1.028396e+04 1.004186e+04 2.059798e+04
 1.438464e+04 2.861373e+04 2.294919e+04 2.807701e+04
data1<-data.frame(u=u ,v=v)
nls(v~c0+(ce*(1-exp((-u)/ae))),data=data1,start=list(c0=0,ce=1000,ae=3000))
Error in nls(v ~ c0 + (ce * (1 - exp((-u)/ae))), data = data1, start = list(c0 
= 0,  : 
step factor 0.000488281 reduced below 'minFactor' of 0.000976563
  i dont know how to solve it, please help me .
 best regards
Sadeghian
 
   

   
-

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