Quantcast

help to program my function

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

help to program my function

hafida
HI

>i have a problem please help me to solve it:    aj.pdf

>i want to calculate the vecteur a[j] where j: 1...8

>this is the code in R:

>aj.fun <- function(j, i, X, z, E, beta0, beta1){
+ n <- length(X)
+ iX <- order(X)
+ iz <- order(z)
+ e1 <- -(beta)*z[ iz[1:(i - 1)] ]
+ numer <- E[j] - sum( X[ iX[1:(i - 1)] ] * exp(e1) )
+ e2 <- -(beta)*z[ iz[i:n] ]
+ denom <- sum( exp(e2) )
+ numer/denom
+ }

> iX<-order(X)
> iX
 [1] 75 37 29 60 73 20 69 55 30 70 72 38 26 35 65 61 74 50 71 57 25 54 64 76 56
[26] 58 48 67 46 63 28 62 36 49 47 66  1 42 41 19 39 43 22 51 68 33 27  9 15 11
[51] 10 59 32 40 45 44 52 16 18 34  4 53 21 23 31  7  6 13 14 12 17 24  5  8  2
[76]  3

> iZ<-order(Z)
> iZ
 [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
[26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
[51] 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
[76] 76

>e1 <- -(beta)*Z[ iZ[1:(i - 1)] ]
Warning message:
In 1:(i - 1) : numerical expression has 76 elements: only the first used
> e1
[1]  -442 -1664

>> numer <- E[j] - sum( X[ iX[1:(i - 1)] ] * exp(e1))
Warning message:
In 1:(i - 1) : numerical expression has 76 elements: only the first used
> numer
[1] 9.5 9.5 9.5 9.5 9.5 9.5 9.5 9.5

>> e2 <- -(beta)*Z[ iZ[i:n] ]
Warning message:
In i:n : numerical expression has 76 elements: only the first used
> e2
 [1]  -442 -1664  -442 -1792  -476 -1792  -476 -1792  -510 -1920  -510 -1920
[13]  -510 -1920  -510 -1920  -510 -1920  -510 -2048  -544 -2048  -544 -2048
[25]  -544 -2048  -544 -2048  -544 -2048  -544 -2048  -544 -2048  -578 -2176
[37]  -578 -2176  -578 -2176  -578 -2176  -578 -2176  -578 -2176  -578 -2176
[49]  -578 -2176  -578 -2176  -578 -2304  -612 -2304  -612 -2304  -612 -2304
[61]  -612 -2304  -612 -2304  -612 -2304  -612 -2304  -646 -2432  -646 -2432
[73]  -646 -2432  -646 -2432
> denom <- sum( exp(e2) )
> numer/denom
[1] 4.313746e+192 4.313746e+192 4.313746e+192 4.313746e+192 4.313746e+192
[6] 4.313746e+192 4.313746e+192 4.313746e+192

>my problem that the vecteur a[j] could not have the same number!!!
 

thank you in advance
hafida
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: help to program my function

Rui Barradas
Hello,

Your problem is something else, before returning a vector of only the
same values there are warning messages.
Inline.

Em 07-08-2012 18:14, hafida escreveu:

> HI
>
>> i have a problem please help me to solve it:
> http://r.789695.n4.nabble.com/file/n4639434/aj.pdf aj.pdf
>
>> i want to calculate the vecteur a[j] where j: 1...8
>> this is the code in R:
>> aj.fun <- function(j, i, X, z, E, beta0, beta1){
> + n <- length(X)
> + iX <- order(X)
> + iz <- order(z)
> + e1 <- -(beta)*z[ iz[1:(i - 1)] ]
> + numer <- E[j] - sum( X[ iX[1:(i - 1)] ] * exp(e1) )
> + e2 <- -(beta)*z[ iz[i:n] ]
> + denom <- sum( exp(e2) )
> + numer/denom
> + }
>
>> iX<-order(X)
>> iX
>   [1] 75 37 29 60 73 20 69 55 30 70 72 38 26 35 65 61 74 50 71 57 25 54 64 76
> 56
> [26] 58 48 67 46 63 28 62 36 49 47 66  1 42 41 19 39 43 22 51 68 33 27  9 15
> 11
> [51] 10 59 32 40 45 44 52 16 18 34  4 53 21 23 31  7  6 13 14 12 17 24  5  8
> 2
> [76]  3
>
>> iZ<-order(Z)
>> iZ
>   [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
> 25
> [26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
> 50
> [51] 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
> 75
> [76] 76
>
>> e1 <- -(beta)*Z[ iZ[1:(i - 1)] ]
> Warning message:
> In 1:(i - 1) : numerical expression has 76 elements: only the first used

This means that 'i' is a vector of length 76, which, in this context, is
illegal. The variable 'i' must be a vector of only ONE value. If you
want to compute the function for several (76) values do it one at a
time, the function aj.fun is not vectorized.

Hope this helps,

Rui Barradas

>> e1
> [1]  -442 -1664
>
>>> numer <- E[j] - sum( X[ iX[1:(i - 1)] ] * exp(e1))
> Warning message:
> In 1:(i - 1) : numerical expression has 76 elements: only the first used
>> numer
> [1] 9.5 9.5 9.5 9.5 9.5 9.5 9.5 9.5
>
>>> e2 <- -(beta)*Z[ iZ[i:n] ]
> Warning message:
> In i:n : numerical expression has 76 elements: only the first used
>> e2
>   [1]  -442 -1664  -442 -1792  -476 -1792  -476 -1792  -510 -1920  -510 -1920
> [13]  -510 -1920  -510 -1920  -510 -1920  -510 -2048  -544 -2048  -544 -2048
> [25]  -544 -2048  -544 -2048  -544 -2048  -544 -2048  -544 -2048  -578 -2176
> [37]  -578 -2176  -578 -2176  -578 -2176  -578 -2176  -578 -2176  -578 -2176
> [49]  -578 -2176  -578 -2176  -578 -2304  -612 -2304  -612 -2304  -612 -2304
> [61]  -612 -2304  -612 -2304  -612 -2304  -612 -2304  -646 -2432  -646 -2432
> [73]  -646 -2432  -646 -2432
>> denom <- sum( exp(e2) )
>> numer/denom
> [1] 4.313746e+192 4.313746e+192 4.313746e+192 4.313746e+192 4.313746e+192
> [6] 4.313746e+192 4.313746e+192 4.313746e+192
>
>> my problem that the vecteur a[j] could not have the same number!!!
>  
>
> thank you in advance
> hafida
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/help-to-program-my-function-tp4639434.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 guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: help to program my function

PIKAL Petr
In reply to this post by hafida
Hi

Maybe it is time for you to read some basic stuff like R intro. It seems
to me that you expect R to behave like some other language you know but
probably your expectation is wrong.

See inline

>
> HI
>
> >i have a problem please help me to solve it:
> http://r.789695.n4.nabble.com/file/n4639434/aj.pdf aj.pdf
>
> >i want to calculate the vecteur a[j] where j: 1...8
>
> >this is the code in R:
>
> >aj.fun <- function(j, i, X, z, E, beta0, beta1){
> + n <- length(X)
> + iX <- order(X)
> + iz <- order(z)
> + e1 <- -(beta)*z[ iz[1:(i - 1)] ]

where do you get beta

> + numer <- E[j] - sum( X[ iX[1:(i - 1)] ] * exp(e1) )
> + e2 <- -(beta)*z[ iz[i:n] ]
> + denom <- sum( exp(e2) )
> + numer/denom
> + }
>
> > iX<-order(X)
> > iX
>  [1] 75 37 29 60 73 20 69 55 30 70 72 38 26 35 65 61 74 50 71 57 25 54
64 76
> 56
> [26] 58 48 67 46 63 28 62 36 49 47 66  1 42 41 19 39 43 22 51 68 33 27 9
15
> 11
> [51] 10 59 32 40 45 44 52 16 18 34  4 53 21 23 31  7  6 13 14 12 17 24 5
 8
> 2
> [76]  3
>
> > iZ<-order(Z)
> > iZ
>  [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22
23 24
> 25
> [26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
48 49
> 50
> [51] 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
73 74
> 75
> [76] 76
>
> >e1 <- -(beta)*Z[ iZ[1:(i - 1)] ]
> Warning message:
> In 1:(i - 1) : numerical expression has 76 elements: only the first used

As somebody already mentioned i is probably vector and in this case only
first value is taken. i seems to have the firs value 3.

> > e1
> [1]  -442 -1664
>
> >> numer <- E[j] - sum( X[ iX[1:(i - 1)] ] * exp(e1))
> Warning message:
> In 1:(i - 1) : numerical expression has 76 elements: only the first used
> > numer
> [1] 9.5 9.5 9.5 9.5 9.5 9.5 9.5 9.5

Here j is vector of 8 values therefore 8 values

>
> >> e2 <- -(beta)*Z[ iZ[i:n] ]
> Warning message:
> In i:n : numerical expression has 76 elements: only the first used
> > e2
>  [1]  -442 -1664  -442 -1792  -476 -1792  -476 -1792  -510 -1920  -510
-1920
> [13]  -510 -1920  -510 -1920  -510 -1920  -510 -2048  -544 -2048  -544
-2048
> [25]  -544 -2048  -544 -2048  -544 -2048  -544 -2048  -544 -2048  -578
-2176
> [37]  -578 -2176  -578 -2176  -578 -2176  -578 -2176  -578 -2176  -578
-2176
> [49]  -578 -2176  -578 -2176  -578 -2304  -612 -2304  -612 -2304  -612
-2304
> [61]  -612 -2304  -612 -2304  -612 -2304  -612 -2304  -646 -2432  -646
-2432
> [73]  -646 -2432  -646 -2432

Strange, here first value of i seems to be 1 as n shall be 76 and final e2
length is 76.

> > denom <- sum( exp(e2) )


> > numer/denom
> [1] 4.313746e+192 4.313746e+192 4.313746e+192 4.313746e+192
4.313746e+192
> [6] 4.313746e+192 4.313746e+192 4.313746e+192
>
> >my problem that the vecteur a[j] could not have the same number!!!

I do not understand. Your numer is 9.5 repeted 8 times. If you divide it
by one number you will get nine times the same number.

You send us a code but no data so it is difficult to understand what is
your goal. It would be better to send input data

j, i, X, z, E, beta0, beta1

and assumed result in whole not in chunks scattered in several mails.

Regards
Petr


>
>
> thank you in advance
> hafida
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/help-to-
> program-my-function-tp4639434.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 guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

RE: help to program my function

hafida
HI peter

there is the function  that i want to programm (joint in pdf folder).

my data is 
> dataexp
    v      Ti
1  26    5.79
2  26 1579.52
3  26 2323.70
4  28   68.85
5  28  426.07
6  28  110.29
7  28  108.29
8  28 1067.60
9  30   17.05
10 30   22.66
11 30   21.02
12 30  175.88
13 30  139.07
14 30  144.12
15 30   20.46
16 30   43.40
17 30  194.90
18 30   47.30
19 30    7.74
20 32    0.40
21 32   82.85
22 32    9.88
23 32   89.29
24 32  215.10
25 32    1.75
26 32    0.79
27 32   15.93
28 32    3.91
29 32    0.27
30 32    0.69
31 32  100.58
32 32   27.80
33 32   13.95
34 32   53.24
35 34    0.96
36 34    4.15
37 34    0.19
38 34    0.78
39 34    8.01
40 34   31.75
41 34    7.35
42 34    6.50
43 34    8.27
44 34   33.91
45 34   32.52
46 34    3.16
47 34    4.85
48 34    2.78
49 34    4.67
50 34    1.31
51 34   12.06
52 34   36.71
53 34   72.89
54 36    1.97
55 36    0.59
56 36    2.58
57 36    1.69
58 36    2.71
59 36   25.50
60 36    0.35
61 36    0.99
62 36    3.99
63 36    3.67
64 36    2.07
65 36    0.96
66 36    5.35
67 36    2.90
68 36   13.77
69 38    0.47
70 38    0.73
71 38    1.40
72 38    0.74
73 38    0.39
74 38    1.13
75 38    0.09
76 38    2.38

NB
> X<-Ti

thanks for helping me
hafida



Date: Wed, 8 Aug 2012 03:13:28 -0700
From: [hidden email]
To: [hidden email]
Subject: Re: help to program my function

Hi

Maybe it is time for you to read some basic stuff like R intro. It seems
to me that you expect R to behave like some other language you know but
probably your expectation is wrong.

See inline

>
> HI
>
> >i have a problem please help me to solve it:
> http://r.789695.n4.nabble.com/file/n4639434/aj.pdf aj.pdf
>
> >i want to calculate the vecteur a[j] where j: 1...8
>
> >this is the code in R:
>
> >aj.fun <- function(j, i, X, z, E, beta0, beta1){
> + n <- length(X)
> + iX <- order(X)
> + iz <- order(z)
> + e1 <- -(beta)*z[ iz[1:(i - 1)] ]
where do you get beta

> + numer <- E[j] - sum( X[ iX[1:(i - 1)] ] * exp(e1) )
> + e2 <- -(beta)*z[ iz[i:n] ]
> + denom <- sum( exp(e2) )
> + numer/denom
> + }
>
> > iX<-order(X)
> > iX
>  [1] 75 37 29 60 73 20 69 55 30 70 72 38 26 35 65 61 74 50 71 57 25 54
64 76
> 56
> [26] 58 48 67 46 63 28 62 36 49 47 66  1 42 41 19 39 43 22 51 68 33 27 9
15
> 11
> [51] 10 59 32 40 45 44 52 16 18 34  4 53 21 23 31  7  6 13 14 12 17 24 5
 8
> 2
> [76]  3
>
> > iZ<-order(Z)
> > iZ
>  [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22
23 24
> 25
> [26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
48 49
> 50
> [51] 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
73 74
> 75
> [76] 76
>
> >e1 <- -(beta)*Z[ iZ[1:(i - 1)] ]
> Warning message:
> In 1:(i - 1) : numerical expression has 76 elements: only the first used

As somebody already mentioned i is probably vector and in this case only
first value is taken. i seems to have the firs value 3.

> > e1
> [1]  -442 -1664
>
> >> numer <- E[j] - sum( X[ iX[1:(i - 1)] ] * exp(e1))
> Warning message:
> In 1:(i - 1) : numerical expression has 76 elements: only the first used
> > numer
> [1] 9.5 9.5 9.5 9.5 9.5 9.5 9.5 9.5

Here j is vector of 8 values therefore 8 values

>
> >> e2 <- -(beta)*Z[ iZ[i:n] ]
> Warning message:
> In i:n : numerical expression has 76 elements: only the first used
> > e2
>  [1]  -442 -1664  -442 -1792  -476 -1792  -476 -1792  -510 -1920  -510
-1920
> [13]  -510 -1920  -510 -1920  -510 -1920  -510 -2048  -544 -2048  -544
-2048
> [25]  -544 -2048  -544 -2048  -544 -2048  -544 -2048  -544 -2048  -578
-2176
> [37]  -578 -2176  -578 -2176  -578 -2176  -578 -2176  -578 -2176  -578
-2176
> [49]  -578 -2176  -578 -2176  -578 -2304  -612 -2304  -612 -2304  -612
-2304
> [61]  -612 -2304  -612 -2304  -612 -2304  -612 -2304  -646 -2432  -646
-2432
> [73]  -646 -2432  -646 -2432

Strange, here first value of i seems to be 1 as n shall be 76 and final e2
length is 76.

> > denom <- sum( exp(e2) )


> > numer/denom
> [1] 4.313746e+192 4.313746e+192 4.313746e+192 4.313746e+192
4.313746e+192
> [6] 4.313746e+192 4.313746e+192 4.313746e+192
>
> >my problem that the vecteur a[j] could not have the same number!!!

I do not understand. Your numer is 9.5 repeted 8 times. If you divide it
by one number you will get nine times the same number.

You send us a code but no data so it is difficult to understand what is
your goal. It would be better to send input data

j, i, X, z, E, beta0, beta1

and assumed result in whole not in chunks scattered in several mails.

Regards
Petr


>
>
> thank you in advance
> hafida
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/help-to-
> program-my-function-tp4639434.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 guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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



If you reply to this email, your message will be added to the discussion below:
http://r.789695.n4.nabble.com/help-to-program-my-function-tp4639434p4639565.html
To unsubscribe from help to program my function, click here.
NAML

aj.pdf (42K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: help to program my function

PIKAL Petr
Hi

please cc your post also to Rhelp list, others may give you better/quicker
answer.

>
>
> HI peter
> there is the function  that i want to programm (joint in pdf folder).

No pdf allowed.

> my data is > dataexp    v      Ti1  26    5.792  26 1579.523  26
2323.704
> 28   68.855  28  426.076  28  110.297  28  108.298  28 1067.609  30 17.
> 0510 30   22.6611 30   21.0212 30  175.8813 30  139.0714 30  144.1215 30
 
> 20.4616 30   43.4017 30  194.9018 30   47.3019 30    7.7420 32    0.4021

> 32   82.8522 32    9.8823 32   89.2924 32  215.1025 32    1.7526 32 0.
> 7927 32   15.9328 32    3.9129 32    0.2730 32    0.6931 32  100.5832 32
 
> 27.8033 32   13.9534 32   53.2435 34    0.9636 34    4.1537 34    0.1938

> 34    0.7839 34    8.0140 34   31.7541 34    7.3542 34    6.5043 34 8.
> 2744 34   33.9145 34   32.5246 34    3.1647 34    4.8548 34    2.7849 34
 
> 4.6750 34    1.3151 34   12.0652 34   36.7153 34   72.8954 36    1.9755
36
> 0.5956 36    2.5857 36    1.6958 36    2.7159 36   25.5060 36    0.3561
36
> 0.9962 36    3.9963 36    3.6764 36    2.0765 36    0.9666 36    5.3567
36
> 2.9068 36   13.7769 38    0.4770 38    0.7371 38    1.4072 38    0.7473
38
> 0.3974 38  !
>    1.1375 38    0.0976 38    2.38

Use dput(your.data) and copy it to mail. It is directly redable by R and
not scrambled like above.

> NB> X<-Ti

> thanks for helping mehafida

Not at all. I did not help much yet.

Regards
Petr

>
> Date: Wed, 8 Aug 2012 03:13:28 -0700
> From: [hidden email]
> To: [hidden email]
> Subject: Re: help to program my function
>
>
>
>    Hi
>
>
> Maybe it is time for you to read some basic stuff like R intro. It seems

>
> to me that you expect R to behave like some other language you know but
>
> probably your expectation is wrong.
>
>
> See inline
>
>
> >
>
> > HI
>
> >
>
> > >i have a problem please help me to solve it:
>
> > http://r.789695.n4.nabble.com/file/n4639434/aj.pdf aj.pdf
>
> >
>
> > >i want to calculate the vecteur a[j] where j: 1...8
>
> >
>
> > >this is the code in R:
>
> >
>
> > >aj.fun <- function(j, i, X, z, E, beta0, beta1){
>
> > + n <- length(X)
>
> > + iX <- order(X)
>
> > + iz <- order(z)
>
> > + e1 <- -(beta)*z[ iz[1:(i - 1)] ]
>
> where do you get beta
>
>
> > + numer <- E[j] - sum( X[ iX[1:(i - 1)] ] * exp(e1) )
>
> > + e2 <- -(beta)*z[ iz[i:n] ]
>
> > + denom <- sum( exp(e2) )
>
> > + numer/denom
>
> > + }
>
> >
>
> > > iX<-order(X)
>
> > > iX
>
> >  [1] 75 37 29 60 73 20 69 55 30 70 72 38 26 35 65 61 74 50 71 57 25 54

>
> 64 76
>
> > 56
>
> > [26] 58 48 67 46 63 28 62 36 49 47 66  1 42 41 19 39 43 22 51 68 33 27
9
>
> 15
>
> > 11
>
> > [51] 10 59 32 40 45 44 52 16 18 34  4 53 21 23 31  7  6 13 14 12 17 24
5

>
>  8
>
> > 2
>
> > [76]  3
>
> >
>
> > > iZ<-order(Z)
>
> > > iZ
>
> >  [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22

>
> 23 24
>
> > 25
>
> > [26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47

>
> 48 49
>
> > 50
>
> > [51] 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72

>
> 73 74
>
> > 75
>
> > [76] 76
>
> >
>
> > >e1 <- -(beta)*Z[ iZ[1:(i - 1)] ]
>
> > Warning message:
>
> > In 1:(i - 1) : numerical expression has 76 elements: only the first
used
>
>
> As somebody already mentioned i is probably vector and in this case only

>
> first value is taken. i seems to have the firs value 3.
>
>
> > > e1
>
> > [1]  -442 -1664
>
> >
>
> > >> numer <- E[j] - sum( X[ iX[1:(i - 1)] ] * exp(e1))
>
> > Warning message:
>
> > In 1:(i - 1) : numerical expression has 76 elements: only the first
used

>
> > > numer
>
> > [1] 9.5 9.5 9.5 9.5 9.5 9.5 9.5 9.5
>
>
> Here j is vector of 8 values therefore 8 values
>
>
> >
>
> > >> e2 <- -(beta)*Z[ iZ[i:n] ]
>
> > Warning message:
>
> > In i:n : numerical expression has 76 elements: only the first used
>
> > > e2
>
> >  [1]  -442 -1664  -442 -1792  -476 -1792  -476 -1792  -510 -1920  -510

>
> -1920
>
> > [13]  -510 -1920  -510 -1920  -510 -1920  -510 -2048  -544 -2048  -544

>
> -2048
>
> > [25]  -544 -2048  -544 -2048  -544 -2048  -544 -2048  -544 -2048  -578

>
> -2176
>
> > [37]  -578 -2176  -578 -2176  -578 -2176  -578 -2176  -578 -2176  -578

>
> -2176
>
> > [49]  -578 -2176  -578 -2176  -578 -2304  -612 -2304  -612 -2304  -612

>
> -2304
>
> > [61]  -612 -2304  -612 -2304  -612 -2304  -612 -2304  -646 -2432  -646

>
> -2432
>
> > [73]  -646 -2432  -646 -2432
>
>
> Strange, here first value of i seems to be 1 as n shall be 76 and final
e2

>
> length is 76.
>
>
> > > denom <- sum( exp(e2) )
>
>
>
> > > numer/denom
>
> > [1] 4.313746e+192 4.313746e+192 4.313746e+192 4.313746e+192
>
> 4.313746e+192
>
> > [6] 4.313746e+192 4.313746e+192 4.313746e+192
>
> >
>
> > >my problem that the vecteur a[j] could not have the same number!!!
>
>
> I do not understand. Your numer is 9.5 repeted 8 times. If you divide it

>
> by one number you will get nine times the same number.
>
>
> You send us a code but no data so it is difficult to understand what is
>
> your goal. It would be better to send input data
>
>
> j, i, X, z, E, beta0, beta1
>
>
> and assumed result in whole not in chunks scattered in several mails.
>
>
> Regards
>
> Petr
>
>
>
> >
>
> >
>
> > thank you in advance
>
> > hafida
>
> >
>
> >
>
> >
>
> > --
>
> > View this message in context: http://r.789695.n4.nabble.com/help-to-
> > program-my-function-tp4639434.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 guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
>
> ______________________________________________
>
> [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.
>
>
>
>
>
>
>
>
>
>
>
>
>       If you reply to this email, your message will be added to the
> discussion below:
>       http://r.789695.n4.nabble.com/help-to-program-my-function-
> tp4639434p4639565.html
>
>
>
>       To unsubscribe from help to program my function, click here.
>
>       NAML
>
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/help-to-
> program-my-function-tp4639434p4639605.html
> Sent from the R help mailing list archive at Nabble.com.
>    [[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.

______________________________________________
[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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: help to program my function

hafida
hi peter the pdf folder is in
 http://r.789695.n4.nabble.com/file/n4639434/aj.pdf
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: help to program my function

PIKAL Petr
I am not allowed to connect to Nabble from work, sorry.

Petr

>
> hi peter the pdf folder is in
>  http://r.789695.n4.nabble.com/file/n4639434/aj.pdf
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/help-to-
> program-my-function-tp4639434p4639629.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 guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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