Re: [R] Cholesky decomposition error

2012-06-19 Thread peter dalgaard
On Jun 20, 2012, at 06:17 , wrote: > Dear Peter, > > Thanks for your reply, as per my last post; my current problem is not on > positive definite related but to compare the objective function narrated by > Kjetil for optimization of parameters Vs Objective function that I have > posted in m

Re: [R] QQplot normally distributed

2012-06-19 Thread Liviu Andronic
Dear Özgür On Wed, Jun 20, 2012 at 7:37 AM, Özgür Asar wrote: > Why do you prefer robust methods in the example of Noor and why you need > exact normality here? > The idea is that when you do hypothesis testing to check whether a given distribution is normal, the results are rarely informative:

Re: [R] Need help in using "OPTIM / OPTIMIZATION" function

2012-06-19 Thread Özgür Asar
rehena wrote > > Hi Ozgur, > > Many thanks for your help. > > May be I am not very strong enough in the OPTIMIZATION field. Can I check > with you whether second derivative of the function at global max will be > less than 0 and will be greater than 0 at local max? > > Thanks in advance. >

Re: [R] Need help in using "OPTIM / OPTIMIZATION" function

2012-06-19 Thread Özgür Asar
Dear rehena, You can use optim() with method="Brent", or optimize() directly, for your case. But for you case, a popular approach is Newton-Raphson root finding algorithm. You can use newton function under my package OOmisc. You can check whether the global maximum or local maximum is found by r

Re: [R] QQplot normally distributed

2012-06-19 Thread Özgür Asar
>Hi, >So in my example, I can say that the data comes from a moderate normal distribution because the points more at the >right lay straight to a straight line, then the points at the left. Please a confirmation here. >But what is the information above (that the data is from a normal distribution)

Re: [R] QQplot normally distributed

2012-06-19 Thread Özgür Asar
Dear Liviu , Why do you prefer robust methods in the example of Noor and why you need exact normality here? Ozgur -- View this message in context: http://r.789695.n4.nabble.com/QQplot-normally-distributed-tp4633819p4633919.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] Cholesky decomposition error

2012-06-19 Thread nataraj
Dear Peter, Thanks for your reply, as per my last post; my current problem is not on positive definite related but to compare the objective function narrated by Kjetil for optimization of parameters Vs Objective function that I have posted in my last post. Though I appreciate the Kjetil approac

Re: [R] need help with unlist(), losing NULL values

2012-06-19 Thread David Winsemius
On Jun 19, 2012, at 6:57 AM, dinesh wrote: Hi, I have a very rudimentary kind of question on using unlist(). I am parsing a bunch of JSON text using rjson package. Some data elements in a dictionary happen to be null which rjson parses correctly. > fromJSON(json_str='{"query":{"A":10, "B

Re: [R] populating a large matrix

2012-06-19 Thread Joshua Wiley
Hi Nick, Off the cuff: doit2 <- function(s, d, e) { matrix(c(s, d, d*d, e, s, d*e, e*e, e*d, s), 3, byrow=FALSE) } doit2(s, d, e) seems like it should offer a substantial speed up. Unless the matrix can be populated with arbitrary formulae, I do not see why it should be a text matrix and the

[R] populating a large matrix

2012-06-19 Thread Nick Matzke
Hi all, This question is slightly weird. I am trying to populate a matrix with equations. The matrix represents transition probabilities between states. A simple example is: state1 state2 state3 state1 s d d*d state2 e s d*e state3 e*e e*d s Th

Re: [R] matchit - can I weight the parameters?

2012-06-19 Thread Nordlund, Dan (DSHS/RDA)
Sorry, Stage should be in quotes in the exact= parameter match = matchit(Group ~ Stage + Age + Gender + PS, myData, method="optimal", exact=c('Stage')) Hope this is more helpful, Dan Daniel J. Nordlund Washington State Department of Social and Health Services Planning, Performance, and Accoun

Re: [R] matchit - can I weight the parameters?

2012-06-19 Thread Nordlund, Dan (DSHS/RDA)
You can set the exact= parameter in your call to matchit. That will force an exact match on the value of Stage. match = matchit(Group ~ Stage + Age + Gender + PS, myData, method="optimal", exact=c(Stage)) Hope this is helpful, Dan Daniel J. Nordlund Washington State Department of Social and

Re: [R] Date formats

2012-06-19 Thread Rui Barradas
Hello, Try as.Date("01OCT1928", format="%d%b%Y") [1] "1928-10-01" Note that though probably not a problem to you, this is locale specific. In Portugal, the string corresponding to the same date would be "01OUT1928". The variable to set using Sys.setlocale() would be LC_TIME. For date forma

[R] matchit - can I weight the parameters?

2012-06-19 Thread Polwart Calum (COUNTY DURHAM AND DARLINGTON NHS FOUNDATION TRUST)
This may be a really obvious question but I just can't figure out how to do it. I have a small dataset that I am trying to compare to some controls. It is essential that the controls are matched on Cancer Stage (a numerical factor between 1 and 4), and then ideally on Age (integer), Gender (fac

Re: [R] Profit calculation

2012-06-19 Thread Joshua Ulrich
On Tue, Jun 19, 2012 at 6:07 PM, Bert Gunter wrote: > 1. Don't double post. (obviously belongs on finance list) > 2. Homework? (we don't do homework on r-help) > We don't do homework on R-SIG-Finance either... > -- Bert > Best, -- Joshua Ulrich | FOSS Trading: www.fosstrading.com > On Tue, J

