Re: [R] modeling logit(y/n) using lrm
Hamilton, Cody wrote: > After a little digging, it turns out that fit.mult.impute will allow > fitter = glm, so previous suggestions regarding modeling cbind(y,n) as > an outcome will work fine. Thanks! Also lrm can easily handle your setup using the weights argument. Frank > > > > Cody Hamilton, Ph.D > > Institute for Health Care Research and Improvement > > Baylor Health Care System > > (214) 265-3618 > > > > > > This e-mail, facsimile, or letter and any files or attachments transmitted > with it contains information that is confidential and privileged. This > information is intended only for the use of the individual(s) and entity(ies) > to whom it is addressed. If you are the intended recipient, further > disclosures are prohibited without proper authorization. If you are not the > intended recipient, any disclosure, copying, printing, or use of this > information is strictly prohibited and possibly a violation of federal or > state law and regulations. If you have received this information in error, > please notify Baylor Health Care System immediately at 1-866-402-1661 or via > e-mail at [EMAIL PROTECTED] Baylor Health Care System, its subsidiaries, and > affiliates hereby claim all applicable privileges related to this information. > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Getting forcasting equation from nnet results
I'm trying to build forecasting equation from weights of 2-2-1 neural net. Running the nnet function gives me a vecto of 9 weights, but I don't know how to build the equation form these values. Can anyone advice? Or at least tell me where the nnet output is described in details (the manual only gives a brief description). Thanks. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Projection pursuit regression method
Hi, list i was trying to do( Projection pursuit regression ) ppr function in Mass library . It is running very good ,no problem ,but when i refered the references Friedman et al 1981 ,,and SMART guide,, i was not able to find how parametes they r geeting using least square method , if any body know how in PPR method we are finding model parameters using least square method ,becoz it seems to a continous function .. thanks in advance anil ANIL KUMAR( METEOROLOGIST) LRF SECTION NATIONAL CLIMATE CENTER ADGM(RESEARCH) INDIA METEOROLOGICAL DEPARTMENT SHIVIJI NAGAR PUNE-411005 INDIA MOBILE +919422023277 [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] managing data
Dear mailing list, may some one be kind to help me solve following problem. I am trying to write a code that will combine two tables "x" and "y". The first columns of both tables are unique identification for the rows. The first column of table "X" is a sub set of the first column of "Y". I need to find the matching rows in both tables by looking on their unique identification at the first columns. Table is "X" is (19010 rw, 6 col) and "Y" is (19850 rw, 9 col). Therefore my out put need to be "Z" is (19010rw,15 col). A small example of my input and out put is here below. Thank you in advance! input Table"X"" A,1,2,2 B,2,1,1 C,1,2,2 E,2,2,1 F,2,1,1 H,1,2,2 J,2,1,1 K,2,1,1 Table"Y" A,GG,CG, B,CC,TC, C,CA,AA, D,AT,TT, E,AA,AA, F,CG,CG, G,CC,CC, H,GG,GT, I,GT,TT, J,AA,AT, K,AC,CC, output Table"Z"" A,1,2,2,A,GG,CG, B,2,1,1,B,CC,TC, C,1,2,2,C,CA,AA, E,2,2,1,E,AA,AA, F,2,1,1,F,CG,CG, H,1,2,2,H,GG,GT, J,2,1,1,J,AA,AT, K,2,1,1,K,AC,CC, Regards Hannes [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Having a go at Rpad
Context: FreeBSD 6.1on a pentium 4; apache 2 server up & running; mod_perl installed; java & php 4 working. Willing to use Rpad on an office intranet, I installed the Rpad package (R2HTML was still there) and carefully read the instructions to set up a server. Now, on the server I can start the http://localhost/Rpad homepage, I can click on and browse the three examples ("General Example", "Data Input Example" & "GUI example"), BUT whenever I click on the "calculate" button in those example pages the underlying perl programs are browsed, listed and nothing seems to happen. Please help to straigthen my Rpad installation up Ciao Vittorio P.S. By the way those perl progs seems to point to a /var/www/Rpad directory. That's why I installed the ../basehtml dir under that directory and symlinked it to unix usual web dir :/usr/local/www/Rpad __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] substr or split help needed
Dear R-friends I have several data files with about 1,900 lines (records) each. I´m using read.table command to read the files. The files looks like LID , TYPE , PLAND D:\Bijou-MC\Simula_P005_H100_R001.txt , Forest , NA D:\Bijou-MC\Simula_P005_H100_R001.txt , Forest , 10.2 D:\Bijou-MC\Simula_P010_H100_R001.txt , Forest ,9.2 --- My first problem is that some command (like hist(data$PLAND)) say that the data isn´t a numeric one. May be because the first PLAND value are NA? When I done read.table command I used something link: data<-read.table (file="xxx.dat", head=T, sep="\,", na.strings="NA"). Another problem is that I need parse the LID column. When I do "print (head(data$LID) I receive the following result (look that the slash was lost on the read): D:Bijou-MCSimula_P005_H100_R001.txt D:Bijou-MCSimula_P005_H100_R001.txt D:Bijou-MCSimula_P010_H100_R001.txt Its ok to me, but now I need create the P, H and R columns into the "data" table as a parse of LID column. When I try use the command "p<-substr(data$LID, 19,3)" I got an error message saying that the variable is not char one. Finally, I´d like drop the LID column and insert the P, H and R into the table. Thanks for your help! Kind regards, miltinho __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] managing data
On Sat, Jun 17, 2006 at 02:40:47PM +0100, yohannes alazar wrote: > Dear mailing list, may some one be kind to help me solve following problem. > > I am trying to write a code that will combine two tables "x" and "y". The > first columns of both tables are unique identification for the rows. The > first column of table "X" is a sub set of the first column of "Y". I need to > find the matching rows in both tables by looking on their unique > identification at the first columns. ?merge cu Philipp -- Dr. Philipp PagelTel. +49-8161-71 2131 Dept. of Genome Oriented Bioinformatics Fax. +49-8161-71 2186 Technical University of Munich Science Center Weihenstephan 85350 Freising, Germany and Institute for Bioinformatics / MIPS Tel. +49-89-3187 3675 GSF - National Research Center Fax. +49-89-3187 3585 for Environment and Health Ingolstädter Landstrasse 1 85764 Neuherberg, Germany http://mips.gsf.de/staff/pagel __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] managing data
Hi Change V1 for the name of the column to be matched on X and Y cbind(X,Y[match(X$V1,Y$V1),]) Neurorox >From: "yohannes alazar" <[EMAIL PROTECTED]> >To: r-help@stat.math.ethz.ch >Subject: [R] managing data >Date: Sat, 17 Jun 2006 14:40:47 +0100 > >Dear mailing list, may some one be kind to help me solve following problem. > >I am trying to write a code that will combine two tables "x" and "y". The >first columns of both tables are unique identification for the rows. The >first column of table "X" is a sub set of the first column of "Y". I need >to >find the matching rows in both tables by looking on their unique >identification at the first columns. Table is "X" is (19010 rw, 6 col) and >"Y" is (19850 rw, 9 col). Therefore my out put need to be "Z" is >(19010rw,15 >col). A small example of my input and out put is here below. > > >Thank you in advance! > > >input >Table"X"" > >A,1,2,2 >B,2,1,1 >C,1,2,2 >E,2,2,1 >F,2,1,1 >H,1,2,2 >J,2,1,1 >K,2,1,1 > >Table"Y" > >A,GG,CG, >B,CC,TC, >C,CA,AA, >D,AT,TT, >E,AA,AA, >F,CG,CG, >G,CC,CC, >H,GG,GT, >I,GT,TT, >J,AA,AT, >K,AC,CC, > >output >Table"Z"" > >A,1,2,2,A,GG,CG, >B,2,1,1,B,CC,TC, >C,1,2,2,C,CA,AA, >E,2,2,1,E,AA,AA, >F,2,1,1,F,CG,CG, >H,1,2,2,H,GG,GT, >J,2,1,1,J,AA,AT, >K,2,1,1,K,AC,CC, > > Regards Hannes > > [[alternative HTML version deleted]] > >__ >R-help@stat.math.ethz.ch mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide! >http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] lmer and mixed effects logistic regression
'lmer' RETURNS AN ERROR WHEN SAS NLMIXED RETURNS AN ANSWER Like you, I would expect lmer to return an answer when SAS NLMIXED does, and I'm concerned that it returns an error message instead. Your example is not self contained, and I've been unable to get the result you got. This could occur for several reasons. First, what do you get for "sessionInfo()"? I got the following: sessionInfo() Version 2.3.1 (2006-06-01) i386-pc-mingw32 attached base packages: [1] "methods" "stats" "graphics" "grDevices" "utils" "datasets" [7] "base" other attached packages: lme4lattice Matrix "0.995-2" "0.13-8" "0.995-10" If you are using different versions of lmer, lattice and / or Matrix, please update.packages and try again. If that does not fix the problem, could you please try to find a self-contained example that is as simple as possible and still generates the same error message? Then send that to this list. When I ran your example limited only to the observations you listed, I got a different result: Warning messages: 1: fitted probabilities numerically 0 or 1 occurred in: glm.fit(X, Y, weights = weights, offset = offset, family = family, 2: IRLS iterations for PQL did not converge We get this these "Warning messages" because all the values of "response" are constant within each level of "id". With data like this, the likelihood will be maximized by sending Std.Dev.(id) to Inf; when 'lmer' quit, Std.Dev.(id) was already at 58779, which computationally is moderately close to Inf for the current "lmer" algorithm. How many different patterns of "response" by "id" do you have? With all 0's, the random adjustment to "(Intercept)" for that "id", ignoring the Bayesian shrinkage, is "-Inf". With all 1's, this random adjustment would be "+Inf". With two observations for a subject, if they are different, this random adjustment would exactly cancel the estimate of the fixed-effect for "(Intercept"). Do you have only these three patterns, all 0's, all 1's, and half 0's, half 1's? If yes, that might explain why Std.Dev.(id) wants to go to Inf. I don't know exactly how many different patterns you need, but you should be able to have some levels of "id" with all 0's or all 1's as long as those did not dominate, as they do in this cut down example. If this is the problem, then SAS NLMIXED could be achieving false convergence and either not telling you about it or reporting it so quietly you have not reported it here. CREATING A REPRODUCIBLE EXAMPLE I'm not eager to experiment with a large complicated example. You could help us help you by trying to produce a simpler, self-contained example. For example, do you get the same answer when you delete 'age' from the model: lmer(response~(1|id),data=gdx,family=binomial) If yes, then you could easily just count the number of levels of "id" that have all 0's, all 1's, (0, 1) = (1, 0), etc. Then write one or two lines that would generate that special case and submit that to this listserve. Before you do, however, I encourage you to experiment to find small numbers of replicates that reproduce the error you get. Then submit that to this list. STARTING VALUES? The help page for "lmer" describes the following argument: start: a list of relative precision matrices for the random effects. This has the same form as the slot '"Omega"' in a fitted model. Only the upper triangle of these symmetric matrices should be stored. To understand this, it might help to experiment with one of the examples on this help page: > fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy) > [EMAIL PROTECTED] $Subject 2 x 2 Matrix of class "dpoMatrix" (Intercept) Days (Intercept) 1.0746247 -0.2942832 Days -0.2942832 18.7549595 Just taking a guess, I tried the following: fm1. <- lmer(Reaction ~ Days+(Days|Subject), sleepstudy, start=list(Subject=diag(1:2))) fm1.c <- lmer(Reaction ~ Days+(Days|Subject), sleepstudy, start=list(Subject=array(1, .1, .1, 2), dim=c(2,2))) Both of these returned the same answer. Starting values are only required for the random effects, because these models are all "plinear" in the sense described in the "nls" documentation. For "glmmPQL", I was able to get the "update" function to work. Thus, if you can get an answer with one model, you can use that as an input to "update". I would expect "update" to try to use the parameter estimates from one model fit as starting values for the modification, where it can find a way to do that. Hope this helps. Spencer Graves Rick Bilonick wrote: > I'm using FC4 and R 2.3.1 to fit a mixed effects logistic regression. > The response is 0/1 and both the response and
Re: [R] lmer binomial model overestimating data?
Martin Henry H. Stevens wrote: > Hi folks, > Warning: I don't know if the result I am getting makes sense, so this > may be a statistics question. > > The fitted values from my binomial lmer mixed model seem to > consistently overestimate the cell means, and I don't know why. I > assume I am doing something stupid. I copied your "Raw.Data" and "Fitted.Estimates" into two columns of a data.frame OE and then did a t test as follows: > with(OE, t.test(Raw.Data-Fitted.Estimates)) One Sample t-test data: Raw.Data - Fitted.Estimates t = -2.1662, df = 11, p-value = 0.05313 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.0991997752 0.0007897752 sample estimates: mean of x -0.049205 I also tried the same thing with a modification of an example in the "lmer" help file. In that case, lmer seemed to consistently UNDERestimate the cell means. However, the difference again was not statistically significant. I suggest you consider this a disguised Rorschach ink blot test and worry about other things. Hope this helps. Spencer Graves > > Below I include code, and a binary image of the data is available at > this link: > http://www.cas.muohio.edu/~stevenmh/tf.RdataBin > > This was done with `Matrix' version 0.995-10 and `lme4' version > 0.995-2. and R v. 2.3.1 on a Mac, OS 10.4.6. > > The binomial model below ("mod") was reduced from a more complex one > by first using AIC, BIC and LRT for "random" effects, and then > relying on Helmert contrasts and AIC, BIC, and LRT to simplify fixed > effects. Maybe this was wrong? > > > load("tf.RdataBin") > > library(lme4) > > > options(contrasts=c("contr.helmert", "contr.poly")) > > mod <- lmer(tfb ~ reg+nutrient+amd +reg:nutrient+ > + (1|rack) + (1|popu) + (1|gen), data=dat.tb2, family=binomial, > method="Laplace") > > summary(mod) > Generalized linear mixed model fit using Laplace > Formula: tfb ~ reg + nutrient + amd + reg:nutrient + (1 | rack) + (1 > | popu) + (1 | gen) > Data: dat.tb2 > Family: binomial(logit link) > AICBIC logLik deviance > 402.53 446.64 -191.26 382.53 > Random effects: > Groups NameVariance Std.Dev. > gen(Intercept) 0.3850.621 > popu (Intercept) 0.5480.741 > rack (Intercept) 0.4010.633 > number of obs: 609, groups: gen, 24; popu, 9; rack, 2 > > Estimated scale (compare to 1) 0.80656 > > Fixed effects: > Estimate Std. Error z value Pr(>|z|) > (Intercept) 2.391 0.5744.17 3.1e-05 > reg1 0.842 0.4521.86 0.06252 > reg2 0.800 0.2413.32 0.00091 > nutrient1 0.788 0.1974.00 6.3e-05 > amd1 -0.540 0.139 -3.88 0.00010 > reg1:nutrient10.500 0.2272.21 0.02734 > reg2:nutrient1 -0.176 0.146 -1.21 0.22794 > > Correlation of Fixed Effects: > (Intr) reg1 reg2 ntrnt1 amd1 rg1:n1 > reg1 0.169 > reg2-0.066 -0.191 > nutrient10.178 0.231 -0.034 > amd1-0.074 -0.044 -0.052 -0.078 > reg1:ntrnt1 0.157 0.307 -0.180 0.562 -0.002 > reg2:ntrnt1 -0.028 -0.154 0.236 0.141 0.033 -0.378 > > X <- mod @ X > > fitted <- X %*% fixef(mod) > > > > unlogitH <- function(x) {( 1 + exp(-x) )^-1} > > (result <- data.frame(Raw.Data=with(dat.tb2, > + tapply(tfb, list(reg:nutrient:amd), > + mean ) ), > + Fitted.Estimates=with(dat.tb2, > + tapply(fitted, list(reg:nutrient:amd), > + function(x) unlogitH(mean(x)) ) ) )) > Raw.Data Fitted.Estimates > SW:1:unclipped 0.50877 0.69520 > SW:1:clipped0.41304 0.43669 > SW:8:unclipped 0.67273 0.85231 > SW:8:clipped0.52830 0.66233 > NL:1:unclipped 0.9 0.81887 > NL:1:clipped0.53571 0.60578 > NL:8:unclipped 0.96552 0.98830 > NL:8:clipped0.96154 0.96635 > SP:1:unclipped 0.98649 0.98361 > SP:1:clipped0.92537 0.95328 > SP:8:unclipped 1.0 0.99308 > SP:8:clipped0.95890 0.97992 > > ### Perhaps the cell SP:8:clipped = 1.0 is messing up the fit? > > pdf("RawAndFitted.pdf") > > par(mar=c(8,3,2,2), las=2) > > barplot(t(result), beside=TRUE ) > > box(); title("Fractions of Plants Producing Fruits") > > legend("topleft", c("Raw Data", "Fitted Values"), > +fill=gray.colors(2), bty="n" ) > > dev.off() > quartz > 2 > > > > _ > platform powerpc-apple-darwin8.6.0 > arch powerpc > os darwin8.6.0 > system powerpc, darwin8.6.0 > status > major 2 > minor 3.1 > year 2006 > month 06 > day01 > svn rev38247 > language R > version.string Version 2.3.1 (2006-06-01) > > > > Dr. M. Han
Re: [R] substr or split help needed
I used your sample of data. When reading in I used 'as.is=TRUE' to prevent the conversion to 'factor'. I then did an explicit conversion to number on the PLAND column. You should use 'str' to look at the structure of your data frame. You have backsplashes and your 'print' will not show them. You do see them in the 'str' call. Because of the backslash, you have to escape they twice (4 of them in the strsplit command). The result is a character matrix that you can then extract the data from. > x <- read.csv('clipboard', as.is=TRUE) > x LID TYPE PLAND 1 D:\\Bijou-MC\\Simula_P005_H100_R001.txt Forest NA 2 D:\\Bijou-MC\\Simula_P005_H100_R001.txt Forest 10.2 3 D:\\Bijou-MC\\Simula_P010_H100_R001.txt Forest 9.2 > str(x) `data.frame': 3 obs. of 3 variables: $ LID : chr " D:\\Bijou-MC\\Simula_P005_H100_R001.txt " " D:\\Bijou-MC\\Simula_P005_H100_R001.txt " " D:\\Bijou-MC\\Simula_P010_H100_R001.txt " $ TYPE : chr " Forest " " Forest " " Forest " $ PLAND: chr " NA" " 10.2" "9.2" > x$PLAND <- as.numeric(x$PLAND) Warning message: NAs introduced by coercion > str(x) `data.frame': 3 obs. of 3 variables: $ LID : chr " D:\\Bijou-MC\\Simula_P005_H100_R001.txt " " D:\\Bijou-MC\\Simula_P005_H100_R001.txt " " D:\\Bijou-MC\\Simula_P010_H100_R001.txt " $ TYPE : chr " Forest " " Forest " " Forest " $ PLAND: num NA 10.2 9.2 > strsplit(x$LID, "") [[1]] [1] " D:""Bijou-MC" [3] "Simula_P005_H100_R001.txt " [[2]] [1] " D:""Bijou-MC" [3] "Simula_P005_H100_R001.txt " [[3]] [1] " D:""Bijou-MC" [3] "Simula_P010_H100_R001.txt " > do.call('rbind', strsplit(x$LID, "")) [,1] [,2] [,3] [1,] " D:" "Bijou-MC" "Simula_P005_H100_R001.txt " [2,] " D:" "Bijou-MC" "Simula_P005_H100_R001.txt " [3,] " D:" "Bijou-MC" "Simula_P010_H100_R001.txt " > On 6/17/06, Milton Cezar <[EMAIL PROTECTED]> wrote: > > Dear R-friends > > I have several data files with about 1,900 lines (records) each. I´m using > read.table command to read the files. The files looks like > LID , TYPE > ,PLAND > D:\Bijou-MC\Simula_P005_H100_R001.txt , Forest , NA > D:\Bijou-MC\Simula_P005_H100_R001.txt , Forest , 10.2 > D:\Bijou-MC\Simula_P010_H100_R001.txt , Forest ,9.2 > --- > > My first problem is that some command (like hist(data$PLAND)) say that the > data isn´t a numeric one. May be because the first PLAND value are NA? When > I done read.table command I used something link: > data<-read.table (file="xxx.dat", head=T, sep="\,", na.strings="NA"). > > Another problem is that I need parse the LID column. When I do "print > (head(data$LID) I receive the following result (look that the slash was lost > on the read): > D:Bijou-MCSimula_P005_H100_R001.txt > D:Bijou-MCSimula_P005_H100_R001.txt > D:Bijou-MCSimula_P010_H100_R001.txt > Its ok to me, but now I need create the P, H and R columns into the "data" > table as a parse of LID column. When I try use the command > "p<-substr(data$LID, 19,3)" I got an error message saying that the variable > is not char one. > > Finally, I´d like drop the LID column and insert the P, H and R into the > table. > > Thanks for your help! > > Kind regards, miltinho > > > > > > > __ > > >[[alternative HTML version deleted]] > > > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > > -- Jim Holtman Cincinnati, OH +1 513 646 9390 (Cell) +1 513 247 0281 (Home) What is the problem you are trying to solve? [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Panel Bar plots
Hello All, I have been trying to use the par(mfrow(c(m,n)) function to produce a panel of m rows and n columns of bar plots. The different columns were to designate n different categories, as the m rows are to designate different categories as well. However, I cannot seem to get rid of the y-axes(vertical axes) in the n>1 columns. I wrote a loop to attempt to do this, but ended up stopping after the m=1 row because I could not get rid of the y-axes on the second graph using the following code. Does anyone know if there is a way to make the axes disappear in the panel for columns after the first column from the left? Thanks, David x<-read.csv('Outcomes.csv', skip=1) city.list<-cbind("Baghdad") sniper.window<-2 R.list<-c(.30) D.list<-c(7,14) library(lattice) degrade.list<-c(0) par(mfrow=c(1,length(D.list)),beside=T) for(i in 1:length(city.list)){ for(j in 1:length(degrade.list)){ myplot<-x[x$Location==city.list[i]&x$Degrade==degrade.list[j],] for(q in 1:length(D.list)){ myplot2<-myplot[myplot$Days==D.list[q],] if(q==1)barplot(myplot2$Ratio,names.arg=myplot2$Radius,horiz=T,main=D.li st[q], beside=T, space=0) if(q>1)barplot(myplot2$Ratio,names.arg=myplot2$Radius,horiz=T,main=D.lis t[q],axes=T) } } } This email message is for the sole use of the intended recip...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] substr or split help needed
Try this: # read in lines and replace all occurences of Simula, all occurrences # of .txt, all commas and all underscores with spaces Lines <- gsub(".*Simula|.txt|[,_]", " ", readLines("/myfile.dat")) # reread what is left skipping over column headings and setting it ourself # If you want factors instead of character data omit as.is=TRUE. dat <- read.table(textConnection(Lines), as.is = TRUE, skip = 1, col.names = c("P", "H", "R", "TYPE", "PLAND")) On 6/17/06, Milton Cezar <[EMAIL PROTECTED]> wrote: > Dear R-friends > > I have several data files with about 1,900 lines (records) each. I´m using > read.table command to read the files. The files looks like > LID , TYPE , > PLAND > D:\Bijou-MC\Simula_P005_H100_R001.txt , Forest , NA > D:\Bijou-MC\Simula_P005_H100_R001.txt , Forest , 10.2 > D:\Bijou-MC\Simula_P010_H100_R001.txt , Forest ,9.2 > --- > > My first problem is that some command (like hist(data$PLAND)) say that the > data isn´t a numeric one. May be because the first PLAND value are NA? When I > done read.table command I used something link: > data<-read.table (file="xxx.dat", head=T, sep="\,", na.strings="NA"). > > Another problem is that I need parse the LID column. When I do "print > (head(data$LID) I receive the following result (look that the slash was lost > on the read): > D:Bijou-MCSimula_P005_H100_R001.txt > D:Bijou-MCSimula_P005_H100_R001.txt > D:Bijou-MCSimula_P010_H100_R001.txt > Its ok to me, but now I need create the P, H and R columns into the "data" > table as a parse of LID column. When I try use the command > "p<-substr(data$LID, 19,3)" I got an error message saying that the variable > is not char one. > > Finally, I´d like drop the LID column and insert the P, H and R into the > table. > > Thanks for your help! > > Kind regards, miltinho > > > > > > > __ > > >[[alternative HTML version deleted]] > > > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > > __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Having a go at Rpad
That means that Apache doesn't know to execute the perl files. Something's wrong with your Apache configuration or directory permissions. Some things to check: * Make sure the *.pl files in ../Rpad/server/ are set to enable execution. * Check your apache http.conf. You need something like the following to tell perl that those *.pl files are executable (with the directory renamed as appropriate): # requires mod_perl SetHandler perl-script PerlHandler Apache::Registry Options +ExecCGI PerlSendHeader ON Options +ExecCGI AddHandler cgi-script .pl ExpiresActive on ExpiresDefault "now plus 0 seconds" * Check your apache error logs; they might give you some insight. If none of those fixes it, contact me offline with more details. - Tom vittorio wrote: > > Context: FreeBSD 6.1on a pentium 4; apache 2 server up & running; mod_perl > installed; java & php 4 working. > > Willing to use Rpad on an office intranet, I installed the Rpad package > (R2HTML was still there) and carefully read the instructions to set up a > server. > > Now, on the server I can start the http://localhost/Rpad homepage, I can > click on and browse the three examples ("General Example", "Data Input > Example" & "GUI example"), BUT > whenever I click on the "calculate" button in those example pages the > underlying perl programs are browsed, listed and nothing seems to happen. > > Please help to straigthen my Rpad installation up > > Ciao > Vittorio > > P.S. By the way those perl progs seems to point to a /var/www/Rpad > directory. > That's why I installed the ../basehtml dir under that directory and > symlinked > it to unix usual web dir :/usr/local/www/Rpad > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > > -- View this message in context: http://www.nabble.com/Having-a-go-at-Rpad-t1803552.html#a4917783 Sent from the R help forum at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] problem with legend on other graphics devices
On Fri, 2006-06-16 at 19:42 +0100, Gavin Simpson wrote: > Hi, > > I have a bit of a problem with a legend in png, eps and pdf plots > produced from a custom plotting function. I was writing a little > function to produce some stock plots for a routine analysis conducted in > our lab. I have a wrapper function figures() (see below) that produces > eps, png and pdf versions of the lab output. When I draw the plot on the > X11() device the correct amount of space is made available for the > legend, but when I draw the plot directly on the png, postscript or pdf > devices, the legend is placed too close to the edge of the plot and is > clipped. Hi, To follow up, the posted code does work and the legend is not clipped on my home machine but that was a slightly less-up-to-date version of R 2.3.1 patched than the machine at work. So I compiled the latest R2.3.1 patched (svn revision 38350) and it works fine there also. So must have been something peculiar to my set-up at work or R session at the time. For the record: > version _ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status Patched major 2 minor 3.1 year 2006 month 06 day16 svn rev38350 language R version.string Version 2.3.1 Patched (2006-06-16 r38350) G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% *Note new Address and Fax and Telephone numbers from 10th April 2006* %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC [f] +44 (0)20 7679 0565 UCL Department of Geography Pearson Building [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street London, UK[w] http://www.ucl.ac.uk/~ucfagls/cv/ WC1E 6BT [w] http://www.ucl.ac.uk/~ucfagls/ %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Question concerning mle
It's difficult to say much at this level of generality, but I have four suggestions: 1. Have you tried creating a reasonable grid of starting values using "expand.grid" and then plotting the resulting likelihood surface? If you have more than 2 parameters, you may want to use 'lattice' graphics. This should tell you if the functions seems unimodal, convex, etc., in the region you covered and at the resolution of your grid. 2. Have you tried method="SANN" = simulated annealing? I might try one pass with SANN, then refine the solution found by SANN using BFGS. 3. After you have a solution, you can then try profile likelihod. Unfortunately, my experience with profile.mle has been mixed. I actually made local copies of mle and profile.mle and found and fixed some of the deficiencies of each. I didn't test them enough to offer the results to the R Core Team, however. 4. Have you looked at Venables and Ripley (2002) Modern Applied Statistics with S, 4th ed. (Springer)? It's a great book for many things, including the use of expand.grid and 'optim'. hope this helps. Spencer Graves Rainer M Krug wrote: > Hi > > I hope this is the right forum - if not, point me please to a better one. > > I am using R 2.3.0 on Linux, SuSE 10. > > > I have a question concerning mle (method="BFGS"). > > I have a few models which I am fitting to existing data points. I > realised, that the likelihood is quite sensitive to the start values for > one parameter. > > I am wondering: what is the best approach to identify the right initial > values? Do I have to do it recursively, and if yes, how can I automate > it? Or do I have to play with the system? > > I am quite confident that the resulting parameters are the optimal for > my problem - but can I verify it? > > Thanks, > > Rainer > > __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] SSPIR problem
Did you try the 'examples' in the SS help file? If no, please copy them from the help file into a script file and work through them line by line, trying different modifications. If you've tried this, have you similarly worked through the 'sspir' 'demo' files? (These can be found in the '~\library\sspir\demo' subdirectory of the directory where R is installed.) If you've tried these and would like further help from this listserve, please submit another post, preferably after reading read the posting guide! "www.R-project.org/posting-guide.html". In particular, please include in your post a self-contained example that is as simple as you can make it that will still illustrate our problem. I've never used 'sspir', but the examples in the 'SS' help look fairly straightforward to me. For example, it says that Fmat returns a matrix of dim(p, d). From this I infer that the "k" in your model is t(Fmat(...)). Similarly, your "h" is "Gmat", and "Vmat" and "Wmat" match your "V" and "W". hope this helps. Spencer Graves [EMAIL PROTECTED] wrote: > Dear R-Users, > I'm using SSPIR package for a spatio-temporal application. > Is it possible to modify the structure of the involved matrixes (Fmat, > Gmat, Vmat,Wmat)? > I want to create a model like this > > #y(t)=k*theta(t)+epsilon(t) > #theta(t)=h*theta(t-1)+eta(t) > #epsilon(t) N(0,V) V=sigma2*I > #eta(t) N(0,W)W=sigma2_eta > > where the state variable theta has dimension 1(p=1) and at each time time > the observed variable y has dimension equal to d=3. Moreover I want to use > white noise errors. > But with the command > SS(y) where y is my nXd data matrix (d=observations at each time, > n=numbers of time points) > I obtain a different model. > > Can you help me please? > Thanks in advance > Michela > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html