Re: [R] NAs introduced by coercion warning, while plotting data

2014-01-07 Thread Dániel Kehl
Hi,

are you reading only one cell of your Excel file?
It seems your datalist is not numeric but text.
Try saving your Excel file as csv or text, reading in data might be much more 
straightforward!

best
daniel

Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ; 
meghatalmaz#243;: Baro [babak...@gmail.com]
Küldve: 2014. január 7. 16:01
To: PIKAL Petr
Cc: R help
Tárgy: Re: [R] NAs introduced by coercion warning, while plotting data

thank you for your answer, I am reading my Data from an excel File. This is
my R code:

srow-2421
wb - loadWorkbook(C:\\users\\Babak\\Desktop\\spalte205.xls)
dat -readWorksheet(wb, sheet=getSheets(wb)[1], startRow=srow, endRow=srow,
startCol=spalte, endCol=spalte,header=FALSE)
datalist-dat[,1]
datalist-sub(;,,datalist)
datalist
plot(datalist,type=l,ylim=c(-1,+1))

as an output of my data, I see:

 datalist
[1]  7.0121, -0.673354, 0.749622, -0.549641, 0.435662, -0.328995,
0.0869976, -0.0851428, -0.191019, 0.188799, -0.373707, 0.434814, -0.51979,
0.61944, -0.554766, 0.662571, -0.557779, 0.543724, -0.452397, 0.293651,
-0.248438, 0.0532787, -0.0185775, -0.176117, 0.222021, -0.34723, 0.407796,
-0.416123, 0.497159, -0.435225, 0.473375, -0.370811, 0.33683, -0.273933,
0.149871, -0.142623, -0.0253748, 0.0205145, -0.134123, 0.167995, -0.209844,
0.266891, -0.242527, 0.326598, -0.235483, 0.275738, -0.195738, 0.168225,
-0.114333, 0.0593316, -0.0583527, -0.016594, 0.0363428, -0.0533603,
0.106158, -0.129363, 0.131993, -0.134909, 0.135686, -0.125387, 0.0866545,
-0.0668686, 0.043161, -0.0229738  




On Tue, Jan 7, 2014 at 6:54 AM, PIKAL Petr petr.pi...@precheza.cz wrote:

 Hi

 I did not get any error with your data

 plot(test)

 dput(test)
 c(7.0121, -0.673354, 0.749622, -0.549641, 0.435662, -0.328995,
 0.0869976, -0.0851428, -0.191019, 0.188799, -0.373707, 0.434814,
 -0.51979, 0.61944, -0.554766, 0.662571, -0.557779, 0.543724,
 -0.452397, 0.293651, -0.248438, 0.0532787, -0.0185775, -0.176117,
 0.222021, -0.34723, 0.407796, -0.416123, 0.497159, -0.435225,
 0.473375, -0.370811, 0.33683, -0.273933, 0.149871, -0.142623,
 -0.0253748, 0.0205145, -0.134123, 0.167995, -0.209844, 0.266891,
 -0.242527, 0.326598, -0.235483, 0.275738, -0.195738, 0.168225,
 -0.114333, 0.0593316, -0.0583527, -0.016594, 0.0363428, -0.0533603,
 0.106158, -0.129363, 0.131993, -0.134909, 0.135686, -0.125387,
 0.0866545, -0.0668686, 0.043161, -0.0229738)

 You shall explain more clearly what you did (code) and what are your data
 (dput)

 I presume that the story is not as simple as plotting a vector as you have
 suggested.

 Petr

  -Original Message-
  From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
  project.org] On Behalf Of Baro
  Sent: Tuesday, January 07, 2014 3:40 PM
  To: R help
  Subject: [R] NAs introduced by coercion warning, while plotting data
 
  Hi all
 
  I have such a Data and I want to plot them but I get this warning
 
  Warning message:
  In xy.coords(x, y, xlabel, ylabel, log) : NAs introduced by coercion
 
 
   7.0121, -0.673354, 0.749622, -0.549641, 0.435662, -0.328995,
  0.0869976, -0.0851428, -0.191019, 0.188799, -0.373707, 0.434814, -
  0.51979, 0.61944, -0.554766, 0.662571, -0.557779, 0.543724, -0.452397,
  0.293651, -0.248438, 0.0532787, -0.0185775, -0.176117, 0.222021, -
  0.34723, 0.407796, -0.416123, 0.497159, -0.435225, 0.473375, -0.370811,
  0.33683, -0.273933, 0.149871, -0.142623, -0.0253748, 0.0205145, -
  0.134123, 0.167995, -0.209844, 0.266891, -0.242527, 0.326598, -
  0.235483, 0.275738, -0.195738, 0.168225, -0.114333, 0.0593316, -
  0.0583527, -0.016594, 0.0363428, -0.0533603, 0.106158, -0.129363,
  0.131993, -0.134909, 0.135686, -0.125387, 0.0866545, -0.0668686,
  0.043161, -0.0229738 
 
  Why do I get this warning? how can I solve it?
 
