Re: [R] Modified R Code
Dear Sir, Thanks a lot for your guidance. Definitely I will go through lists. The no of variables for any given rate say rate1 are three different ranges. e.g. rate1 has three ranges Range1 = (1.05 - 1.30) Range2 = (1.30 - 1.65) Range3 = (1.65 - 1.99) Likewise rate2 has three ranges Range1 = (2.05 - 2.30) Range3 = (2.30 - 2.65) Range3 = (2.65 - 2.99) etc. (Sir, in the end I need to generate some no of random numbers from varios combinations of these two rates. Effectively there are 3^2 = 9 range combinations and I have already done it.) Sir individually I was able to read newrate[[1]]$min1 etc. but my problem is construction of loop. I am not able to construct a loop though I tried varios options. But I get something like no of items mismatch something. (Unfortunately R is not installed on this machine as it doesn't belong to me so i can't give exact error message) Sir, I need to write the loop for following (Loop is required as I don't know how many rates I will be dealiong with as an input.) rate1_min1 = rates1$min1 rate1_max1 = rates1$max1 rate1_min2 = rates1$min2 rate1_max2 = rates1$max2 rate1_min3 = rates1$min3 rate1_max3 = rates1$max3 rate2_min1 = rates2$min1 rate2_max1 = rates2$max1 rate2_min2 = rates2$min2 rate2_max2 = rates2$max2 rate2_min3 = rates2$min3 rate2_max3 = rates2$max3 Sir, please advise. Regards Maithili --- On Mon, 28/12/09, jim holtman jholt...@gmail.com wrote: From: jim holtman jholt...@gmail.com Subject: Re: [R] Modified R Code To: Maithili Shiva maithili_sh...@yahoo.com Cc: r-help@r-project.org Date: Monday, 28 December, 2009, 1:11 PM For your problem A, why do you want to create so many variables? Leave the data in the 'newrate' list and reference the information from there. It will be much easier. Think about the data structures that you want to work with, especially if you have a variable number of objects/files that you are going to be processing. It is not entirely clear what you are trying to do, but from the basic structure it does appear that with the right data structure you can do what you want without having to 'replicate' a lot of code. For example, if you can easily reference the items in 'newrate' as the following: newrate[[1]]$min1 newrate[[2]]$max3 # and so on This can be done in a loop and it appears that most of Problem B can be handled by common code. You probably need to read a little more about 'lists' because they are your friend in these kind of situations. On Sun, Dec 27, 2009 at 10:55 PM, Maithili Shiva maithili_sh...@yahoo.com wrote: Dear R helpers, I have following input files. (Actually they are more than 10 rates but here i am considering only 2 rates to write my problem) rate1.csv min1 max1 min2 max2 min3 max3 1.051.30 1.30 1.65 1.65 1.99 rate2.csv min1 max1 min2 max2 min3 max3 2.052.30 2.30 2.65 2.65 2.99 The simple R code I had used to read these files was as given below - # OLD CODE rates1 = read.csv('rate1.csv) rates2 = read.csv('rate2.csv') rate1_min1 = rates1$min1 rate1_max1 = rates1$max1 rate1_min2 = rates1$min2 rate1_max2 = rates1$max2 rate1_min3 = rates1$min3 rate1_max3 = rates1$max3 rate2_min1 = rates2$min1 rate2_max1 = rates2$max1 rate2_min2 = rates2$min2 rate2_max2 = rates2$max2 rate2_min3 = rates2$min3 rate2_max3 = rates2$max3 Since I am not aware how many rates I will be dealing with (it can be 2, 4, or 10), hence I can't hardcode my input like I had defined above. So with the guidance of R - help, I had rerwitten the input code as given below. # NEW CODE n = 2 # It gives me no of rates X = paste('rate', 1:n, '.csv', sep = ' ' ) # the output is rate1.csv rate2.csv newrate = lapply(X, read.csv) # the output is as given below newrate [ [1] ] min1 max1 min2 max2 min3 max3 1 1.05 1.30 1.301.65 1.65 1.99 [ [2] ] min1 max1 min2 max2 min3 max3 1 2.05 2.30 2.302.65 2.65 2.99 ## _ ## PROBLEM # PROBLEM - A If I apply the command (As given in OLD CODE above) rate1_min1 = rates1$min1 # The output which I get is min1 1 1.05 On similar lines I define rate1_min1 = newrate[[1]] [1] # The output which I get is min1 1 1.05 rate1_max1 = newrate[[1]] [2] will give me output max1 1 1.30 and so on. So I will have to define it 12 times to assign the respective min and max values. My problem is instead of hard coding like I have done in OLD CODE, I need to assign these respective input values using a loop or some other way (as it becomes cumbersome
[R] Modified R Code
Dear R helpers, I have following input files. (Actually they are more than 10 rates but here i am considering only 2 rates to write my problem) rate1.csv min1 max1 min2 max2 min3 max3 1.051.30 1.30 1.65 1.65 1.99 rate2.csv min1 max1 min2 max2 min3 max3 2.052.30 2.30 2.65 2.65 2.99 The simple R code I had used to read these files was as given below - # OLD CODE rates1 = read.csv('rate1.csv) rates2 = read.csv('rate2.csv') rate1_min1 = rates1$min1 rate1_max1 = rates1$max1 rate1_min2 = rates1$min2 rate1_max2 = rates1$max2 rate1_min3 = rates1$min3 rate1_max3 = rates1$max3 rate2_min1 = rates2$min1 rate2_max1 = rates2$max1 rate2_min2 = rates2$min2 rate2_max2 = rates2$max2 rate2_min3 = rates2$min3 rate2_max3 = rates2$max3 Since I am not aware how many rates I will be dealing with (it can be 2, 4, or 10), hence I can't hardcode my input like I had defined above. So with the guidance of R - help, I had rerwitten the input code as given below. # NEW CODE n = 2 # It gives me no of rates X = paste('rate', 1:n, '.csv', sep = ' ' ) # the output is rate1.csv rate2.csv newrate = lapply(X, read.csv) # the output is as given below newrate [ [1] ] min1 max1 min2 max2 min3 max3 1 1.05 1.30 1.301.65 1.65 1.99 [ [2] ] min1 max1 min2 max2 min3 max3 1 2.05 2.30 2.302.65 2.65 2.99 ## _ ## PROBLEM # PROBLEM - A If I apply the command (As given in OLD CODE above) rate1_min1 = rates1$min1 # The output which I get is min1 1 1.05 On similar lines I define rate1_min1 = newrate[[1]] [1] # The output which I get is min1 1 1.05 rate1_max1 = newrate[[1]] [2] will give me output max1 1 1.30 and so on. So I will have to define it 12 times to assign the respective min and max values. My problem is instead of hard coding like I have done in OLD CODE, I need to assign these respective input values using a loop or some other way (as it becomes cumbersome if no of rates exceed say 10 and also since I am not aware how many rate files i will be dealing with) so that in the end I should be able to assign (say) the values like rate1_min1 = 1.05 rate1_max1 = 1.30 rate1_min2 = 1.30 rate1_max2 = 1.65 rate1_min3 = 1.65 rate1_max3 = 1.99 rate2_min1 = 2.05 rate2_max1 = 2.30 rate2_min2 = 2.30 rate2_max2 = 2.65 rate2_min3 = 2.65 rate2_max3 = 2.99 If there are say 10 rates, then this will continue till rate10_min1 = .. rate10_max1 = .. . so on. ## # PROBLEM - B # Suppose Rij = ith Rate and jth range. (There are 3 ranges i.e. j= 3). data_label = expand.grid(c(R11, R12, R13), c(R21, R23, R23)) # gives the output like data_label Var1 Var2 1 R11 R21 2 R12 R21 3R13 R21 4 R11 R22 5 R12 R22 6 R13 R22 7 R11 R23 8 R12 R23 9R13 R23 If instead of two rates, suppose there are three rates, I will have to modify my code as data_label = expand.grid(c(R11, R12, R13), c(R21, R23, R23), c(R31, R32, R33)) If I define say n = no_of_rates # I will be taking this figure from some otehr csv file. My PROBLEM = B is how do I write the above code pertaining to data_label in terms of 'n'. ## ___ I understand I am giving the impression as I need some kind of spoon feeding. I am giving below the original complete OLD CODE (consisting of 4 rates) I had written in the beginning. Problem with me is to modify it for varaible number of rates. I sincerely apologize for the inconvenience I have caused so far by asking queries. Please guide me. Regards Maithili # MY ORIGINAL CODE (Actual HARD CODE) ## ONS - PPA # INPUT rate_1 = read.csv('rate1_range.csv') rate_2 = read.csv('rate2_range.csv') rate_3 = read.csv('rate3_range.csv') rate_4 = read.csv('rate4_range.csv') prob_1 = read.csv('rate1_probs.csv') prob_2 = read.csv('rate2_probs.csv') prob_3 = read.csv('rate3_probs.csv') prob_4 = read.csv('rate4_probs.csv') rate1_min_1 = rate_1$rate1_range1_min rate1_max_1 = rate_1$rate1_range1_max rate1_min_2 = rate_1$rate1_range2_min rate1_max_2 = rate_1$rate1_range2_max rate1_min_3 = rate_1$rate1_range3_min rate1_max_3 = rate_1$rate1_range3_max rate2_min_1 = rate_2$rate2_range1_min rate2_max_1 = rate_2$rate2_range1_max rate2_min_2 = rate_2$rate2_range2_min rate2_max_2 =
[R] Modified R Code
Dear R helpers, I have following input files. (Actually they are more than 10 rates but here i am considering only 2 rates to write my problem) rate1.csv min1 max1 min2 max2 min3 max3 1.051.30 1.30 1.65 1.65 1.99 rate2.csv min1 max1 min2 max2 min3 max3 2.052.30 2.30 2.65 2.65 2.99 The simple R code I had used to read these files was as given below - # OLD CODE rates1 = read.csv('rate1.csv) rates2 = read.csv('rate2.csv') rate1_min1 = rates1$min1 rate1_max1 = rates1$max1 rate1_min2 = rates1$min2 rate1_max2 = rates1$max2 rate1_min3 = rates1$min3 rate1_max3 = rates1$max3 rate2_min1 = rates2$min1 rate2_max1 = rates2$max1 rate2_min2 = rates2$min2 rate2_max2 = rates2$max2 rate2_min3 = rates2$min3 rate2_max3 = rates2$max3 Since I am not aware how many rates I will be dealing with (it can be 2, 4, or 10), hence I can't hardcode my input like I had defined above. So with the guidance of R - help, I had rerwitten the input code as given below. # NEW CODE n = 2 # It gives me no of rates X = paste('rate', 1:n, '.csv', sep = ' ' ) # the output is rate1.csv rate2.csv newrate = lapply(X, read.csv) # the output is as given below newrate [ [1] ] min1 max1 min2 max2 min3 max3 1 1.05 1.30 1.301.65 1.65 1.99 [ [2] ] min1 max1 min2 max2 min3 max3 1 2.05 2.30 2.302.65 2.65 2.99 ## _ ## PROBLEM # PROBLEM - A If I apply the command (As given in OLD CODE above) rate1_min1 = rates1$min1 # The output which I get is min1 1 1.05 On similar lines I define rate1_min1 = newrate[[1]] [1] # The output which I get is min1 1 1.05 rate1_max1 = newrate[[1]] [2] will give me output max1 1 1.30 and so on. So I will have to define it 12 times to assign the respective min and max values. My problem is instead of hard coding like I have done in OLD CODE, I need to assign these respective input values using a loop or some other way (as it becomes cumbersome if no of rates exceed say 10 and also since I am not aware how many rate files i will be dealing with) so that in the end I should be able to assign (say) the values like rate1_min1 = 1.05 rate1_max1 = 1.30 rate1_min2 = 1.30 rate1_max2 = 1.65 rate1_min3 = 1.65 rate1_max3 = 1.99 rate2_min1 = 2.05 rate2_max1 = 2.30 rate2_min2 = 2.30 rate2_max2 = 2.65 rate2_min3 = 2.65 rate2_max3 = 2.99 If there are say 10 rates, then this will continue till rate10_min1 = .. rate10_max1 = .. . so on. ## # PROBLEM - B # Suppose Rij = ith Rate and jth range. (There are 3 ranges i.e. j= 3). data_label = expand.grid(c(R11, R12, R13), c(R21, R23, R23)) # gives the output like data_label Var1 Var2 1 R11 R21 2 R12 R21 3R13 R21 4 R11 R22 5 R12 R22 6 R13 R22 7 R11 R23 8 R12 R23 9R13 R23 If instead of two rates, suppose there are three rates, I will have to modify my code as data_label = expand.grid(c(R11, R12, R13), c(R21, R23, R23), c(R31, R32, R33)) If I define say n = no_of_rates # I will be taking this figure from some otehr csv file. My PROBLEM = B is how do I write the above code pertaining to data_label in terms of 'n'. ## ___ I sincerely apologize for the inconvenience I have caused so far by asking queries. Please guide me. Regards Maithili The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. [[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] Reading Input file
Dear R helpers  I have some files in my say 'WORK' directory and the file names are say rate1.csv, rate2.csv, rate3.csv, rate4.csv  Because of some other requirement, I need to run the following commands  n = 4  rates = NULL  for (i in 1:n) rates[i] = (paste(`rate', i, â.csv`, sep = ââ))  # this gives me rate1.csv rate2.csv and so on  #My problem is now I need to relate these file names with actual files and read these files # There are files rate1.csv, rate2.csv, rate3.csv, rate4.csv in my WORK directory.   # If I individually define  PPP = read.csv(ârate[1]â) PPP     # When I run PPP in R, it gives contents of the file rate1.csv i.e. I am able to read the required rate1 file. But if I run following commands, I get errors.  newrate = NULL  for (i in 1:n)   {    newrate[i] = read.csv(rates[i])   }  I need to read all these four files for my further analysis. Please guide.   Regards  Maithili   The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. [[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] Reading Input file
Dear R helpers / Johannes Sir,  Unfortunately it didn't work. I am getting following warning messages.  1: In neweate[i] = read.csv(rates[i]) :  number of items to replace is not a multiple of replacement length. 2: similar message 3: similar message 4: similar message  Let me be specific in my problem.  I have three csv files as  rate1.csv r1       r2       r3       r4       r5        r6 10.1  10.25  10.25  10.50  10.50   10.75  rate2.csv r1       r2       r3       r4       r5        r6 15.1  15.45  15.45  15.70  15.70   15.90  rate3.csv r1       r2       r3       r4       r5        r6 18.3  18.50  18.50  18.65  18.65   18.95  Normally I can read these files as  newrate1 = read.csv('rate1.csv'') newrate2  = read.csv('rate2.csv') newrate3 = read.csv('rate3.csv')  However, due to some other requirement first I have to define following R code  n = 3  rate_name = NULL  for (i in 1:n) rate_name[i] = (paste(`rate', i, â.csv`, sep = ââ)) # rate_name gives rate1.csv rate2.csv ratë3.csv   ### MY TASK  I need to use the rate_names to read the actual rate1.csv, rate2.csv and rate3.csv files.  When I use the following code  newrate - list() for (i in 1:n)   {    newrate[i] = read.csv(rate_name[i])   } I get following warning messages  1: In newrate[i] = read.csv(rate_name[i]) :  number of items to replace is not a multiple of replacement length 2: similar message 3: similar message   ## APPROACH II  PPP = matrix(data = rate_name, nrow = 1, ncol = 3, byrow = FALSE) X = matrix(data = NA, nrow = 3, ncol = 6, byrow = FALSE)  for (j in 1:3) X = read.csv(PPP[1, j])  # X returns (i.e. only first record is taken)  r1       r2       r3       r4       r5        r6 10.1  10.25  10.25  10.50  10.50   10.75   Please guide  With regards  Maithili   --- On Sat, 26/12/09, Johannes Signer j.m.sig...@gmail.com wrote: From: Johannes Signer j.m.sig...@gmail.com Subject: Re: [R] Reading Input file To: Maithili Shiva maithili_sh...@yahoo.com Cc: r-help@r-project.org Date: Saturday, 26 December, 2009, 9:42 AM On Sat, Dec 26, 2009 at 10:21 AM, Maithili Shiva maithili_sh...@yahoo.com wrote: Dear R helpers  I have some files in my say 'WORK' directory and the file names are say rate1.csv, rate2.csv, rate3.csv, rate4.csv  Because of some other requirement, I need to run the following commands  n = 4  rates = NULL  for (i in 1:n) rates[i] = (paste(`rate', i, â.csv`, sep = ââ))  # this gives me rate1.csv rate2.csv and so on  #My problem is now I need to relate these file names with actual files and read these files # There are files rate1.csv, rate2.csv, rate3.csv, rate4.csv in my WORK directory.   # If I individually define  PPP = read.csv(ârate[1]â) PPP     # When I run PPP in R, it gives contents of the file rate1.csv i.e. I am able to read the required rate1 file. But if I run following commands, I get errors.  newrate = NULL  Maybe try: newrate - list() and leave everything else as it is. just an idea,  for (i in 1:n)   {    newrate[i] = read.csv(rates[i])   }  I need to read all these four files for my further analysis. Please guide.   Regards  Maithili      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage.     [[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. [[elided Yahoo spam]] [[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] An unprofessional message
Dear R helpers, I understand that this is absolutely unprofessional on my part and this group doesn't entertain such things. I have been associted with this group since last 1 and half years and have been immensely benefited by the noble service rendred by many R helpers. So I take this opportunity to thank all of you and wish you all MERRY CHRISTMAS. I sincerely apologize for using this platform for writing such an unprofessional message and especially when I am aware that nobody has ever done such thing but I really mean it. Warm Regards Maithili The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. [[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] Reading multiple Input Files
Dear R helpers, Suppose I am dealing with no of interest rates at a time and the no of interest rates I am selecting for my analysis is random i.e. it can be 2, can be 10 or even higher. The R-code I had written (with the guidance of R helpers obviously and I am really grateful to all of you) as of now is sort of hard coding when it comes to reading interest rates as an input e.g. ## INPUT rate_1 = read.csv('rate1_range.csv') rate_2 = read.csv('rate2_range.csv') rate_3 = read.csv('rate3_range.csv') rate_4 = read.csv('rate4_range.csv') prob_1 = read.csv('rate1_probs.csv') prob_2 = read.csv('rate2_probs.csv') prob_3 = read.csv('rate3_probs.csv') prob_4 = read.csv('rate4_probs.csv') However, since I am not sure how many interest rates I will be dealing with to begin with, I have tried to call these inputs using a loop as follows. In my R working directory, following files are there which are to be read as input.. rate1_range.csv rate2_range.csv rate3_range.csv rate4_range.csv rate1_probs.csv rate2_probs.csv rate3_probs.csv rate4_probs.csv My R Code # ___ n = no_of_Interest_Rates # This 'n' will be suppllied separately can be anything. n= 4 # As mentioned, this input will be added seperately. for (i in 1:n) { rate_[i] = read.csv('rate[i]_range.csv') prob_[i] = read.csv('rate[i]_probs.csv') } # End of code. However when I excute this code (here, n = 4), I get following error. Error in file(file, r) : cannot open the connection In addition: Warning message: In file(file, r) : cannot open file 'rate[i]_range.csv': No such file or directory Obviously as usual I have written some stupid code. Please guide Regards Maithili The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. [[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] Random Number Generation in a Loop
Dear R helpers I am having following data Name Numbers A 25 B 3 C 13 A 5 B 7 C 0 A 2 B 10 C 9 CONDITIONS If Name is A, min_val = 1.05, max_val = 1.30 If Name is B, min_val = 1.30, max_val = 1.60 If Name is C, min_val = 1.60, max_val = 1.99 TASK To generate the Uniform random nos for each of these Names (Equal to the corresponding no. e.g. the 5th Name is B, so I need to generate 7 uniform random numbers in the range (1.30 - 1.99). Also I need to arrange these random numbers one by one in a single csv file i.e. say 25 random numbers in teh range (1.05-1.30) followed by 3 random numbers in the range (1.30-1.60) and so on. # ___ Here is the R code I have tried ONS - read.table(textConnection(name number A11 12 A12 17 A13 0 A11 11 A12 6 A13 0 A11 8 A12 4 A13 3), header = TRUE) X = as.character(ONS$name) Y = ONS$number Z = NULL for (i in 1:length(X)) { if(X[i] == 'A11') { min_val = 1.05 max_val = 1.30 Z = runif(Y[i], min_val, max_val) } else { if(X[i] == 'A12') { min_val = 1.30 max_val = 1.60 Z = runif(Y[i], min_val, max_val) } else { if(X[i] == 'A13') { min_val = 1.60 max_val = 1.99 Z = runif(Y[i], min_val, max_val) } } } } # End of Code ## _ PROBLEM I need to get 61 random numbers which is total of all the numbers (1st 12 fo A, 3 random numbers for B, 13 for C, 5 again fo A and so on). The result whcih I got is Z [1] 1.740443 1.761758 1.797222 which is pertaining to the last name C where 3 random numbers are generated i.e. Z instaed of getting added, is overwritten. Please help me to rectify my code so that in the end I will get 61 random numbers as desired i.e. 12 for A in the range (1.05 - 1.30), 3 for B in the range (1.30 - 1.60), 13 for C in the range (1.60-1.99), again 5 for A in the range (1.05 - 1.30). Thanking in advance. I also sincerely apologize for writing such a long mail, as I wanted to be clear as possible in my communication. Regards Maithili The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. [[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] CORRECTION - Generation of Random numbers in a loop
Dear R helpers, please ignore my earlier mail. Here is the corrected mail. Please forgive me for the lapses on my part. Extremely sorry. Here is the corrected mail. Dear R helpers I am having following data Name Numbers A11 12 A12 17 A13 0 A11 11 A12 6 A13 0 A11 8 A12 4 A13 3 CONDITIONS If Name is A11, min_val = 1.05, max_val = 1.30 If Name is A12, min_val = 1.30, max_val = 1.60 If Name is A13, min_val = 1.60, max_val = 1.99 TASK To generate the Uniform random nos for each of these Names (Equal to the corresponding no. e.g. the 5th Name is A12, so I need to generate 6 uniform random numbers in the range (1.30 - 1.99). Also I need to arrange these random numbers one by one in a single csv file i.e. say 12 random numbers in teh range (1.05-1.30) followed by 17 random numbers in the range (1.30-1.60) and so on. # ___ Here is the R code I have tried ONS - read.table(textConnection(name number A11 12 A12 17 A13 0 A11 11 A12 6 A13 0 A11 8 A12 4 A13 3), header = TRUE) X = as.character(ONS$name) Y = ONS$number Z = NULL for (i in 1:length(X)) { if(X[i] == 'A11') { min_val = 1.05 max_val = 1.30 Z = runif(Y[i], min_val, max_val) } else { if(X[i] == 'A12') { min_val = 1.30 max_val = 1.60 Z = runif(Y[i], min_val, max_val) } else { if(X[i] == 'A13') { min_val = 1.60 max_val = 1.99 Z = runif(Y[i], min_val, max_val) } } } } # End of Code ## _ PROBLEM I need to get 61 random numbers which is total of all the numbers (1st 12 fo A, 3 random numbers for B, 13 for C, 5 again fo A and so on). The result whcih I got is Z [1] 1.740443 1.761758 1.797222 which is pertaining to the last name C where 3 random numbers are generated i.e. Z instaed of getting added, is overwritten. Please help me to rectify my code so that in the end I will get 61 random numbers as desired i.e. 12 for A in the range (1.05 - 1.30), 3 for B in the range (1.30 - 1.60), 13 for C in the range (1.60-1.99), again 5 for A in the range (1.05 - 1.30). Thanking in advance. I also sincerely apologize for writing such a long mail, as I wanted to be clear as possible in my communication. Regards Maithili The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. [[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] Random numbers for a group
Dear R helpers I have following table Name no_of_instances AAA 12 AA 17 A 0 BBB 11 BB 6 B 0 C 8 D 3 Now I need to generate the uniform random numbers (against the no. of instances) and assign these numbers generated against the respective names. E.g. I need to generate 12 random numbers and assign these numbers against AAA. Individually I can generate them as AAA_no = c(runif(12)) AA_no = c(runif(17)) .. and so on. And in the end I can club them as ran_nos = c(AAA_no, AA_no, ..D_no) My problem is if there are say 1000 names, then it will be a cumbersome job to generate 1000 individual random number sets and then to combine them to form a single dataset. Is there any alternative to this? Thanking in advance With regards Maithili The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. [[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] writing 'output.csv' file
Dear R helpers Suppose M - c(1:10) # length(M) = 10 N - c(25:50) # length(N) = 26 I wish to have an outut file giving M and N. So I have tried write.csv(data.frame(M, N), 'output.csv', row.names = FALSE) but I get the following error message Error in data.frame(M, N) : arguments imply differing number of rows: 10, 26 How do I modify my write.csv command to get my output in a single (csv) file irrespective of lengths. Plese Guide Thanks in advance Maithili The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. [[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] writing 'output.csv' file
Dear Mr Signer and Mr Cleland, Thanks a lot for you great help. However, the output which I am getting is as given below - x 1;25 2;26 3;27 4;28 5;29 6;30 7;31 8;32 9;33 10;34 ;35 ;36 ;37 ;38 ;39 ;40 ;41 ;42 ;43 ;44 ;45 ;46 ;47 ;48 ;49 ;50 However, my requirement is I should get the csv file as M N 1 25 2 26 3 27 10 34 35 36 37 .. .. 50 So that I can acrry out further calcualtions on this output file. Please guide. Regards Maithili --- On Fri, 4/12/09, Johannes Signer j.m.sig...@gmail.com wrote: From: Johannes Signer j.m.sig...@gmail.com Subject: Re: [R] writing 'output.csv' file To: Maithili Shiva maithili_sh...@yahoo.com Date: Friday, 4 December, 2009, 10:29 AM Hello, maybe that helps: write.csv(paste((c(m,rep( ,length(N)-length(M,n, sep=;), output.csv, row.names=F) Johannes On Fri, Dec 4, 2009 at 11:12 AM, Maithili Shiva maithili_sh...@yahoo.com wrote: Dear R helpers Suppose M - c(1:10) # length(M) = 10 N - c(25:50) # length(N) = 26 I wish to have an outut file giving M and N. So I have tried write.csv(data.frame(M, N), 'output.csv', row.names = FALSE) but I get the following error message Error in data.frame(M, N) : arguments imply differing number of rows: 10, 26 How do I modify my write.csv command to get my output in a single (csv) file irrespective of lengths. Plese Guide Thanks in advance Maithili The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. [[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. [[elided Yahoo spam]] [[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] Calculation of Central Moments
Dear R helpers If for a given data, I need to calculate Mean, Standard Deviation, Mode, Median, Skewness, Kurtosis, is there any package in R, which will calculate these moments? Individually I can calculate these, but if there is any function which will calculate these at a stretch, please let me know. Maithili The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. [[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] Parameters of Beta distribution
Supose I have a data pertaining to credit loss as amounts - c(46839.50,31177.12,35696.69,21192.57,29200.91,42049.64,42422.19, 44976.18, 32135.36,47936.57,27322.91,37359.09,43179.60, 48381.02, 45872.38, 28057.30,44643.83,36156.33,16037.62, 45432.28) I am trying to fit Beta distribution (two parameters distribution but where lower bound and upper bounds are NOT 0 and 1 respectively). For this I need to estimate the two parameters of Beta distribution. I found some code in VGAM pacakge but it deals with standard Beta distribution i.e. lower bound (say A) = 0 and upper bound (say B) = 1. How do I estimate the parameters of the Beta distribution for above data where A and B are not 0's? Please guide. Thanking you in advance Maithili Add whatever you love to the Yahoo! India homepage. Try now! http://in.yahoo.com/trynew [[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] Parameters of Beta distribution
Dear Albyn, Thanks for your reply. Yes A and B are unknown. I was just thinking to assign - A = min(amounts) and B = max(amounts). The actual loss data I am dealing with is large. I am trying to fit some statistical distributions to this data. I already have done with R code pertaining to many other distributions like Normal, Weibull, Pareto, Generalized extreme Value distribution etc. So just want to know how to estimate the parameters if I need to check whether the Beta distribution fits the loss data. Is it possible for you to guide me how to estimate A and B or can I assume A = min(amounts) and B = max(Amounts) Regards Maithili --- On Wed, 7/10/09, Albyn Jones jo...@reed.edu wrote: From: Albyn Jones jo...@reed.edu Subject: Re: [R] Parameters of Beta distribution To: jlu...@ria.buffalo.edu Cc: Maithili Shiva maithili_sh...@yahoo.com, r-help@r-project.org, r-help-boun...@r-project.org Date: Wednesday, 7 October, 2009, 3:30 PM Are A and B known? That is, are there known upper and lower bounds for this credit loss data? If not, you need to think about how to estimate those bounds. Why do you believe the data have a beta distribution? albyn On Wed, Oct 07, 2009 at 09:03:31AM -0400, jlu...@ria.buffalo.edu wrote: Rescale your data x to (x-A)/(B-A). Maithili Shiva maithili_sh...@yahoo.com Sent by: r-help-boun...@r-project.org 10/07/2009 08:39 AM To r-help@r-project.org cc Subject [R] Parameters of Beta distribution Supose I have a data pertaining to credit loss as amounts - c(46839.50,31177.12,35696.69,21192.57,29200.91,42049.64,42422.19, 44976.18, 32135.36,47936.57,27322.91,37359.09,43179.60, 48381.02, 45872.38, 28057.30,44643.83,36156.33,16037.62, 45432.28) I am trying to fit Beta distribution (two parameters distribution but where lower bound and upper bounds are NOT 0 and 1 respectively). For this I need to estimate the two parameters of Beta distribution. I found some code in VGAM pacakge but it deals with standard Beta distribution i.e. lower bound (say A) = 0 and upper bound (say B) = 1. How do I estimate the parameters of the Beta distribution for above data where A and B are not 0's? Please guide. Thanking you in advance Maithili Add whatever you love to the Yahoo! India homepage. Try now! http://in.yahoo.com/trynew [[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. [[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. Now, send attachments up to 25MB with Yahoo! India Mail. Learn how. http://in.overview.mail.yahoo.com/photos [[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] Fw: PROBLEM - - COMPARING AND COMBINING two DATASETS
Dear Sir,  Thanks a lot for your solution and guidance. It worked wonderfully.  Regards  Maithili --- On Thu, 27/8/09, Gabor Grothendieck ggrothendi...@gmail.com wrote: From: Gabor Grothendieck ggrothendi...@gmail.com Subject: Re: [R] Fw: PROBLEM - - COMPARING AND COMBINING two DATASETS To: Maithili Shiva maithili_sh...@yahoo.com Cc: r-help@r-project.org Date: Thursday, 27 August, 2009, 2:09 PM Try this: xtabs(B ~ factor(A, seq(max(A On Thu, Aug 27, 2009 at 8:26 AM, Maithili Shivamaithili_sh...@yahoo.com wrote: Dear Sirs, At the outset I sincerely apologize for reproducing my query to you. I also thank all of you for the solution you had provided. It has worked on the actual data I am working with. However, there is this peculiar problem which I had realized only after I had obtained my results. e.g. in the example I had attached A - c(2, 2, 1, 3, 7, 3, 3, 1, 14, 7, 31) B - c(0.0728,0.9538,4.0140,0.0020,2.5593,0.1620,2.513,0.3798, .0033,0..2282, 0.1614) tapply( B, A, sum) I get R output as â  1         2        3          7          14        31 4.3938  1.0266  2.6770   2.7875   0.0033   0.1614 However, my requirement is I should get the output as 1          2         3        4  5  6  7        8  9 â¦. 14 â¦â¦â¦..31 4.3938 1.0266  2.6770   0  0  0  2.7875  0  0 ..0.0033 .. 0.161 i.e. my output should include the values 4, 5, 6, etc. which are not part of dataset A and the corresponding totals in B (which are anyways 0âs). I need this for my further analysis. Its possible for me to add these 0âs manually, however when the dataset is large, its not practical. I am attaching herewith an excel file. I will be grateful if you can guide me. Thanks in advance Maithili start: 2009-08-18 end: -00-00 Thinking of ordering food? Find restaurant numbers on Yahoo! India Local    Love Cricket? Check out live scores, photos, video highlights and more. Click here http://cricket.yahoo.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. Love Cricket? Check out live scores, photos, video highlights and more. Click here http://cricket.yahoo.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] Comparing and adding two data series
Dear R helpers I have two series A and B as given below - A - c(2, 2, 1, 3, 7, 3, 3, 1, 14, 7, 31) B - c(0.0728,0.9538,4.0140,0.0020,2.5593,0.1620,2.513,0.3798, .0033,0.2282, 0.1614) I need to calculate the total in dataset B corresponding to the numbers in dataset A i.e. for no 1 in A, I need the total as 4.0140+0.3798 (as 1 is repeated twice) for no 2, I need the total as 0.0728+0.9538 (as 2 is also repeated tqice and so on) Thus for no 31 in A, I should get only 0.1614. I have written the R code but its not working. My code is as follows, # -- D - array() i = 1 for (i in 1:max(A)) { D[i] = 0 i = i + 1 } # _ T - array() k = 1 m = 1 for (k in 1:max(A)) { for (m in 1:max(A)) { if (D[m] == k) T[k] = T[m] + B[m] else T[k] = T[m] + 0 m= m + 1 } k= k + 1 } # - Please correct me. I think I have messed up with the loops but not able to understand where. Please guide me. Thanking in advance Maithili See the Web#39;s breaking stories, chosen by people like you. Check out Yahoo! Buzz. http://in.buzz.yahoo.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] Comparing and adding two data series
Dear Gerrit Eichner Thanks a million. This only proves how powerful R is. I really appreciate your kind help. Sometimes I really wonder from where I can learn such commands. Thanks again. With warmest regards Maithili --- On Thu, 27/8/09, Gerrit Eichner gerrit.eich...@math.uni-giessen.de wrote: From: Gerrit Eichner gerrit.eich...@math.uni-giessen.de Subject: Re: [R] Comparing and adding two data series To: Maithili Shiva maithili_sh...@yahoo.com Date: Thursday, 27 August, 2009, 10:57 AM Try tapply( B, A, sum) On Thu, 27 Aug 2009, Maithili Shiva wrote: Dear R helpers I have two series A and B as given below - A - c(2, 2, 1, 3, 7, 3, 3, 1, 14, 7, 31) B - c(0.0728,0.9538,4.0140,0.0020,2.5593,0.1620,2.513,0.3798, .0033,0.2282, 0.1614) I need to calculate the total in dataset B corresponding to the numbers in dataset A i.e. for no 1 in A, I need the total as 4.0140+0.3798 (as 1 is repeated twice) for no 2, I need the total as 0.0728+0.9538 (as 2 is also repeated tqice and so on) Thus for no 31 in A, I should get only 0.1614. I have written the R code but its not working. My code is as follows, # -- D - array() i = 1 for (i in 1:max(A)) { D[i] = 0 i = i + 1 } # _ T - array() k = 1 m = 1 for (k in 1:max(A)) { for (m in 1:max(A)) { if (D[m] == k) T[k] = T[m] + B[m] else T[k] = T[m] + 0 m= m + 1 } k= k + 1 } # - Please correct me. I think I have messed up with the loops but not able to understand where. Please guide me. Thanking in advance Maithili See the Web's breaking stories, chosen by people like you. Check out Yahoo! Buzz. http://in.buzz.yahoo.com/ [[alternative HTML version deleted]] Best regards -- Gerrit Best regards -- Gerrit Eichner Viele Grüße -- Gerrit Viele Grüße -- Gerrit Eichner Viele Grüße -- GE Grüße -- Gerrit Grüße -- Gerrit Eichner Grüße -- GE Gruß -- G - AOR Dr. Gerrit Eichner Mathematical Institute, Room 305 E gerrit.eich...@math.uni-giessen.de justus-liebig-university Giessen Tel: +49-(0)641-99-32104 Arndtstr. 2, 35392 Giessen, Germany Fax: +49-(0)641-99-32109 http://www.uni-giessen.de/~gcb7 - Love Cricket? Check out live scores, photos, video highlights and mor [[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] Comparing and adding two data series
Dear Peter Konings Thanks a lot for your kind advice. It worked wonderfully. Thanks again Regards Maithili --- On Thu, 27/8/09, Peter Konings peter.l.e.koni...@gmail.com wrote: From: Peter Konings peter.l.e.koni...@gmail.com Subject: Re: [R] Comparing and adding two data series To: Maithili Shiva maithili_sh...@yahoo.com Date: Thursday, 27 August, 2009, 11:12 AM Hi Maithili, how about tapply(B, A, sum) HTH Peter. On Thu, Aug 27, 2009 at 12:38 PM, Maithili Shiva maithili_sh...@yahoo.com wrote: Dear R helpers I have two series A and B as given below - A - c(2, 2, 1, 3, 7, 3, 3, 1, 14, 7, 31) B - c(0.0728,0.9538,4.0140,0.0020,2.5593,0.1620,2.513,0.3798, .0033,0.2282, 0.1614) I need to calculate the total in dataset B corresponding to the numbers in dataset A i.e. for no 1 in A, I need the total as 4.0140+0.3798 (as 1 is repeated twice) for no 2, I need the total as 0.0728+0.9538 (as 2 is also repeated tqice and so on) Thus for no 31 in A, I should get only 0.1614. I have written the R code but its not working. My code is as follows, # -- D - array() i = 1 for (i in 1:max(A)) { D[i] = 0 i = i + 1 } # _ T - array() k = 1 m = 1 for (k in 1:max(A)) { for (m in 1:max(A)) { if (D[m] == k) T[k] = T[m] + B[m] else T[k] = T[m] + 0 m= m + 1 } k= k + 1 } # - Please correct me. I think I have messed up with the loops but not able to understand where. Please guide me. Thanking in advance Maithili See the Web's breaking stories, chosen by people like you. Check out Yahoo! Buzz. http://in.buzz.yahoo.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. See the Web#39;s breaking stories, chosen by people like you. Check [[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] Fw: PROBLEM - - COMPARING AND COMBINING two DATASETS
Dear Sirs, At the outset I sincerely apologize for reproducing my query to you. I also thank all of you for the solution you had provided. It has worked on the actual data I am working with. However, there is this peculiar problem which I had realized only after I had obtained my results. e.g. in the example I had attached A - c(2, 2, 1, 3, 7, 3, 3, 1, 14, 7, 31) B - c(0.0728,0.9538,4.0140,0.0020,2.5593,0.1620,2.513,0.3798, .0033,0..2282, 0.1614) tapply( B, A, sum) I get R output as – 1 2 3 7 14 31 4.3938 1.0266 2.6770 2.7875 0.0033 0.1614 However, my requirement is I should get the output as 1 2 3 4 5 6 7 8 9 …. 14 ………..31 4.3938 1.0266 2.6770 0 0 0 2.7875 0 0 ..0.0033 .. 0.161 i.e. my output should include the values 4, 5, 6, etc. which are not part of dataset A and the corresponding totals in B (which are anyways 0’s). I need this for my further analysis. Its possible for me to add these 0’s manually, however when the dataset is large, its not practical. I am attaching herewith an excel file. I will be grateful if you can guide me. Thanks in advance Maithili start: 2009-08-18 end: -00-00 Thinking of ordering food? Find restaurant numbers on Yahoo! India Local Love Cricket? Check out live scores, photos, video highlights and more. Click here http://cricket.yahoo.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] Fw: PROBLEM - - COMPARING AND COMBINING two DATASETS
Dear Sirs,  Thanks again for the solution. That was VERY KIND of you to readress my query again and again. Please accept my sincere aplogies for referring the problem again and thanks again for the solution. You were very patience and I really appreciate that. Have a great day ahead.  With warm regards  Maithili --- On Thu, 27/8/09, David Winsemius dwinsem...@comcast.net wrote: From: David Winsemius dwinsem...@comcast.net Subject: Re: [R] Fw: PROBLEM - - COMPARING AND COMBINING two DATASETS To: Henrique Dallazuanna www...@gmail.com Cc: Maithili Shiva maithili_sh...@yahoo.com, r-help@r-project.org Date: Thursday, 27 August, 2009, 1:45 PM On Aug 27, 2009, at 8:31 AM, Henrique Dallazuanna wrote: Try this: tapply(B, factor(A, levels = seq(max(A))), sum) Nice! It might have a disadvantage in that it produces NA's instead of the requested 0's, but that would be easily remedied with an: is.na(obj) - 0 It was much neater than my hack: sapply(1:max(A), function(x) ifelse(x %in% A, tapply(B, A, sum)[as.character(x)], 0) ) Which would have neded to be rbind()'ed to 1:max(A) to get the desired construction. --David. On Thu, Aug 27, 2009 at 9:26 AM, Maithili Shiva maithili_sh...@yahoo.comwrote: Dear Sirs, At the outset I sincerely apologize for reproducing my query to you. I also thank all of you for the solution you had provided. It has worked on the actual data I am working with. However, there is this peculiar problem which I had realized only after I had obtained my results. e.g. in the example I had attached A - c(2, 2, 1, 3, 7, 3, 3, 1, 14, 7, 31) B - c(0.0728,0.9538,4.0140,0.0020,2.5593,0.1620,2.513,0.3798, .0033,0..2282, 0.1614) tapply( B, A, sum) I get R output as â 1     2     3      7      14     31 4.3938   1.0266   2.6770  2.7875  0.0033  0.1614 However, my requirement is I should get the output as 1     2     3      4 5 6 7      8 9 . 14 ..31 4.3938 1.0266 2.6770   0 0 0 2.7875 0 0 ..0.0033 .. 0.161 i.e. my output should include the values 4, 5, 6, etc. which are not part of dataset A and the corresponding totals in B (which are anyways 0âs). I need this for my further analysis. Its possible for me to add these 0âs manually, however when the dataset is large, its not practical. I am attaching herewith an excel file. I will be grateful if you can guide me. Thanks in advance Maithili start: 2009-08-18 end: -00-00 Thinking of ordering food? Find restaurant numbers on Yahoo! India Local     Love Cricket? Check out live scores, photos, video highlights and more. Click here http://cricket.yahoo.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. David Winsemius, MD Heritage Laboratories West Hartford, CT Love Cricket? Check out live scores, photos, video highlights and more. Click here http://cricket.yahoo.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] Log logistic Distribution - Parameter estimation
Dear R helpers, I have following data c(19679.50,5975.72,17555.52,20078.08,1956.97,8383.25,7899.27,4881.75,2719.29,11701.96,13104.25,10081.01,9417.72,14976.89,7119.62,8373.56,24580.52,8330..70,9110.07,7848.08,12910.46,10310.53,20390.34,15824.71,21703.33) How do I fit 3 parameter Log Logistic distribution to this data? Thanking in advance Maithili Love Cricket? Check out live scores, photos, video highlights and more. Click here http://cricket.yahoo.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] lmom - Estimating Normal Distribution Parameters using lmom package
Dear R helpers, I have a data of 2102 observations (consisting of 0's also), to which I am trying to fit Normal distribution using lmom pacakage. If I use Excel, its easy to estimate the parameters of Normal distribution as simple mean and standard devaition. The results I get if I use teh excel are as Parameters of Normal distribution :- Mean = 22986.44 and standard deviation = 223452.88 However, if I use the R code using the lmom package, I get the mean as 22986.39 and standard deviation as 39029.79. Regards Maithili My R code is as follows. (Actually its a two line code, but since I am representing data using 'c', the code looks too big.) library(lmom) amounts - c(0,0,18561.9,0,0,0,34400,0,0,0,0,2190,0,0,0,0,6,0,0,0,19583,0,0,0,109872.87,0,0,0,0,0,0,1244,0,0,25150,0,500,0,0,0,0,0,0,0,100,0,0,0,0,0,0,500,41533.94,1365,0,0,11400,0,0,0,0,0,1,0,0,11000,0,0,0,0,0,0,11600,0,0,0,21530,0,2000,0,10100,4500,5000,0,0,1,0,28667,0,0,0,45000,0,0,0,0,0,100,0,0,2100,0,0,0,1000,0,0,0,0,17000,0,0,0,0,0,0,0,0,140270,2000,0,1900678.25,19450,0,0,4400,0,0,0,6136,0,0,0,0,0,0,0,0,0,0,0,0,0,20900,0,0,525,8306,0,0,0,0,0,9497,0,291264,0,0,0,0,0,2825,0,0,0,0,0,75000,0,0,0,0,0,6000,4300,3062,0,0,159649,0,0,61329,0,0,0,0,0,0,0,0,0,214816,0,0,0,0,0,0,0,1200,0,0,10364,0,0,0,300,0,0,0,0,0,156888,0,0,0,0,0,0,0,0,0,0,0,0,0,200,0,1164.55,0,0,0,0,0,0,0,0,540,0,0,0,460.52,0,0,0,0,0,0,0,0,0,0,0,500,0,0,0,0,540,500,15000,0,0,0,0,6400,0,0,0,2900,7200,0,0,0,0,400,0,800,0,500,0,0,0,0,0,0,13550,0,0,40410,100,0,0,0,0,5818,50700,0,0,0,0,0,0,0,0,4800,0,0,0,0,0,0,0,0,0,0,0,500,0,0,0,0,0,0,0,0,0,0,0,0,0,133.29,0,5750,100,0,0,0,0,0,0,0,2116,3165.7 4,0,0,14554,2700,0,151869,0,0,0,0,6400,0,0,15827.73,0,0,0,0,0,0,0,235607.56,0,0,0,0,225.65,0,0,0,0,725.04,0,0,0,0,151869,0,0,0,0,0,0,0,46800,0,0,0,0,0,3520,5,0,0,0,0,2790,0,0,800,0,0,0,0,0,0,0,0,156.66,0,0,0,0,0,0,2200,0,357,0,283205,3466.26,0,503875,0,328681.27,0,0,0,0,1000,3600,12050,1000,0,0,0,0,0,0,0,0,0,0,0,0,121.44,0,1485,0,0,5100,0,937675,0,0,0,0,0,356.87,0,12923.56,9576,0,0,207879,0,0,0,1989,0,0,10233,207.55,1322,0,0,0,0,2320.38,0,0,6440,6111,82463,0,0,0,132.84,0,0,0,0,0,0,96161.74,0,0,0,0,0,0,271.16,0,0,0,0,225.83,0,0,0,0,0,0,0,0,0,17398,0,0,0,0,0,0,0,0,0,0,0,260.61,0,0,0,0,0,0,0,0,412.14,0,0,0,0,102.21,170420,29465,0,0,0,0,0,20819.21,0,10056,26200,0,2975.81,7199.83,0,0,0,2650,0,0,0,0,0,0,0,0,101.57,9000,0,0,105,0,774099.69,0,235.28,0,247.63,0,0,0,0,25761.56,13483,0,0,170.72,0,0,137.3,180.02,0,17555,0,0,0,468.29,0,0,0,154.51,0,0,11200,0,0,0,0,0,130.89,0,3927.38,0,0,0,0,0,1307.78,0,0,2869.32,1642.74,0,0,0,0,401.41,0,0,0,0,12503.86,10366.19,0 ,124358,0,0,37953.17,0,1009.74,0,12110,1046.9,0,5610,3118.39,0,5682.04,0,0,0,1905.77,7707.59,0,3264.68,0,797.7,0,2371.42,0,0,7279.16,1093.15,0,0,1066510.66,8979.86,2989.93,129.92,0,1095.61,0,1125.01,20499.51,2240.99,0,0,3353.65,0,0,1129.23,0,2155.72,4000,800.56,0,0,0,1736.44,5584.1,1899.55,1334.25,239925,200768.55,560.61,11037,4739.74,1953.09,174.18,0,112.53,0,0,831.75,0,800.78,0,23877.68,0,1235.74,950,73796.05,9065.76,0,828.12,0,112.12,94637.19,0,1565.34,0,0,27121.17,53940,84872.23,0,0,0,0,0,0,116.83,0,0,0,0,114.17,0,0,886.28,5820,0,0,0,0,4888,0,0,0,0,0,1138.89,0,621.47,177513.55,0,531.32,5,0,0,897,0,0,0,0,0,2,0,0,0,188474,0,743.24,0,0,958.16,0,0,12321,561.36,0,0,1947.76,0,4262.85,2478632.75,0,0,0,4671.33,0,0,2985.59,0,0,0,0,0,0,0,0,0,0,10952.18,0,0,0,63505.07,5656.89,0,1609.95,0,0,1267,0,6355.59,1350,1708.71,0,951.67,0,0,0,0,908.81,0,0,0,0,0,0,1130.1,0,0,0,4453.55,0,0,12394,0,0,0,0,2886.8,0,0,81147,0,0,0,0,13958.46,1440,112453.28,11800,0,0,0,5 00,2399.96,0,0,2953,0,2000,0,0,0,6288.88,1375.95,13093,38726.88,0,122.8,0,2455.27,0,233549.36,0,0,0,0,0,0,0,0,4906.52,0,0,0,26160,0,309.22,0,0,0,0,0,21500,7257.68,0,0,0,18069,0,23625,0,28673.9,0,0,20,0,0,5031.4,1096.59,0,0,836.39,8818,0,0,0,0,0,227.65,48775.83,0,0,124.8,3870.2,0,2596.91,203.44,0,0,0,0,0,352643.58,0,792.92,5000,0,417.93,0,0,0,1900,0,0,309.41,0,0,0,214.71,0,405.84,0,0,0,0,0,324.63,133.96,0,0,806.64,500,245258.43,210,0,0,0,0,0,2638.06,0,0,0,0,34914,32571,0,0,0,0,0,42925.37,1979.87,1667,0,7546.64,0,0,
[R] How to write a loop?
Dear R helpers, Following is a R script I am using to run the Fast Fourier Transform. The csv files has 10 columns with titles m1, m2, m3 .m10. When I use the following commands, I am getting the required results. The probelm is if there are 100 columns, it is not wise to define 100 commands as fk - ONS$mk and so on. Thus, I need some guidance to write the loop for the STEP A and STEP B. Thanking in advance Regards Maithili My R Script --- ONS - read.csv(fast fourier transform.csv, header = TRUE) # STEP A f1 - ONS$m1 f2 - ONS$m2 f3 - ONS$m3 f4 - ONS$m4 f5 - ONS$m5 f6 - ONS$m6 f7 - ONS$m7 f8 - ONS$m8 f9 - ONS$m9 f10 - ONS$m10 # # STEP B g1 - fft(f1) g2 - fft(f2) g3 - fft(f3) g4 - fft(f4) g5 - fft(f5) g6 - fft(f6) g7 - fft(f7) g8 - fft(f8) g9 - fft(f9) g10 - fft(f10) # h - g1*g2*g3*g4*g5*g6*g7*g8*g9*g10 j - fft((h), inverse = TRUE)/length(h) # Cricket on your mind? Visit the ultimate cricket website. Enter http://beta.cricket.yahoo.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] (Interpretation) VGAM - FRECHET 3 parameters by maximum likelihood estimation for
Dear R Helpers This is the R code (which I have slightly changed) I got in VGAM package for estimating the parameters of FRECHET. _ y = rfrechet(n - 100, shape=exp(exp(0))) #(A) fit3 = vglm(y ~ 1, frechet3(ilocation=0), trace=TRUE, maxit=155) # (B) coef(fit3, matrix=TRUE) # (C) Coef(fit3)# (D) fitted(fit3)[1:5,]# (E) mean(y) # (F) weights(fit3, type=w)[1:5,] # (G) vcov(fit3)#(H) f...@extra$location[1:3] # Estimate of the location parameter #(I) f...@extra$lhsanchor # Anchor Point #(J) _ When I run these commands using R I get following output corresponding to each command line OUTPUT # (A) [1] 0.7495887 1.1578511 0.8872487 0.7781103 1.1026540 1.8557026 1.1527270 1.1538885 [9] 1.0436005 0.8702552 1.0326653 1.1456378 1.1292287 0.9779141 0.7882611 2.0040318 [17] 0.8832376 1.6684632 0.7112340 1.8440806 0.8103669 0.6171517 0.6632612 0.9288173 [25] 1.2625774 1.2371949 2.3995687 0.9674406 1.2205647 2.2997349 1.3561988 1.0257294 [33] 0.7693035 1.3112102 1.2841138 0.5207330 0.8861406 0.7819666 1.1376008 1.3396068 [41] 0.6828540 0.7358596 0.8678724 1.1191930 0.9581007 0.8645687 1.0269345 0..9853376 [49] 0.7861684 2.2938797 0.5994656 1.3733527 3.0904095 2.7179989 0.8408945 0.9995262 [57] 1.0456575 0.6139744 17.4274447 0.5928158 1.6172649 0.7354806 1.4714551 0.7851852 [65] 1.9091740 1.0862915 1.9082128 1.0051395 1.0991948 1.6698645 2.8901334 0.8174091 [73] 1.3964180 0.7452934 0.8133906 1.2417527 2.1583672 1.1822409 0.8068691 0.8410480 [81] 1.2394454 1.3391757 1.0867579 1.3395385 1.2791401 0.7897431 1.2112373 1.6531473 [89] 1.7432403 6.7756058 0.9385585 1.5561437 0.9590773 0.7936483 2.5215168 1.1984615 [97] 0.6345925 1.4218795 2.3178357 1.5454827 OUTPUT # (B) In vglm.fitter(x = x, y = y, w = w, offset = offset, Xm2 = Xm2, : convergence not obtained in 155 iterations. OUTPUT # (C) coef(fit3, matrix=TRUE) log(difference) log(scale) loglog(shape) (Intercept) -0.7954072 -0.1283776 -0.03175329 OUTPUT # (D) Coef(fit3)) difference scale shape 0.4513974 0.8795212 2.6346374 (IS IT THAT THESE GIVE THE SCALE AND SHAPE PARAMETER ESTIMATES OF FRECHET.?) OUTPUT # (E) fitted(fit3)[1:5,] [1] 1.339454 1.339454 1.33954 1.339454 1.339454 (WHAT DOES THIS MEAN?) OUTPUT # (F) mean(y) [1] 1.439024 OUTPUT # (G) weights(fit3, type=w)[1:5,] [,1][,2] [,3][,4] [,5][,6] [1,] 24.264915 46.6054738.864660 -33.624853 40.492033 -29.075460 [2,] 7.599936 14.186081.554636-9.724618 2.440009 -2.670739 [3,] 6.486803 26.534371.855081-12.926846 -5.700736 2.433455 [4,] 16.768849 37.3685636.299447 -25.025068 34.078418 -22.643518 [5,] 9.562077 15.870832.671884-11.625172 4.418292 -4.454716 (WHAT DOES THIS MEAN?) OUTPUT # (H) vcov(fit3) (Intercept)1 (Intercept)2(Intercept):3 (Intercept) : 1 0.0022605491 0.0021317673-1.576056e-04 (Intercept) : 2 0.0021317673 0.0020926942-1.780387e-04 (Intercept) : 3 -0.0001576056 -0.0001780387 3.892675e-05 Warning message: In summaryvlm(object, corr = FALSE, dispersion = dispersion) : the estimated variance-covariance matrix is usually inaccurate as the working weight matrices are a crude BFGS quasi-Newton approximation OUTPUT # (I) f...@extra$location[1:3] # Estimate of the location parameter 1 2 3 0.06930899 0.06930899 0.06930899 (What does this MEAN? IS IT THAT 'D' gives SCALE and SHAPE parameter whereas this gives me LOCATION parameter?) OUTPUT # (J) f...@extra$lhsanchor # Anchor point [1] 0.520733 (What does this mean?) My problem is to calculate the estimators of 3 Parameter FRECHET distribution. Which of the above figures give me estimates of the three parameters of the FRECHET distribution. With regards and thanking in advance, Maithili Connect with friends all over the world. Get Yahoo!
[R] Generalized Extreme Value Distribution (LMOM package) and Frechet Distribution
Dear R helpers I have some data and through some other software, it is understood that I can fit the Frechet Distribution to it. However, I need to fit the distribution using R code only. I have searched many R packages and one R helper has suggested some sites too, but unfortunately parameters couldn't be estimated. Using LMOM package, I know how to estimate the parameters of Generalized extreme value distribution with mu as the location parameter, σ the scale parameter and k as the shape parameter. The sub-families defined by k = 0, k 0 and k 0 correspond, respectively, to the Gumbel, Fréchet and Weibull families. So is it possible to use this property to estimate the parameters of the Frechet distribution. My data is as given below - amounts - c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,101.57,102.21,105,105.95,107.07,107.3,110,111.2,112.12,112.53,114.17,115.7,116.02,116.41,116.83,117.06,117.9,118.11,120,121.44,122.8,124.8,125.34,129.92,130..89,131.66,132.84,133.29,133.96,137.3,142.01,151.03,152.48,154.51,156.66,156.97,158.57,161.51,167.69,169.36,170.14,170.72,174.18,175.69,176.12,180,180..02,183.6,193.98,200,200,200,200,200,200,200,200,201.18,203,203.44,207.55,208.32,211.28,214.71,225.65,225.83,226.21,227.65,230,235.28,240.85,247.63,249.13,250,250,255,257.09,260.61,262.63,267.16,270.11,271.16,274.06,280.25,300,300,300,300,300,300,300,300,309.22,309.41,310,314.91,319,320,320.79,324.63,356.87,357,368,373.18,380.15,387.61,392.88,400,400,400,400,400,400,400.18,401.41,401.46,403.28,405.84,412.14,417.93,442,450,454.89,456.97,46 0.52,468.29,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,501.45,523.9, 525,531.32,540,540,550,560.61,561.36,571.62,600,600,600,600,600,600,600,600,600.15,605.14,610,612.28,621.47,625.03,630.93,639.87,640,650,667.35,668.69,699.68,700,700,700,700,715.11,716.53,717.33,725.04,728.08,730,736.46,743.24,746.73,752.4,752.45,766.37,787.95,788.84,792.92,794.1,797.7,800,800,800.56,800.78,806.64,824.22,828.12,829.76,831.75,834,836.39,837.08,839.56,844.32,886.28,897,900,900,900,900,900,908.81,913.03,924.08,929.78,950,951.67,958.16,982,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1001.19,1001.9,1009.74,1017,1020,1041.99,1044,1046.9,1050,1093.15,1095.61,1096.59,1100,1100,1100,1105.31,1125.01,1126.85,1129.23,1130,1130.1,1138.89,1144.52,1145.22,1150,1152.92,1164.55,1200,1200,1200,1221.41,1226,1230,1235.74,1244,1246.83,1250,1267,1267,1270.98,1300,1307.78,1310,1314.1,1316.44,1322,1332,1334.25,1347.26,1350,1350,1365,1375.95,1382.5,1390.74,1400,1400,1400,1400,1428,1440,1450,1456.3,1465.03,1480,
[R] Estimating Parameters of Weibull and Pareto distribution using LMOM package
Dear R helpers I have r file which estimate the parameters of 3 parameter Weibull - (A) - continuous shape parameter (alpha) - continuous scale parameter (beta) - continuous location parameter (gamma) (B) Also, I have a r file which calculates the parameters of Generalized Pareto distribution. - location parameter xi, - scale parameter alpha and - shape parameter k However, If I have to use the same files for estimating parameters of 2 parameter Weibull and 2 parameter Pareto distribution, how do I use it? I am giving the R script I am using to calculate the Generalized Pareto distribution as library(lmom) amounts - (10023.47, 10171.42,13446.83,10263.49,10219.07, 10025.71, 10318.88, 10034.85,10004.98,10012.72) lmom- samlmu(amounts); lmom parameters_of_Gen_Pareto - pelgpa(lmom); parameters_of_Gen_Pareto The parameters estimated are xialphak 9993.3131812 81.9540457 -0.8213843 If the location paramter xi = 0, then this becomes two parameter Paretom distribution. However, it is my gut feeling that if xi = 0, other parameter values will also change. Please help me out. Regards and thanking in advance Maithili __ 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] Three Parameter FRECHET Distribution
Dear R Helpers Which package is available for estimatine the parameters of three parameter FRECHET distribution. Also, how to generate the random numbers for Frechet using these three estimated parameters. Thanking in advance Maithili __ 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] Three Parameter FRECHET Distribution
Dear Jorge, Thanks a lot for great help. That will solve my problem of generating random number generation etc. however, my main problem is HOW TO ESTIMATE THE PARAMETERS of FRECHET Distribution from a given sample data? That will be a great help for me. Thanks a lot again Regards Maithili --- On Wed, 3/18/09, Jorge Ivan Velez jorgeivanve...@gmail.com wrote: From: Jorge Ivan Velez jorgeivanve...@gmail.com Subject: Re: [R] Three Parameter FRECHET Distribution To: maithili_sh...@yahoo.com Cc: r-help@r-project.org Date: Wednesday, March 18, 2009, 3:17 PM Dear Maithili, Take a look at this: http://bm2.genes.nig.ac.jp/RGM2/R_current/library/evd/man/frechet.html HTH, Jorge On Wed, Mar 18, 2009 at 11:14 AM, Maithili Shiva maithili_sh...@yahoo.comwrote: Dear R Helpers Which package is available for estimatine the parameters of three parameter FRECHET distribution. Also, how to generate the random numbers for Frechet using these three estimated parameters. Thanking in advance Maithili __ 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] Estimating paramters of 3 Parameter Gamma Distribution
Dear R helpers How to estimate teh parameters of 3 Parameter Gamma Distribution. I tried LMOM package but it deals with two parameter GAMMA. Please guide Regards Maithili __ 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] Fw: Estimating Parameters of Weibull and Pareto distribution using LMOM package
Dear R helpers I have r file which estimate the parameters of 3 parameter Weibull - (A) - continuous shape parameter (alpha) - continuous scale parameter (beta) - continuous location parameter (gamma) (B) Also, I have a r file which calculates the parameters of Generalized Pareto distribution. - location parameter xi, - scale parameter alpha and - shape parameter k However, If I have to use the same files for estimating parameters of 2 parameter Weibull and 2 parameter Pareto distribution, how do I use it? I am giving the R script I am using to calculate the Generalized Pareto distribution as library(lmom) amounts - (10023.47, 10171.42,13446.83,10263.49,10219.07, 10025.71, 10318.88, 10034.85,10004.98,10012.72) lmom - samlmu(amounts); lmom parameters_of_Gen_Pareto - pelgpa(lmom); parameters_of_Gen_Pareto The parameters estimated are xialphak 9993.3131812 81.9540457 -0.8213843 If the location paramter xi = 0, then this becomes two parameter Paretom distribution. However, it is my gut feeling that if xi = 0, other parameter values will also change. Please help me. Regards and thanking in advance Maithili __ 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] Fw: Fitting GUMBEL Distribution - CDF function and P P Plot
Dera R Helpers, I am re-posting my query. Please guide me. Maithili --- On Fri, 3/13/09, Maithili Shiva maithili_sh...@yahoo.com wrote: I am trying to fit the Gumbel distribution to a data. I am using lmom package. I am getting problem in Cumulative Distribution Function of Gumbel distribution as I am getting it as a series of 0's and 1's thereby affecting the P P Plot. My R code is as follows. library(quantreg) library(RODBC) library(MASS) library(actuar) library(lmom) x - c(986.78,1067.76,1046.47,1034.71,1004.53,1007.89,964.94,1060.24,1188.07,1085.63,988.33,972.71,1177.71,972.48,1203.20,1047.27,1062.95,1113.65,995.97,1093.98) #Estimating the parameters for GUMBEL distribution N- length(x) lmom - samlmu(x); lmom parameters_of_GUMBEL - pelgum(lmom); parameters_of_GUMBEL # Parameters are xi = 1019.4003 alpha = 59.5327 # _ P - P Plot e- c(1:N) f- c((e-.5)/N) Fx - cdfgum(x, para = parameters_of_GUMBEL) g- sort(Fx) png(filename = GUMBEL_P-P.png) a - par('bg'= #CC) plot (f,g,bg=a,fg= #804000,main =P-P Plot, ylab= Cumulative Distribution Function, xlab=i, font.main=2, cex.main=1,col=#66,bty = o,col.main=black,col.axis=black,col.lab =black) abline(rq(g ~ f, tau = .5),col=red) dev.off() # Fx RETURNS0 1 1 1 0 0 0 1 1 1 0 0 1 0 1 1 1 1 0 1 and Thus plot is not proper Please guide me as where I am going wrong. With regards Maithili __ 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] Fitting GUMBEL Distribution - CDF function ISSUE
Dear R helpers I am trying to fit the Gumbel distribution to a data. I am using lmom package. I am getting problem in Cumulative Distribution Function of Gumbel distribution as I am getting it as a series of 0's and 1's thereby affecting the P P Plot. My R code is as follows. library(quantreg) library(RODBC) library(MASS) library(actuar) library(lmom) x - c(986.78,1067.76,1046.47,1034.71,1004.53,1007.89,964.94, 1060.24, 1188.07, 1085.63,988.33,972.71, 1177.71,972.48,1203.20, 1047.27,1062.95, 1113.65, 995.97, 1093.98) #Estimating the parameters for GUMBEL distribution N- length(x) lmom - samlmu(x); lmom parameters_of_GUMBEL - pelgum(lmom); parameters_of_GUMBEL # Parameters are xi = 1019.4003 alpha = 59.5327 # _ P - P Plot e- c(1:N) f- c((e-.5)/N) Fx - cdfgum(x, para = parameters_of_GUMBEL) g- sort(Fx) png(filename = GUMBEL_P-P.png) a - par('bg'= #CC) plot (f,g,bg=a,fg= #804000,main =P-P Plot, ylab= Cumulative Distribution Function, xlab=i, font.main=2, cex.main=1,col=#66,bty = o,col.main=black,col.axis=black,col.lab =black) abline(rq(g ~ f, tau = .5),col=red) dev.off() # Fx RETURNS0 1 1 1 0 0 0 1 1 1 0 0 1 0 1 1 1 1 0 1 and Thus plot is not proper Please guide me as where I am going wrong. With regards Maithili __ 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] Fast Fourier Transform w.r.t. CreditRisk+
Dear R Helpers, Is there any literaure available (including R code) on Fast Fourier Transform being used in CreditRisk+? I need to learn how to apply the Fast Fourier Transform. I agree I am too vaue in my question and sincerely apologize for the same, but I am not able to understand as to where do I start for this particular assignment. I tried to search google for CRAN and Fast Fourier Transform, but I got something for FFT image. Basically I need to understand what is Fast Fourier Transform is and its use in CreditRisk+? With regards and tahnking in advance Maithili __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Random number generation for Generalized Logistic distribution
Dear R helpers How to generate random numbers for (a) Generalized logistic distribution (b) Generalized normal distribution (c) Pearson Type III distribution (d) Kappa Thanks in advance Maithili __ 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] Generating Correlation matrix
Dear Ms Sarah, Thanks for your reply. Actually I am new to this R language and besides coping with the demending office commitments, whenever possible, I am trying to learn the R language on my own. Had it been Excel, I could have done in fraction of seconds however I need to use R language for this. Its the simple correlation I am looking for. I have a dataset of (say 500) observations EACH for these three variables viz. Equity, Forex and Bond. I have three different files (equity.csv, Forex.csv and Bond.csv) and need to generate the regular correlation among these variabls. I had attached these files in my earlier mail least knowing we can't do so. I did try to search help, but wasn't that confident about it so I am requesting for the guidance. With regards Maithili --- On Wed, 2/11/09, Sarah Goslee sarah.gos...@gmail.com wrote: From: Sarah Goslee sarah.gos...@gmail.com Subject: Re: [R] Generating Correlation matrix To: Maithili Shiva maithili_sh...@yahoo.com Cc: r-help@r-project.org Date: Wednesday, February 11, 2009, 11:37 AM Assuming you want ordinary correlations - Pearson or Spearman - and not some financial thing I've never heard of, searching the help for correlation would have gotten you to cor(), and probably also to other more elaborate constructions. If your problem is more complex than that, we need a better description of the difficulty, along with example code for as far as you can get yourself. Sarah On Wed, Feb 11, 2009 at 5:44 AM, Maithili Shiva maithili_sh...@yahoo.com wrote: Dear R helpers, I have generated a portfolio of Equity, Dollar Rate and say zero coupon bond. I have calculated the daily returns based on the prices available for last two years. Now, I have three seperate csv files (Equity.csv, Dollar.csv and Bond.csv) containing the respective returns. I need to calculate the correlation matrix between the retuns of these assets. Please guide me how this can be done in R. I have attached the three csv files. Thanking in advance With regards Maithili -- Sarah Goslee http://www.functionaldiversity.org __ 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] Matrix Multiplication
Hi R helpers, I have two matrices A and B of the order (4 * 5) and (5 * 3) respectively. How to multiply these two matrices to obtain resultant matrix of the order (4 * 3). Thanks in advance With regards Maithili __ 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] VaR-Monte carlo Simulation, Historic simulation, Variance-Covariance Simulation
Dear R helpers Suppose I have a portfolio of securities with exposure to Equity, Bonds and Forex (say $ 100 each). Is there any fucntion in R that will help me calculate Value at Risk (VaR) using Monte carlo Simulation , Historic simulation and Variance - Covariance Simulation. With regards Maithili __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Random Number Generation using (Generalized) Extreme Value distribution and Pareto distribution
Hi R helpers, Is there any function in R, which generates random numbers in case of (1) Generalized Extreme Value distribution and (2) Generalized PAreto distribution for the respective given set of parameters? Regards Maithili __ 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] Parameter Estimation - Generalized Extreme Value Distribution
Dear R helpers, How do you estimate the (Location, Scale, Shape) parameters of Generalized Extreme Value distribution using R? I have tried VGAM but just not able to write the R script. Please advise. With regards Maithili __ 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] Parameter estimation - Generalized Extreme value Distribution
Dear R help, I have an xls file with the name ONS.csv having 25 obseravations as given below. This is my data. (i.e. the first column of file ONS.csv) (5.55,4.56,17.82,5.03,5.3,40.28,8.05,27.8,5.85,5.42,14.75,46.13,18.5,4.58, 4.31,9.19,6.61,15.92,96.94,21.63,4.44,4.88,241.74,38592.1,5.24) I am trying to fit the Generalized Extreme Value distribution to this data. Following is my R - script Library (lsmev) ONS - read.csv(GEV.csv,header = TRUE) gev.fit(ONS[,1]) I get following output $conv [1] 0 $nllh [1] 99.28817 $mle [1] 5.940866 2.703154 1.425794 $se [1] 0.6827288 1.1263298 0.2590853 What is the meaning of mle (entries). Does it give me the parameter estimated for the location(5.940866), scale(2.703154) and shape(1.425794) parameter of the Generalized Extreme Value distribution. Please guide. Thanking you in advance __ 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] Stepwise regression
Hi, I have the response variable 'Y' and four predictors say X1, X2, X3 and X4. Assuming all the assmptions like Y follows normal distribution etc. hold and I want to run linear multiple regression. How do I run the stepwise regression (forward as well as the backward regression). From other software (i.e. minitab), I know only X1 and X2 are significant so my regression equation should be Y = constant + (b1) X1 + (b2) X2. I am not sure whether I am using the correct R commands, which are as follows - library (wle) ONS - mle.stepwise(Y ~ X1+X2+X3+X4, data=ONS) summary(ONS) The output looks something like this OUTPUT Forward selection procedure F.in: 4 Last 3 iterations: (Intercept) X1 X2 X3 X4 [1,] 1 0 0 0 1 15.57 [2,] 1 1 0 0 1 14.80 [3,] 1 1 1 0 1 61.56 I am not able to interpret this outcome as well. Please guide. With regards Maithili __ 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] Likelihood ratio test using R
Hi! I am working on the Logistic Regression using R. My R script is as follows ONS - read.csv(ONS.csv,header = TRUE) ONS.glm - glm(Y ~ Age1+Age2+Sex+Education+Profession+TimeInJob+ TimeInCurrentJob+OwnResidence+Dependents+ApplIncome+FamilyInco+IIR+FOIR+YearsAtBank+SavingsAccount+CurrentAccount, family = binomial(link = logit), data=ONS) summary(ONS.glm) OUTPUT (RESULT) is as follows - Deviance Residuals: Min 1Q Median 3Q Max -1.7888 -0.6910 -0.3220 -0.2179 3.1608 Coefficients: Estimate Std. Error z value Pr(|z|) (Intercept) -1.454e+00 1.380e-01 -10.532 2e-16 *** Age1 2.313e-01 9.902e-02 2.336 0.0195 * Age2 -6.648e-01 5.209e-02 -12.761 2e-16 *** Sex -7.012e-01 7.325e-02 -9.572 2e-16 *** Education-5.271e-01 7.963e-02 -6.619 3.61e-11 *** Profession -3.512e-01 4.908e-02 -7.155 8.38e-13 *** TimeInJob-3.107e-01 1.980e-01 -1.569 0.1166 TimeInCurrentJob 2.752e+00 1.895e-01 14.521 2e-16 *** OwnResidence 1.608e+00 1.858e-01 8.654 2e-16 *** Dependents -4.066e-01 1.867e-01 -2.178 0.0294 * ApplIncome -6.401e-02 4.319e-03 -14.820 2e-16 *** FamilyInco7.148e-02 7.389e-03 9.674 2e-16 *** IIR 5.765e-02 1.353e-02 4.262 2.03e-05 *** FOIR 7.383e-07 1.056e-07 6.990 2.74e-12 *** YearsAtBank -1.926e-07 3.519e-08 -5.473 4.42e-08 *** SavingsAccount -2.083e-07 1.785e-07 -1.167 0.2432 CurrentAccount -1.550e+00 1.107e-01 -14.008 2e-16 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: 39300 on 42499 degrees of freedom Residual deviance: 32534 on 42483 degrees of freedom AIC: 32568 Question No - (1) What does this means? Deviance Residuals: Min 1Q Median 3Q Max -1.7888 -0.6910 -0.3220 -0.2179 3.1608 Question No - (2) What is the significance of these codes? Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Question No - (3) What does this means? Null deviance: 39300 on 42499 degrees of freedom Residual deviance: 32534 on 42483 degrees of freedom And this is the last question Question No - (4) To test Ho : All regression coefficients are ZERO, I need to use Likelihood Ratio Test (G) and the related p value. When I use minitab, I get value of G and related p, but using R language, how do I get value of G and p value? _ I am sincerely sorry for raising these many questions? But I am sure there will be many like me who will also be immensely benefited by the replies, I may get pertaining to these questions. Thanking you all in advance, With warm regards Maithili Shiva __ 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] Likelihood ratio test using R
Hi! I am working on the Logistic Regression using R. My R script is as follows ONS - read.csv(ONS.csv,header = TRUE) ONS.glm - glm(Y ~ Age1+Age2+Sex+Education+Profession+TimeInJob+ TimeInCurrentJob+OwnResidence+Dependents+ApplIncome+FamilyInco+IIR+FOIR+YearsAtBank+SavingsAccount+CurrentAccount, family = binomial(link = logit), data=ONS) summary(ONS.glm) OUTPUT (RESULT) is as follows - Deviance Residuals: Min 1Q Median 3Q Max -1.7888 -0.6910 -0.3220 -0.2179 3.1608 Coefficients: Estimate Std. Error z value Pr(|z|) (Intercept) -1.454e+00 1.380e-01 -10.532 2e-16 *** Age1 2.313e-01 9.902e-02 2.336 0.0195 * Age2 -6.648e-01 5.209e-02 -12.761 2e-16 *** Sex -7.012e-01 7.325e-02 -9.572 2e-16 *** Education-5.271e-01 7.963e-02 -6.619 3.61e-11 *** Profession -3.512e-01 4.908e-02 -7.155 8.38e-13 *** TimeInJob-3.107e-01 1.980e-01 -1.569 0.1166 TimeInCurrentJob 2.752e+00 1.895e-01 14.521 2e-16 *** OwnResidence 1.608e+00 1.858e-01 8.654 2e-16 *** Dependents -4.066e-01 1.867e-01 -2.178 0.0294 * ApplIncome -6.401e-02 4.319e-03 -14.820 2e-16 *** FamilyInco7.148e-02 7.389e-03 9.674 2e-16 *** IIR 5.765e-02 1.353e-02 4.262 2.03e-05 *** FOIR 7.383e-07 1.056e-07 6.990 2.74e-12 *** YearsAtBank -1.926e-07 3.519e-08 -5.473 4.42e-08 *** SavingsAccount -2.083e-07 1.785e-07 -1.167 0.2432 CurrentAccount -1.550e+00 1.107e-01 -14.008 2e-16 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: 39300 on 42499 degrees of freedom Residual deviance: 32534 on 42483 degrees of freedom AIC: 32568 Question No - (1) What does this means? Deviance Residuals: Min 1Q Median 3Q Max -1.7888 -0.6910 -0.3220 -0.2179 3.1608 Question No - (2) What does this means? Null deviance: 39300 on 42499 degrees of freedom Residual deviance: 32534 on 42483 degrees of freedom And this is the last question Question No - (3) To test Ho : All regression coefficients are ZERO, I need to use Likelihood Ratio Test (G) and the related p value. When I use minitab, I get value of G and related p, but using R language, how do I get value of G and p value? _ I am sincerely sorry for raising these many questions? But I am sure there will be many like me who will also be immensely benefited by the replies, I may get pertaining to these questions. Thanking you all in advance, With warm regards Maithili Shiva __ 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] Fw: Logistic regresion - Interpreting (SENS) and (SPEC)
Dear Mr Peter Dalgaard and Mr Dieter Menne, I sincerely thank you for helping me out with my problem. The thing is taht I already have calculated SENS = Gg / (Gg + Bg) = 89.97% and SPEC = Bb / (Bb + Gb) = 74.38%. Now I have values of SENS and SPEC, which are absolute in nature. My question was how do I interpret these absolue values. How does these values help me to find out wheher my model is good. With regards Ms Maithili Shiva Subject: [R] Logistic regresion - Interpreting (SENS) and (SPEC) To: r-help@r-project.org Date: Friday, October 10, 2008, 5:54 AM Hi Hi I am working on credit scoring model using logistic regression. I havd main sample of 42500 clentes and based on their status as regards to defaulted / non - defaulted, I have genereted the probability of default. I have a hold out sample of 5000 clients. I have calculated (1) No of correctly classified goods Gg, (2) No of correcly classified Bads Bg and also (3) number of wrongly classified bads (Gb) and (4) number of wrongly classified goods (Bg). My prolem is how to interpret these results? What I have arrived at are the absolute figures. __ 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] Logistic Regression - Interpreting SENS (Sensitivity) and SPEC (Specificity)
Hi Hi I am working on credit scoring model using logistic regression. I havd main sample of 42500 clentes and based on their status as regards to defaulted / non - defaulted, I have genereted the probability of default. I have a hold out sample of 5000 clients. I have calculated (1) No of correctly classified goods Gg, (2) No of correcly classified Bads Bg and also (3) number of wrongly classified bads (Gb) and (4) number of wrongly classified goods (Bg). My prolem is how to interpret these results? What I have arrived at are the absolute figures. __ 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] Credit Scoring Model - SPEC (specificity) and SENS (sensitivity)
Dear R helpers, Hi I am working on credit scoring model using logistic regression. I have main sample of 42500 clentes and based on their status as regards to defaulted / non - defaulted, I have genereted the probability of default. I have a hold out sample of 5000 clients. I have calculated (1) No of correctly classified goods Gg, (2) No of correcly classified Bads Bg and also (3) number of wrongly classified bads (Gb) and (4) number of wrongly classified goods (Bg). My prolem is how to interpret these results? What I have arrived at are the absolute figures. Using these I hav ecalculated Specificity (SPEC) and sensitivity (SENS) as SPEC = Bb / (Bb + Gg) and SENS = Gg / (Gg + Bg) With regards Maithili __ 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] Logistic regresion - Interpreting (SENS) and (SPEC)
Hi Hi I am working on credit scoring model using logistic regression. I havd main sample of 42500 clentes and based on their status as regards to defaulted / non - defaulted, I have genereted the probability of default. I have a hold out sample of 5000 clients. I have calculated (1) No of correctly classified goods Gg, (2) No of correcly classified Bads Bg and also (3) number of wrongly classified bads (Gb) and (4) number of wrongly classified goods (Bg). My prolem is how to interpret these results? What I have arrived at are the absolute figures. __ 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] How to validate model?
Hi! I am working on scorecard model and I have arrived at the regression equation. I have used logistic regression using R. My question is how do I validate this model? I do have hold out sample of 5000 customers. Please guide me. Problem is I had never used Logistic regression earlier neither I am used to credit scoring models. Thanks in advance Maithili __ 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] (no subject)
Hi. This is my first mail. I am new to R and also to the company where I am employed now. I have Statistics background (i.e. Master of Science). However, it is only now I understand what I learned in text is simply a bookish knowledge and when it comes to actually applying statistics in real life, things are not simple. But I am sure I will accordingly upgrade myself. In my new company, I had been assigned a task of developing credit scoring model. Using logistic regression and using R Language, I have estimated the regression coefficients etc and arrived at the probability of default using the significant variables (or attributes). However, as a part of validating the model, I have been asked to find out if there is any bias in the sample data (I have used for logistic regression) and to use REJECT INFERENCE. For me this is really new and I am really helpless at this moment as also my confirmation will take place based on this model developed. I sincerely appreciate if someone guide me as to how do I proceed and use this concept of Reject inference. I did surf the net, but whatever information I could gather, was not sufficient. Also please suggest if there is any other measure in R, I can use to find out if my sample is bias free. I wish to bring to your kind notice that, I had constructed the sample (for customer data) using the various variables like Sex, Gross Income, no of dependents etc. and while construding this data, I had used the random numbers. I thank you in advance and sincerely apologise for this long mail. Please someone help me out. Maithili __ 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] Bias in sample - Logistic Regression
Hi. This is my first mail. I am new to R and also to the company where I am employed now. I have Statistics background (i.e. Master of Science). However, it is only now I understand what I learned in text is simply a bookish knowledge and when it comes to actually applying statistics in real life, things are not simple. But I am sure I will accordingly upgrade myself. In my new company, I had been assigned a task of developing credit scoring model. Using logistic regression and using R Language, I have estimated the regression coefficients etc and arrived at the probability of default using the significant variables (or attributes). However, as a part of validating the model, I have been asked to find out if there is any bias in the sample data (I have used for logistic regression) and to use REJECT INFERENCE. For me this is really new and I am really helpless at this moment as also my confirmation will take place based on this model developed. I sincerely appreciate if someone guide me as to how do I proceed and use this concept of Reject inference. I did surf the net, but whatever information I could gather, was not sufficient. Also please suggest if there is any other measure in R, I can use to find out if my sample is bias free. I wish to bring to your kind notice that, I had constructed the sample (for customer data) using the various variables like Sex, Gross Income, no of dependents etc. and while construding this data, I had used the random numbers. I thank you in advance and sincerely apologise for this long mail. Please someone help me out. Maithili __ 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.