[R] weird --no 'dimnames' attribute for array-- error for R lordif package

2012-06-19 Thread Debs Majumdar
Hi All,   I am trying to use the lordif package in R and can't figure out the reason for the above error when I try to run the calctheta() function. ## # read data using foreign package - must be Stata 11 or earlier racedata<- read.dta("race.dta")    # item responses resp.d

Re: [R] Profit calculation

2012-06-19 Thread Bert Gunter
1. Don't double post. (obviously belongs on finance list) 2. Homework? (we don't do homework on r-help) -- Bert On Tue, Jun 19, 2012 at 3:54 PM, Raghuraman Ramachandran < optionsra...@gmail.com> wrote: > Dear guRus > > Say I have a price vector, P which is P = c(20,50,40,50) for four > consecuti

Re: [R] Error when trying to update cpglm model

2012-06-19 Thread Peter Ehlers
On 2012-06-19 08:31, Rubem Kaipper Ceratti wrote: Dear all, I've been having problems running update() to re-fit a cpglm model inside a function (as in the code below). The solution is probably simple, but I'm stuck. If anyone could help, I'd greatly appreciate it. Regards, Rubem ## R cod

[R] Profit calculation

2012-06-19 Thread Raghuraman Ramachandran
Dear guRus Say I have a price vector, P which is P = c(20,50,40,50) for four consecutive days. My initial equity is say $100 and I re-invest the profits made in each transaction so my equity curve increases. If I go Long on day 1, short and short on day 2, long and long on day 3 and finally shor

Re: [R] Using Sub