[[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.

__
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] why there is no quarters?

2013-12-16 Thread Dániel Kehl
Hi,

try

x - seq(as.Date(2001/1/1),as.Date(2010/1/1),3 months)

best,
daniel

Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ; 
meghatalmaz#243;: Pancho Mulongeni [p.mulong...@namibia.pharmaccess.org]
Küldve: 2013. december 16. 13:05
To: 1248283...@qq.com
Cc: r-help@r-project.org
Tárgy: Re: [R] why there is no quarters?

Hi,
I also would like to use quarters. I think a work around would be to just label 
each record in the dataframe by its quarter.
i.e. you add a factor called 'Quarter' with four levels (Q1 to Q4) for each row 
and you assign the level based on the month of the date.
You can easily do this with as.Date and as.character.

Pancho Mulongeni
Research Assistant
PharmAccess Foundation
1 Fouché Street
Windhoek West
Windhoek
Namibia

Tel:   +264 61 419 000
Fax:  +264 61 419 001/2
Mob: +264 81 4456 286

__
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] [Probable spam] RE: how can i add Qtr1 Qtr2 Qtr3 Qtr4 on the x axis?

2013-12-15 Thread Dániel Kehl
Hi,

try

?axis.Date

works similar to the axis function.

I hope that helps!
daniel

Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ; 
meghatalmaz#243;: 水静流深 [1248283...@qq.com]
Küldve: 2013. december 15. 9:17
To: r-help
Tárgy: [R] how can i add Qtr1 Qtr2 Qtr3 Qtr4  on the x axis?

 x-ts(sales,frequency=4,start=c(2010,1))
 x
 Qtr1 Qtr2 Qtr3 Qtr4
2010  1.8  8.0  6.0  3.0
2011  2.0 11.0  7.0  3.5
2012  2.5 14.0  8.0  4.2
2013  3.0 15.2  9.5  5.0
 plot.ts(x)
__
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] [Probable spam]RE: how to add a line in the graph?

2013-12-15 Thread Dániel Kehl
t- -4:4
y-c(5,7,10,13,15,16,14,12,11)
plot(t,y,type=l, ylim=c(-20,20))

curve(0.83*x-0.44*x^2, add=TRUE)

I added ylim to plot so that your curve is on the graph. Maybe you wanted to 
use different parameters.

Try going through a basic manual of R!

daniel

Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ; 
meghatalmaz#243;: 水静流深 [1248283...@qq.com]
Küldve: 2013. december 15. 13:46
To: r-help
Tárgy: [R] how to  add a line in the graph?

t--4:4
y-c(5,7,10,13,15,16,14,12,11)
plot(t,y,type=l)

how can i add a curve  y=0.83*t-0.44*t^2  in the graph?
[[alternative HTML version deleted]]

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


Re: [R] RSM

2013-12-15 Thread Dániel Kehl
There is no variable called x1 in the chem dataframe.
Did you mean 

gg1=rsm(yield~ FO(x1,x2),data=ggg,subset = (Block == B1))

hth.
daniel

Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ; 
meghatalmaz#243;: IZHAK shabsogh [ishaqb...@yahoo.com]
Küldve: 2013. december 15. 15:53
To: r-help@r-project.org
Tárgy: [R] RSM

kindly help find out why the following code is given me error


time-c(80,80,90,90,85,85,85,85,85,85,92,77,85,85)
 tem-c(170,180,170,180,175,175,175,175,175,175,175,175,182.07,167.93)
 yield-c(80.5,81.5,82,83.5,83.9,84.3,84,79.7,79.8,79.5,78.4,75.6,78.6,77)
 Block-c(B1,B1,B1,B1,B1,B1,B1,B2,B2,B2,B2,B2,B2,B2)
 chem-data.frame(time,tem,Block,yield)
 ggg-coded.data(chem, x1 ~ (time - 85)/5, x2 ~ (tem - 175)/5)
 gg1=rsm(yield~ FO(x1,x2),data=chem,subset = (Block == B1))
Error in lapply(X = X, FUN = FUN, ...) : object 'x1' not found
 gg1=rsm(yield~ SO(x1,x2),data=chem,subset = (Block == B1))
Error in lapply(X = X, FUN = FUN, ...) : object 'x1' not found

[[alternative HTML version deleted]]

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

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


Re: [R] Change factor levels

2013-12-14 Thread Dániel Kehl
Dear Gang,

this seem to solve your problem.

http://stackoverflow.com/questions/1195826/dropping-factor-levels-in-a-subsetted-data-frame-in-r


best
daniel

Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ; 
meghatalmaz#243;: Gang Chen [gangch...@gmail.com]
Küldve: 2013. december 14. 21:09
To: r-help
Tárgy: [R] Change factor levels

Suppose I have a dataframe 'd' defined as

 L3 - LETTERS[1:3]
 d0 - data.frame(cbind(x = 1, y = 1:10), fac = sample(L3, 10, replace
= TRUE))
 (d - d0[d0$fac %in% c('A', 'B'),])

  x y fac
2 1 2   B
3 1 3   A
4 1 4   A
5 1 5   A
6 1 6   B
8 1 8   A

Even though factor 'fac' in 'd' only has 2 levels, but it seems to bear the
birthmark of 3 levels from its parent 'd0':

str(d)

'data.frame': 6 obs. of  3 variables:
 $ x  : num  1 1 1 1 1 1
 $ y  : num  2 3 4 5 6 8
 $ fac: Factor w/ 3 levels A,B,C: 2 1 1 1 2 1

How can I cut the umbilical cord so that factor 'fac' in 'd' would have an
accurate birth certificate with the correct number of levels? Apparently
the following does not work:

levels(d$fac) - c('A', 'B')

Also any reason for this heritage?

Thanks,
Gang

[[alternative HTML version deleted]]

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

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


Re: [R] Solving a normal distribution pnorm for q

2013-12-12 Thread Dániel Kehl
Looks like homework.

Try ?qnorm

Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ; 
meghatalmaz#243;: Johannes Radinger [johannesradin...@gmail.com]
Küldve: 2013. december 12. 14:56
To: R help
Tárgy: [R] Solving a normal distribution pnorm for q

Hi,



I found follwowing example of pnorm here:

http://www.r-tutor.com/elementary-statistics/probability-distributions/normal-distribution



Problem

Assume that the test scores of a college entrance exam fits a normal
distribution. Furthermore, the mean test score is 72, and the standard
deviation is 15.2. What is the percentage of students scoring 84 or more in
the exam?



Solution

 pnorm(84, mean=72, sd=15.2, lower.tail=FALSE)

[1] 0.21492



That is straight forward, however what if I want to know the score the best
30% students are reaching at least. So I know the solution of pnorm but
want to know its q. How can that be achieved in R?



Any suggestions?



/Johannes

[[alternative HTML version deleted]]

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

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


Re: [R] boxcox transformations

2013-12-12 Thread Dániel Kehl
Dear Yogi,

try the powerTransform function in the car package and boxcox function in the 
MASS package.
there are nice examples for both functions.