2012-06-19 Thread Phil Hurvitz
Possibly overkill, I use a Windows batch file that calls a perl script. Both the bat and pl files need to be in the executable path. Open a command prompt, type `pwd ' and then drag the file or folder from the Windows Explorer to the cmd. The script will return the file with backslashes convert

Re: [R] Format text with outline?

2012-06-19 Thread MacQueen, Don
Thank you, that's very useful. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 6/19/12 1:11 PM, "baptiste auguie" wrote: >Have a look at this: > >http://stackoverflow.com/questions/7734535/control-font-thickness-without-

Re: [R] Format text with outline?

2012-06-19 Thread baptiste auguie
Have a look at this: http://stackoverflow.com/questions/7734535/control-font-thickness-without-changing-font-size and http://stackoverflow.com/questions/10686054/outlined-text-with-ggplot2 which refers to a base graphics version. HTH, b. On 20 June 2012 07:58, MacQueen, Don wrote: > I'm usin

[R] Format text with outline?

2012-06-19 Thread MacQueen, Don
I'm using mtext() to annotate a plot. I would like, if possible, to have the individual characters formatted with an outline or border, with a contrasting fill color inside the borders. I'd appreciate suggestions or pointers toward a way to do this. The reason is because I'm creating a graphic wi

Re: [R] QQplot normally distributed

2012-06-19 Thread John Fox
Dear Kjetil, Simulated point-wise confidence envelopes are available from qqPlot() only for studentized residuals from linear and generalized linear models. For an independent sample of observations, the confidence envelopes produced by qqPlot() are based on the standard errors of the order sta

Re: [R] inverse binomial in R[solved]

2012-06-19 Thread anna freni sterrantino
Hello Peter, Duncan, Dan and RList! How I suspected... I managed to do the  "homework" and forced invbinomal to return zero ( as in Stata) once that k==n. Thank you for all you replies! Cheers Anna Da: peter dalgaard Cc: Duncan Murdoch ; Rcran help Inviat

[R] Error with RJSONIO installation

2012-06-19 Thread MLSC
Hi friends, I was trying to install RJSONIO in Ubuntu10.04 LTS but unfortunately ends up with following error. trying URL 'http://stat.ethz.ch/CRAN/src/contrib/RJSONIO_0.98-1.tar.gz' Content type 'application/x-gzip' length 1150673 bytes (1.1 Mb) opened URL ==

Re: [R] Apply() on columns

2012-06-19 Thread John Kane
Maybe I'm just slow today but what are the columns? I had a look at the dataset and it has no headers so reading it into R just supplies us with something like : dput(head(sm)) sup <- structure(list(V1 = c(7L, 7L, 7L, 7L, 9L, 7L), V2 = c(6L, 8L, 8L, 9L, 9L, 6L), V3 = c(8L, 8L, 7L, 9L, 6L, 8L

Re: [R] QQplot normally distributed

2012-06-19 Thread Kjetil Halvorsen
Or uou can try library(car) ?qqPlot use that with argument simulate=TRUE, which will give a simulated envelope around the curve for comparison. Kjetil On Tue, Jun 19, 2012 at 9:30 AM, Özgür Asar wrote: > Hi, > > Try boxplot for outliers. > > To decide whether they influence significantly, try

Re: [R] Scaling a "density".

2012-06-19 Thread Keith Weintraub
That's a great help. Thanks so much. KW -- On Jun 19, 2012, at 2:31 PM, David L Carlson wrote: > Is this what you are looking for? > > newrec <- rep(recoveries[,1], recoveries[,2]) > plot(density(newrec), ylim=c(0, 5)) > lines(density(newrec*.67), col="red") > plot(ecdf(newrec), xlim=c(0,1), ve

Re: [R] 3-D plot of a bidimensional lognormal distribution

2012-06-19 Thread David Winsemius
On Jun 19, 2012, at 12:33 PM, masterpatacca wrote: Hi and thanks in advance to everyone who will be able to help me. I have 2 independent lognormal distributions with different means and sd. You should explain what that sentence means to you, preferably by offering an example in R code.

Re: [R] Scaling a "density".

2012-06-19 Thread David L Carlson
Is this what you are looking for? newrec <- rep(recoveries[,1], recoveries[,2]) plot(density(newrec), ylim=c(0, 5)) lines(density(newrec*.67), col="red") plot(ecdf(newrec), xlim=c(0,1), verticals=TRUE) lines(ecdf(newrec*.67), verticals=TRUE, col="red")

Re: [R] Trying to speed up an if/else statement in simulations

2012-06-19 Thread nqf
Perfect, I now have a choice of workable solutions. Thanks a lot for your help, much appreciated. Natalie -- View this message in context: http://r.789695.n4.nabble.com/Trying-to-speed-up-an-if-else-statement-in-simulations-tp4633725p4633862.html Sent from the R help mailing list archive at Nabb

[R] 3-D plot of a bidimensional lognormal distribution

2012-06-19 Thread masterpatacca
Hi and thanks in advance to everyone who will be able to help me. I have 2 independent lognormal distributions with different means and sd. I want to plot them togheter in a 3D plot. How can i do this??? I'm getting crazy... Thanks Ale -- View this message in context: http://r.789695.n4.nabble

[R] Comparing to create a new list

2012-06-19 Thread RobertDavis
I have a shape file that I have read into R. It is a US Census shape file that has a code for each school district in a state. I now want to create a vector of the districts that are not customers and plot them. library(maptools) library(maps) elem_school_district <- readShapePoly("E:/My Documen

Re: [R] seek(), skip by bits (not by bytes) in binary file

2012-06-19 Thread Ben quant
This post got me thinking and this works (fast!) to get the first 10 integers that I want: #I'm still testing this... # once I find the value of 'junk' and 'size_to_use', which I already had/have. to.read = file(file_path_name,"rb") seek(to.read,where=junk) data1 = readBin(to.read,integer(),n=10,

Re: [R] Adding title to colorkey

2012-06-19 Thread Stephen Eglen
> > This is slightly simpler: > > levelplot(matrix(1:9,3,3), ylab.right = "title here", > par.settings = list(layout.widths = list(axis.key.padding = 0, >ylab.right = 2))) That's good enough for me - thanks! ___

Re: [R] aligning axis labels in a colorkey from levelplot

2012-06-19 Thread Stephen Eglen
> > Justification is hard-coded, and that's not easy to change. This is > not only for the colorkey; e.g., > > xyplot(y~1, scales = list(alternating = 3)) > > will also give you left-aligned axes on the right. > > My only suggestion (other than custom labels as suggested by ilai) is > > levelplo

Re: [R] [R-sig-Geo] Help in simultaneous equations

2012-06-19 Thread Sarah Goslee
On Tue, Jun 19, 2012 at 1:11 PM, Saima Bashir wrote: > Hi Sarah, > > I have installed and loaded them into R but get same error. > > I am using four equations, cross-section data, version R i386 2.15.0. That is by no means all the information I requested in my original reply, or all that is reque

Re: [R] Changing strip text

2012-06-19 Thread Peter Ehlers
On 2012-06-18 20:35, Duncan Mackay wrote: Hi Julie Try strip.custom(factor.levels = paste("Treat", c("0","2","4","8","16"), sep = " ") That won't necessarily work; it depends on what type 'Treat' is. I suspect that it's not a factor. Here's an example using the iris data: First, let's augmen

Re: [R] seek(), skip by bits (not by bytes) in binary file

2012-06-19 Thread Jeff Newmiller
If the structure really changes day by day, then you have to decipher how it is constructed in order to find the correct bit to go to. If you think you already know which bit to go to, then the way you know is "the 3rd bit of the 71st byte", which means that the existing seek function should b

Re: [R] Installing xlsx package on Mac OS X

2012-06-19 Thread MacQueen, Don
As far as recall (it's been a while), install.packages('xlsx') worked for me, on a 10.6 system. You'll have to provide more information. And probably it would be better to take this to R-sig-mac. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA

Re: [R] Subset of summary results

2012-06-19 Thread Özgür Asar
>yes, it gives me the required summary statistics with the following command >summary(Mnp)$coef.table[c(1:3,5,6,8,9,11,12,14,15,17,18),] >Normally if we compare the two summary results before and after skipping some variables, we note bit change in >the estimates of the rest of the variables. But

[R] Regression equation with a spline in gam (mgcv)

2012-06-19 Thread Stefano Sofia
Given model1 <- gam(Y ~ X1, family=poisson) (which is a glm), the regression equation is Log(Y) = 2.132 + 0.00044 X1 In fact from summary(model1), I read > summary(model1) Family: poisson Link function: log ... Parametric coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept)

Re: [R] seek(), skip by bits (not by bytes) in binary file

2012-06-19 Thread jim holtman
I am not sure why reading through 'bit-by-bit' gets you to where you want to be. I assume that the file has some structure, even though it may be changing daily. You mentioned the various types of data that it might contain; are they all in 'byte' sized chucks? If you really have data that begin

Re: [R] Scaling a "density".

2012-06-19 Thread Keith Weintraub
Bert, Thanks for your help and comments. My inferior writing skills have failed to elucidate what I thought were implicit questions in the following: I would like to plot this: > recoveries*matrix(c(.67,1),nrow = 11, ncol = 2, byrow = TRUE) pcts counts [1,] 0.000 0 [2,] 0.067

Re: [R] Smoothing a persp graph

2012-06-19 Thread David Winsemius
On Jun 19, 2012, at 11:42 AM, David L Carlson wrote: The kde2d function estimates density using the spacing of the points in two dimensions. The requester has gridded (x, y) data with a z value. The function call for kde2d takes x and y and compute z values that estimate point density. Kd

Re: [R] Smoothing a persp graph

2012-06-19 Thread Bert Gunter
?loess, mgcv, kriging, ... There must be hundreds. Have you consulted the CRAN "spatial" task view? -- Bert On Tue, Jun 19, 2012 at 8:34 AM, Guillaume Chapron < carnivorescie...@gmail.com> wrote: > On Jun 19, 2012, at 10:02 AM, David L Carlson wrote: > > kde2d is for two dimensional data. The p

Re: [R] Smoothing a persp graph

2012-06-19 Thread David L Carlson
The kde2d function estimates density using the spacing of the points in two dimensions. The requester has gridded (x, y) data with a z value. The function call for kde2d takes x and y and compute z values that estimate point density. Kde2d is used for point data where you want to estimate the dens

Re: [R] Scaling a "density".

2012-06-19 Thread Bert Gunter
1. You have not asked a question. 2. Your data set is too small to do anything more with it than show it in a table as you have done. (IMHO) anything more than that would be wild, foolish, unsupportable, and misleading "statisticizing" -- by which I mean creating the appearance of having more and

Re: [R] Analyzing 2008 ANES using the weight variable

2012-06-19 Thread R. Michael Weylandt
Most modelling functions take a weights= argument so once you decide what sort of model you are looking for, that should be the way to proceed. But do be forewarned that there are a few kinds of "weights" in statistics and it's not standardized which is the default across different statistical soft

Re: [R] seek(), skip by bits (not by bytes) in binary file

2012-06-19 Thread Ben quant
Other people at my firm who know a lot about binary files couldn't figure out the parts of the file that I am skipping over. Part of the issue is that there are several different files (dbs extension files) like this that I have to process and the structures do change depending on the source of the

Re: [R] inverse binomial in R

2012-06-19 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of anna freni sterrantino > Sent: Tuesday, June 19, 2012 2:40 AM > To: Duncan Murdoch > Cc: Rcran help > Subject: Re: [R] inverse binomial in R > > > > Hi Duncan and Rlist, > I've

[R] seek(), skip by bits (not by bytes) in binary file

2012-06-19 Thread Ben quant
Hello, Has a function been built that will skip to a certain bit in a binary file? As of 2009 the answer was 'no': http://r.789695.n4.nabble.com/read-binary-file-seek-td900847.html https://stat.ethz.ch/pipermail/r-help/2009-May/199819.html If you feel I don't need to (like in the links above), p

Re: [R] Smoothing a persp graph

2012-06-19 Thread Guillaume Chapron
On Jun 19, 2012, at 10:02 AM, David L Carlson wrote: kde2d is for two dimensional data. The persp graph is 3d. Huh? The question asked about plotting data that was 2d. The third dimension was to be the density. kde2d in package MASS or the similarly named function in package KernSmooth would

[R] Error when trying to update cpglm model

2012-06-19 Thread Rubem Kaipper Ceratti
Dear all, I've been having problems running update() to re-fit a cpglm model inside a function (as in the code below). The solution is probably simple, but I'm stuck. If anyone could help, I'd greatly appreciate it. Regards, Rubem ## R code library(cplm) ## Data simulation period<-factor(1

[R] Scaling a "density".

2012-06-19 Thread Keith Weintraub
Folks, I have a small dataset of counts of recoveries on defaulted loans: recoveries<-structure(c(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 0, 0, 0, 0, 0, 4, 0, 1, 2, 2, 12), .Dim = c(11L, 2L), .Dimnames = list( NULL, c("pcts", "counts"))) Here is the data in columnar form:

Re: [R] Smoothing a persp graph

2012-06-19 Thread David Winsemius
On Jun 19, 2012, at 10:02 AM, David L Carlson wrote: kde2d is for two dimensional data. The persp graph is 3d. Huh? The question asked about plotting data that was 2d. The third dimension was to be the density. kde2d in package MASS or the similarly named function in package KernSmooth wo

Re: [R] Date formats

2012-06-19 Thread Miguel Manese
Hi Walt, as.Date("01OCT1928", "%d%b%Y") works for me. See also ?strftime Regards, Jon On Tue, Jun 19, 2012 at 8:00 PM, Data Analytics Corp. wrote: > Hi, > > I imported an excel table (using read.csv) of Dow Jones monthly average > closings where the first variable is a date as a character str

Re: [R] Date formats

2012-06-19 Thread David Winsemius
On Jun 19, 2012, at 8:00 AM, Data Analytics Corp. wrote: Hi, I imported an excel table (using read.csv) of Dow Jones monthly average closings where the first variable is a date as a character string such as "01OCT1928". How do I convert this to a date variable so I can plot monthly aver

Re: [R] help with xy.coords(x,y)

2012-06-19 Thread David Winsemius
On Jun 18, 2012, at 9:53 PM, adamshun wrote: i am working on the project to analyze hedge fund performance, i would appreciate that if you guys could spare some time helping me out with the R code. Thanks. The senario is: i applied BOXPLOT() to plot the performance of all hedge funds with

[R] Analyzing 2008 ANES using the weight variable

2012-06-19 Thread Hutch Pollock
Good morning. I am a competent (not sophisticated) Stata and SPSS user. Although I'm relatively new to R, I have learned to analyze unweighted data. But now I want to analyze the 2008 American National Election Study, which provides a single weight variable (v081010). In SPSS, I set the weight and

Re: [R] Cholesky decomposition error

2012-06-19 Thread peter dalgaard
On Jun 19, 2012, at 10:31 , wrote: > Dear Kjetil, thanks for your time to detail the code. Sorry, I am still not > able to grasp why you are creating random normal distribution for the > covariance matrix and also why I should optimize the whole matrix value while > I only need to optimize

[R] Solving TSP optimally

2012-06-19 Thread Anup Bhatkar
Hello, Does anyone know an R package which can solve TSP problem optimally. I checked the TSP package which has heuristic based algorithms so the solution is not guaranteed to be optimal. Of course concorde package is there but it is free only for academic use. So do I have any other option? T

Re: [R] Smoothing a persp graph

2012-06-19 Thread David L Carlson
kde2d is for two dimensional data. The persp graph is 3d. Look at the StatDA package, particularly the Vignette for that package, "Tutorial to the package StatDA" which discusses smoothing techniques and kriging: http://cran.r-project.org/web/packages/StatDA/vignettes/StatDA.pdf For more option

Re: [R] inverse binomial in R

2012-06-19 Thread Eik Vettorazzi
Hi Anna, you are at the upper end of the support of the respective binomial distribution when asking for invbinomial(n,n,p). The probability of seeing n or less successes in n trials is 1, regardless of the underlying success rate. It cannot be less, so asking for invbinomial(50,50, 0.6) makes no s

Re: [R] inverse binomial in R

2012-06-19 Thread peter dalgaard
On Jun 19, 2012, at 11:39 , anna freni sterrantino wrote: > > > Hi Duncan and Rlist, > I've notice a different behaviour in the invbinomial > you suggest me and invbinomial in stata. > > invbinomial(50,50, 0.4) > Error in uniroot(function(x) pbinom(k, n, x) - p, c(0, 1)) : > f() values at e

Re: [R] QQplot normally distributed

2012-06-19 Thread Noor.v.d.Assem
Hi, But what are the functions of the outliers on the left and right? Does they influence the normal distribution? -- View this message in context: http://r.789695.n4.nabble.com/QQplot-normally-distributed-tp4633819p4633823.html Sent from the R help mailing list archive at Nabble.com. _

[R] Date formats

2012-06-19 Thread Data Analytics Corp.
Hi, I imported an excel table (using read.csv) of Dow Jones monthly average closings where the first variable is a date as a character string such as "01OCT1928". How do I convert this to a date variable so I can plot monthly average closings against date using ggplot2? Thanks, Walt _

[R] QQplot normally distributed

2012-06-19 Thread Noor.v.d.Assem
Hi folks, I have some data where I have to investigate with a suitable QQ-plot wheter or not the measurement erros are normally distributed. The distributed data are form the residuals of a lineair regression, that can be considered as aproximations of the actuel measurement errors. This is the gr

[R] need help with unlist(), losing NULL values

2012-06-19 Thread dinesh
Hi, I have a very rudimentary kind of question on using unlist(). I am parsing a bunch of JSON text using rjson package. Some data elements in a dictionary happen to be null which rjson parses correctly. > fromJSON(json_str='{"query":{"A":10, "B":null, "C":"hello"}, "query":{"A":20, "B":null

Re: [R] Apply() on columns

2012-06-19 Thread faelsendoorn
Hi, It wasn't my purpose to quote the assignment here, but since my example is crappy I will. So I'am a manager of a supermarket and interested in the average working hours per employee. At http://www.mijnbestand.nl/Bestand-6Z8PB7VNSUHZ.txt this link you can find the dataset. The dataset contai

[R] Reference classes and memory consumption

2012-06-19 Thread Jan Mueller
Dear All, It seems that reference classes consume a lot of memory which became a problem for my rather extensive simulation. I prepared a small example. An instance of this minimal class uses about 20K on disk. rm(list=ls(all=TRUE)); MySmallClass = setRefClass("MySmallClass", fields =

Re: [R] Smoothing a persp graph

2012-06-19 Thread Kehl Dániel
Take a look at the kde2d function in the MASS package, maybe it helps. Best kd 2012.06.19. 14:26 keltezéssel, Guillaume Chapron írta: > Hi, > > I'm unable to find a way to smooth data for a persp() graph. > > Example, suppose that I have data x,y,z like this: > > x<- 1:10 > y<- 1:10 > > k<- 20

Re: [R] QQplot normally distributed

2012-06-19 Thread Liviu Andronic
On Tue, Jun 19, 2012 at 12:42 PM, Özgür Asar wrote: > Following a straight line indicates less evidence towards non-normality. But > QQ-Plot is an exploratory tool. > > You can confirm your ideas obtained from the QQ-Plot via noramlity tests > such as Shapiro-Wilk test. > Hmm, some gurus on this

Re: [R] Biplot - how can I make it more readable?

2012-06-19 Thread David L Carlson
Take a look at the posting instructions: http://www.R-project.org/posting-guide.html to see how to attach a file. Yours did not make the trip. -- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 >

Re: [R] Subset of summary results

2012-06-19 Thread Özgür Asar
What about summary(model)$coefficients[,1] ? ozgur -- View this message in context: http://r.789695.n4.nabble.com/Subset-of-summary-results-tp4633821p4633832.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailin

Re: [R] QQplot normally distributed

2012-06-19 Thread Özgür Asar
Hi, Try boxplot for outliers. To decide whether they influence significantly, try confirmatory normality tests. Ozgur -- View this message in context: http://r.789695.n4.nabble.com/QQplot-normally-distributed-tp4633819p4633830.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Possible bug when using encomptest

2012-06-19 Thread Achim Zeileis
Cormac, thanks for the detailed information on this. Three comments: (a) The "horrible failure" that encomptest() produces in your second issue is for me: R> encomptest(models12[[1]],models1[[1]]) ##horrible failure! Error in encomptest(models12[[1]], models1[[1]]) : models were not all fit

[R] Smoothing a persp graph

2012-06-19 Thread Guillaume Chapron
Hi, I'm unable to find a way to smooth data for a persp() graph. Example, suppose that I have data x,y,z like this: x <- 1:10 y <- 1:10 k <- 20 z <- outer(x, y, "*") + matrix( k*runif(100, -1, 1), 10, 10) persp(x, y, z, theta = 35, phi = 25) The graph is not very nice. Is there a way to smooth

[R] Possible bug when using encomptest

2012-06-19 Thread Cormac Long
Hello R-Help, - Issues (there are 2): 1) Possible bug when using lmtest::encomptest() with a linear model created using nlme::lmList() 2) Possible modificat

Re: [R] Subset of summary results

2012-06-19 Thread Özgür Asar
Did you try summary(model)$coefficients summary(model)$covariances names(model) would help you as well. ozgur -- View this message in context: http://r.789695.n4.nabble.com/Subset-of-summary-results-tp4633821p4633822.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] QQplot normally distributed

2012-06-19 Thread Özgür Asar
Hi, Following a straight line indicates less evidence towards non-normality. But QQ-Plot is an exploratory tool. You can confirm your ideas obtained from the QQ-Plot via noramlity tests such as Shapiro-Wilk test. See shapiro.test under stats package and nortest package. Ozgur -- View this mes

Re: [R] inverse binomial in R

2012-06-19 Thread anna freni sterrantino
Hi Duncan and Rlist, I've notice a different behaviour in the invbinomial you suggest me and invbinomial in stata. invbinomial(50,50, 0.4) Error in uniroot(function(x) pbinom(k, n, x) - p, c(0, 1)) :    f() values at end points not of opposite sign > invbinomial(50,50, 0.6) Error in uniroot(func

Re: [R] Antw: Re: Need to append vector to all levels of nested list WITHOUT a loop

2012-06-19 Thread Rui Barradas
Hello, again. I really don't know of any advanced tutorial specifically on lists but I'm posting a link below. I believe the best way is practice. Some things to remember: 1. Many times, almost always, it's better to try the function to apply in one or two examples. If it works in the small,

Re: [R] Cholesky decomposition error

2012-06-19 Thread nataraj
Dear Kjetil, thanks for your time to detail the code. Sorry, I am still not able to grasp why you are creating random normal distribution for the covariance matrix and also why I should optimize the whole matrix value while I only need to optimize the two variables ?. This is my 15 x 15 covaria

Re: [R] triangular matrix

2012-06-19 Thread lucinka
Hi Jon, thanks a lot, it seems to be working just perfect ;) thank you ! regards, Lucia -- View this message in context: http://r.789695.n4.nabble.com/triangular-matrix-tp4633679p4633809.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Help with Sequential Differencing

2012-06-19 Thread Lekgatlhamang, lexi Setlhare
Hi Sarah, Thanks for your assistance. I have had time to test the first of the two code programs you suggested. It worked well, but it turns out that 'lag=i' has to be dropped for the code to generate correct results. I have also reviewed list structures in the intro to R and I understand much

Re: [R] multiplicative error model

2012-06-19 Thread saraberta
no the manual doesn't help me. because, it doesn't give me the results i need. this is what i obtain (y in my case is the daily range of s&p) > mem <- dm( y~mem(1,1) ) > summary( mem) Call: dm(formula = y ~ mem(1, 1)) > mem Call: dm(formula = y ~ mem(1, 1)) Coefficients: [1] 0.001656 0.2340

Re: [R] help in sentDetect() fuction

2012-06-19 Thread raishilpa
I am running the code , getting following error-- Error in x[i, ] : incorrect number of dimensions On Fri, Jun 15, 2012 at 8:03 PM, Michael Weylandt [via R] < ml-node+s789695n4633507...@n4.nabble.com> wrote: > On Fri, Jun 15, 2012 at 1:48 AM, raishilpa <[hidden > email]

Re: [R] how to use by function

2012-06-19 Thread arun
Hi, Not familiar with by function. But you can get the result : mat[,1]<-(rle(data[,1]))$values mat[1,]<-(rle(data[,1]))$values mat[3,2:3]<-(rle(data[,2])$values)[4:5] > mat [,1] [,2] [,3] [1,]    1    2    3 [2,]    2   NA   NA [3,]    3    2    4 A.K. - Original Message -

Re: [R] how to use by function

2012-06-19 Thread Rui Barradas
Hello, Your code is not working because you are not understanding what's written in the help page for 'by'. 'by' breaks its first argument, a data.frame, (could be matrix) into sets of rows using 'index' to do the breaking. Each set of rows is the argument for FUN, a function that already ex