HTH,
daniel

Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ; 
meghatalmaz#243;: Yogendra [ykhedi...@gmail.com]
Küldve: 2013. december 12. 19:00
To: r-help@r-project.org
Tárgy: [R] boxcox transformations

Hi,
I am new to R.
I need help with regards to box cox transformation.
I have phenotypic data for e.g. plant height.
data is non-normal. Skewness is 0.34.

Could you please help me?

Regards,
Yogi




--
View this message in context: 
http://r.789695.n4.nabble.com/boxcox-transformations-tp4682077.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]

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

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


Re: [R] growth curve estimation

2013-12-10 Thread Dániel Kehl
Dear Vito, Robert and David,

thank you for your replies, although I made some step forward on my own, your 
answers helped a lot and gave me more insight.
The only question I have left is why this code gives me an error (and that is 
what David asked for):

m1 - lms(BMI,age,data=adatok_fiu, cent=c(3,10,25,50,75,90,97), families=BCCG)
centiles.pred(m1, xname=age, xvalues=seq(10,20,.5), 
cent=c(3,10,25,50,75,90,97))
Error in X[onlydata, , drop = FALSE] : 
  (subscript) logical subscript too long

but

m3 - gamlss(BMI~pb(age), sigma.formula=~pb(age), nu.formula = ~pb(age), 
tau.formula = ~pb(age), family=BCT, data=adatok_fiu)
centiles.pred(m3, xname=age, xvalues=seq(10,20,.5), 
cent=c(3,10,25,50,75,90,97))

works as expected (although I get a warning message
Warning message:
In predict.gamlss(obj, what = tau, newdata = newx, type = response,  :
  There is a discrepancy  between the original and the re-fit 
 used to achieve 'safe' predictions 


I had the feeling centiles.pred should work for the result of an lms() function 
just like in case of gamlss().

Thank you all again!

daniel


Feladó: David Winsemius [dwinsem...@comcast.net]
Küldve: 2013. december 9. 21:40
To: Dániel Kehl
Cc: r-help@r-project.org
Tárgy: Re: [R] growth curve estimation

On Dec 8, 2013, at 7:45 AM, Dániel Kehl wrote:

 Dear Community,

 I am struggling with a growth curve estimation problem. It is a classic BMI 
 change with age calculation. I am not an expert of this field but have some 
 statistical experience in other fields.
 Of course I started reading classical papers related to the topic and 
 understood the concept of the LMS method. After that I thought it will be a 
 piece of cake, R must have a package related to the topic, so I just need 
 the data and I am just a few lines of code from the results.


You might want to look at a more recent discussion:

http://www.who.int/entity/childgrowth/standards/velocity/tr3chap_2.pdf

(The WHO centre has published their R code.)


 I encountered some problems:
 - found at least three packages related to LMS: gamlss, VGAM and an old one 
 lmsqreg (I did not try this because it does not support my R version (3.0.1.))
 - it was relatively easy to get plots of percentiles in both packages, 
 although they were far not the same (I also tried an other software, 
 LMSchartmaker it gave different results from the previous ones)
 - I tried to get tables of predicted values (with the predict function in 
 VGAM and with centiles.pre in gamlss) but without any success.

Don't see any code or error messages.

 - I tried to use the function gamlss() instead of lms() in gamlss but I could 
 not force them to give the same (or very similar results), but the 
 centiles.pred() function did work as expected for the model resulted from 
 galmss()
 - lms gives really different results if k is specified different ways, which 
 is best?

Won't that depend on the amount and distribution of the data?


 Also I have a general question: some publications state they estimated the 
 centiles so that aroun 18 years of age the curves pass through certain 
 points. How is that possible?

 Thank you for any suggestions or insights about the methods or preferred 
 package!

 Here is my code (without data):

 #gamlss
 library(gamlss)
 library(VGAM)
 library(foreign)
 adatok - read.spss(MDSZ adatok.sav, to.data.frame=TRUE)

 adatok_fiu - subset(adatok, adatok$gender == Fiúk)[,2:3]
 row.names(adatok_fiu) - NULL
 adatok_lany - subset(adatok, adatok$gender == L÷nyok)[,2:3]
 row.names(adatok_lany) - NULL

 m1 - lms(BMI,age,data=adatok_fiu, cent=c(3,10,25,50,75,90,97), 
 families=BCCG)
 fittedPlot(m1, x=adatok_fiu$age)
 m1 - lms(BMI,age,data=adatok_fiu, cent=c(3,10,25,50,75,90,97), 
 families=BCCG, method.pb=GAIC, k=log(1455))
 fittedPlot(m1, x=adatok_fiu$age)
 m1 - lms(BMI,age,data=adatok_fiu, cent=c(3,10,25,50,75,90,97), 
 families=BCCG, method.pb=GAIC)
 fittedPlot(m1, x=adatok_fiu$age)

 m2 - lms(BMI,age,data=adatok_lany, cent=c(3,10,25,50,75,90,97), 
 families=BCCG)
 m2 - lms(BMI,age,data=adatok_lany, cent=c(3,10,25,50,75,90,97), 
 families=BCCG, method.pb=GAIC, k=log(1144))
 m2 - lms(BMI,age,data=adatok_lany, cent=c(3,10,25,50,75,90,97), 
 families=BCCG, method.pb=GAIC)

 m3 - gamlss(BMI~age, family=BCT, data=adatok_fiu)
 centiles(m3,xvar=adatok_fiu$age, cent=c(3,10,25,50,75,90,97))

 newx - seq(12,20,.5)

 centiles.pred(m1, xname=age, xvalues=newx)
 centiles.pred(m3, xname=age, xvalues=newx)
 centiles(m1,adatok_fiu$age)

 #VGAM
 library(foreign)
 library(VGAM)
 library(VGAMdata)

 adatok - read.spss(MDSZ adatok.sav, to.data.frame=TRUE)

 adatok_fiu - subset(adatok, adatok$gender == Fiúk)
 adatok_lany - subset(adatok, adatok$gender == L÷nyok)

 fit1 - vgam(BMI ~ s(age), lms.bcn(percentiles = c(3, 10, 25, 50, 75, 90, 
 97)), adatok_fiu)
 fit2 - vgam(BMI ~ s(age), lms.bcn(percentiles = c(3, 10, 25, 50, 75, 90, 
 97)), adatok_lany)

 qtplot(fit1, percentiles = c(3, 10, 25

[R] growth curve estimation

2013-12-08 Thread Dániel Kehl
Dear Community,

I am struggling with a growth curve estimation problem. It is a classic BMI 
change with age calculation. I am not an expert of this field but have some 
statistical experience in other fields.
Of course I started reading classical papers related to the topic and 
understood the concept of the LMS method. After that I thought it will be a 
piece of cake, R must have a package related to the topic, so I just need the 
data and I am just a few lines of code from the results.

I encountered some problems:
- found at least three packages related to LMS: gamlss, VGAM and an old one 
lmsqreg (I did not try this because it does not support my R version (3.0.1.))
- it was relatively easy to get plots of percentiles in both packages, although 
they were far not the same (I also tried an other software, LMSchartmaker it 
gave different results from the previous ones)
- I tried to get tables of predicted values (with the predict function in VGAM 
and with centiles.pre in gamlss) but without any success.
- I tried to use the function gamlss() instead of lms() in gamlss but I could 
not force them to give the same (or very similar results), but the 
centiles.pred() function did work as expected for the model resulted from 
galmss()
- lms gives really different results if k is specified different ways, which is 
best?

Also I have a general question: some publications state they estimated the 
centiles so that aroun 18 years of age the curves pass through certain points. 
How is that possible?

Thank you for any suggestions or insights about the methods or preferred 
package!

Here is my code (without data):

#gamlss
library(gamlss)
library(VGAM)
library(foreign)
adatok - read.spss(MDSZ adatok.sav, to.data.frame=TRUE)

adatok_fiu - subset(adatok, adatok$gender == Fiúk)[,2:3]
row.names(adatok_fiu) - NULL
adatok_lany - subset(adatok, adatok$gender == L÷nyok)[,2:3]
row.names(adatok_lany) - NULL

m1 - lms(BMI,age,data=adatok_fiu, cent=c(3,10,25,50,75,90,97), families=BCCG)
fittedPlot(m1, x=adatok_fiu$age)
m1 - lms(BMI,age,data=adatok_fiu, cent=c(3,10,25,50,75,90,97), 
families=BCCG, method.pb=GAIC, k=log(1455))
fittedPlot(m1, x=adatok_fiu$age)
m1 - lms(BMI,age,data=adatok_fiu, cent=c(3,10,25,50,75,90,97), 
families=BCCG, method.pb=GAIC)
fittedPlot(m1, x=adatok_fiu$age)

m2 - lms(BMI,age,data=adatok_lany, cent=c(3,10,25,50,75,90,97), 
families=BCCG)
m2 - lms(BMI,age,data=adatok_lany, cent=c(3,10,25,50,75,90,97), 
families=BCCG, method.pb=GAIC, k=log(1144))
m2 - lms(BMI,age,data=adatok_lany, cent=c(3,10,25,50,75,90,97), 
families=BCCG, method.pb=GAIC)

m3 - gamlss(BMI~age, family=BCT, data=adatok_fiu)
centiles(m3,xvar=adatok_fiu$age, cent=c(3,10,25,50,75,90,97))

newx - seq(12,20,.5)

centiles.pred(m1, xname=age, xvalues=newx)
centiles.pred(m3, xname=age, xvalues=newx)
centiles(m1,adatok_fiu$age)

#VGAM
library(foreign)
library(VGAM)
library(VGAMdata)

adatok - read.spss(MDSZ adatok.sav, to.data.frame=TRUE)

adatok_fiu - subset(adatok, adatok$gender == Fiúk)
adatok_lany - subset(adatok, adatok$gender == L÷nyok)

fit1 - vgam(BMI ~ s(age), lms.bcn(percentiles = c(3, 10, 25, 50, 75, 90, 97)), 
adatok_fiu)
fit2 - vgam(BMI ~ s(age), lms.bcn(percentiles = c(3, 10, 25, 50, 75, 90, 97)), 
adatok_lany)

qtplot(fit1, percentiles = c(3, 10, 25, 50, 75, 90, 97), xlim = c(10.5, 20.5), 
ylim=c(13,34),
   las = 1, ylab = BMI, lcol = 4, pch=NA)

qtplot(fit2, percentiles = c(3, 10, 25, 50, 75, 90, 97), xlim = c(10.5, 20.5), 
ylim=c(13,34),
   las = 1, ylab = BMI, lcol = 3, add=TRUE, pch=NA, label=FALSE)


Thank you:
Daniel

[[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] polr?

2013-07-04 Thread Dániel Kehl
Dear R users,

I have a dataset with two ordered variables, tr_x1 and tr_y1. A crosstable of 
them can bee seen below.

 tr_x1
tr_y1   -101
   -1  629  100  629
   0  1396 4353 1443
   1   668  126  655

It is clear that if tr_x1 is 0, it has an effect on tr_y1. A chi-square 
statistic is clearly showing this with a low p-value.
Is there a regression-based method you would offer? I tried polr from MASS 
package but without finding a significant coefficient, because the columns for 
tr_x1 and tr_y1 are similar.

Thank you for your help!

daniel

[[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] polr?

2013-07-04 Thread Dániel Kehl
Dear Prof Ripley,

could you be just a little more specific?

Thanks a lot
daniel

Feladó: Prof Brian Ripley [rip...@stats.ox.ac.uk]
Küldve: 2013. július 4. 14:14
To: Dániel Kehl
Cc: r-help
Tárgy: Re: [R] polr?

On 04/07/2013 12:59, Dániel Kehl wrote:
 Dear R users,

 I have a dataset with two ordered variables, tr_x1 and tr_y1. A crosstable of 
 them can bee seen below.

   tr_x1
 tr_y1   -101
 -1  629  100  629
 0  1396 4353 1443
 1   668  126  655

 It is clear that if tr_x1 is 0, it has an effect on tr_y1. A chi-square 
 statistic is clearly showing this with a low p-value.
 Is there a regression-based method you would offer? I tried polr from MASS 
 package but without finding a significant coefficient, because the columns 
 for tr_x1 and tr_y1 are similar.

Your mistake is testing coefficients, not overall fit.

 Thank you for your help!

 daniel

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



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
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] R Commander and FactoMineR

2013-04-02 Thread Dániel Kehl
Dear Users,

I helped to install R Commander and FactoMineR to one of my collegaues.
He wanted to do an MCA. Selecting three variables and using the default 
settings results in only one graph, the variables representation, where he gets 
three points for the three variables (which is totally fine).
Running the code (output of the point-and-click method)

EuTop100.MCA-EuTop100[, c(ország, szektor, székhely)]
res-MCA(EuTop100.MCA, ncp=5, graph = FALSE)
plot.MCA(res, axes=c(1, 2), col.ind=black, col.ind.sup=blue,
  col.var=darkred, col.quali.sup=darkgreen, label=c(ind, ind.sup,
  quali.sup, var, quanti.sup), invisible=c(, new.plot=TRUE))
plot.MCA(res, axes=c(1, 2), choix=var, col.var=darkred,
  col.quali.sup=darkgreen, label=c(var, quali.sup), invisible=c(,
  new.plot=TRUE))
plot.MCA(res, axes=c(1, 2), choix=quanti.sup, col.quanti.sup=blue,
  label=c(quanti.sup, new.plot=TRUE))
remove(EuTop100.MCA)

however should result in three graphs.
What went wrong?

MCA(EuTop100.MCA) just works fine.

Thank you and best wishes:
Daniel

[[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] R Commander and FactoMineR

2013-04-02 Thread Dániel Kehl
Hello,

well yes, I see that it should be

... ,invisible=c(none), new.plot=TRUE)

or something similar. I can correct this by hand
The point was more like a bug-report. Maybe not the best place to mention a 
bug, but I couldn't find a better one.

I do not know how to change the output of the point-and-click method.

Best regards:
daniel

Feladó: Pascal Oettli [kri...@ymail.com]
Küldve: 2013. április 2. 11:18
To: Dániel Kehl
Cc: r-help@r-project.org
Tárgy: Re: [R] R Commander and FactoMineR

Hello,

Did you check the position of the brackets, for example for invisible
argument?

Regards,
Pascal


On 04/02/2013 06:09 PM, Dániel Kehl wrote:
 Dear Users,

 I helped to install R Commander and FactoMineR to one of my collegaues.
 He wanted to do an MCA. Selecting three variables and using the default 
 settings results in only one graph, the variables representation, where he 
 gets three points for the three variables (which is totally fine).
 Running the code (output of the point-and-click method)

 EuTop100.MCA-EuTop100[, c(ország, szektor, székhely)]
 res-MCA(EuTop100.MCA, ncp=5, graph = FALSE)
 plot.MCA(res, axes=c(1, 2), col.ind=black, col.ind.sup=blue,
col.var=darkred, col.quali.sup=darkgreen, label=c(ind, ind.sup,
quali.sup, var, quanti.sup), invisible=c(, new.plot=TRUE))
 plot.MCA(res, axes=c(1, 2), choix=var, col.var=darkred,
col.quali.sup=darkgreen, label=c(var, quali.sup), invisible=c(,
new.plot=TRUE))
 plot.MCA(res, axes=c(1, 2), choix=quanti.sup, col.quanti.sup=blue,
label=c(quanti.sup, new.plot=TRUE))
 remove(EuTop100.MCA)

 however should result in three graphs.
 What went wrong?

 MCA(EuTop100.MCA) just works fine.

 Thank you and best wishes:
 Daniel

   [[alternative HTML version deleted]]



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


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


[R] FactoMineR

2013-01-22 Thread Dániel Kehl
Dear Users,

I installed R Commander and the FactoMineR plug-in. Everything is fine, I can 
see the new menu,
I can import datasets, but if I want to use any of the items in the FactoMineR 
menu, i get the following error:

Error in get(.activeDataSet) : object '.activeDataSet' not found

even if there is an active dataset (if there is none, all the menu items are 
grey of course).

I have R version 2.15.2 using Windows 7 but experienced the same on other 
machines.

Please let me know if you have any idea!

Thanks a lot

daniel
__
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] FactoMineR

2013-01-22 Thread Dániel Kehl
Dear John,

great news, thank you for your kind answer and quick response. I am sure that 
the author is going to do his best as well.

An other good experience why I love R! :)

Have a nice day,

daniel

Feladó: John Fox [j...@mcmaster.ca]
Küldve: 2013. január 22. 13:39
To: Dániel Kehl
Cc: R-help
Tárgy: Re: [R] FactoMineR

Dear Daniel,

There were changes to the new version 1.9-3 of the Rcmdr so that it conforms to 
CRAN policies. These changes can break plug-ins that haven't been modified for 
compatibility.

One change is that the environment in which the Rcmdr stores state information 
is no longer put on the search path. That's apparently preventing the 
FactoMineR plug-in from finding the active data set. The solution is for the 
author to replace get(.activeDataSet) with something like 
get(getRcmdr(.activeDataSet)). I'll correspond with the package author to 
suggest this.

I apologize for the difficulties introduced by these changes.

John


John Fox
Sen. William McMaster Prof. of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/

On Tue, 22 Jan 2013 10:34:28 +
 Dániel Kehl ke...@ktk.pte.hu wrote:
 Dear Users,

 I installed R Commander and the FactoMineR plug-in. Everything is fine, I can 
 see the new menu,
 I can import datasets, but if I want to use any of the items in the 
 FactoMineR menu, i get the following error:

 Error in get(.activeDataSet) : object '.activeDataSet' not found

 even if there is an active dataset (if there is none, all the menu items are 
 grey of course).

 I have R version 2.15.2 using Windows 7 but experienced the same on other 
 machines.

 Please let me know if you have any idea!

 Thanks a lot

 daniel
 __
 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] slider control questions

2012-11-04 Thread Dániel Kehl
DeaR UseRs,

I have the following code (see below).
It is working as expected although I have two problems/questions:
- how can I set the size of the graph? It may sound silly, but I couldnt figure 
that out
- is it possible to export this small interactive aplication to html or a 
latex document, or maybe pdf?

Thank you for your attentions.

Best wishes:
Daniel

the code:
library(tkrplot)
library(relax)

dirfelulet - function (a1 = 1, a2 = 1, a3 = 1){
  x1 - x2 - seq(0, 1, by=.01)

  dirf - function(x1, x2){
term1 - gamma(a1+a2+a3)/(gamma(a1)*gamma(a2)*gamma(a3))
term2 - x1^(a1-1)*x2^(a2-1)*(1-x1-x2)^(a3-1)
term3 - (x1 + x2  1)
term1 * term2 * term3
  }

  f - outer(x1, x2, dirf)
  f[f=0] - NA
  f[is.infinite(f)] - NA

  persp(x1, x2, f,
zlim = c(0, max(f, na.rm = TRUE)+1),
main = bquote(paste(Dirichlet eloszlás, , alpha 
,=(,.(a1),,,.(a2),,,.(a3),))),
col = lightblue,
theta = 50,
phi = 20,
r = 50,
d = 0.1,
expand = 0.5,
ltheta = 90,
lphi = 180,
shade = 0.75,
ticktype = detailed,
nticks = 5)
}

plot.dirichlet-function(){
  refresh.code-function(...){
a1-slider(no=1); a2-slider(no=2); a3-slider(no=3)
type=  slider(obj.name=type)
dirfelulet(a1,a2,a3)
  }
  slider(obj.name=type,obj.value=l)
  gslider(refresh.code,sl.names=c(a1,a2,a3),
  
sl.mins=c(1,1,1),sl.maxs=c(10,10,10),sl.deltas=c(.1,.1,.1),sl.defaults=c(1,1,1))
}
plot.dirichlet()


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