From: Mohammad Ehsanul Karim <wildscop_at_yahoo.com>

Date: Mon 21 Mar 2005 - 02:46:13 EST

m <- c(1,2,3,4,5,6,7,8,9,10,12,13,17)

k <- c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 19) ExpWW <- c(0.309330628803245, 0.213645190887434,

ExpDD <- c(0.420249653259362, 0.243639882194748,

ObjDD <- c(0.468646864686469, 0.198019801980198,

ObjWW <- c(0.373770491803279, 0.150819672131148,

# (i.e., 3, 4 both in same axis too, but not with 1 and 2's).

# How can i use different types of legends in the same graph??

sum(((ObjWW-ExpWW)^2)/ExpWW) # Chi-Squared Goodness of Fit Test

sum(((ObjDD-ExpDD)^2)/ExpDD) # Chi-Squared Goodness of Fit Test

# Also, is there any other convenient way of doing chi-squared goodness of fit test (any function or package may be, to do this directly)?

# And how can i find the P-values of the respective chi-squared tests in R?

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 Received on Mon Mar 21 02:52:39 2005

Date: Mon 21 Mar 2005 - 02:46:13 EST

Dear List,

Suppose, I have some observed and expected
frequencies, such as following.

I need to draw a graph where plots of observed and
expected frequencies are merged into one.

m <- c(1,2,3,4,5,6,7,8,9,10,12,13,17)

k <- c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 19) ExpWW <- c(0.309330628803245, 0.213645190887434,

0.147558189649435, 0.101913922060107, 0.0703888244654489, 0.0486154051328303, 0.0335771712935674, 0.0231907237838939, 0.0160171226134196, 0.0110625360037919, 0.00764055478558038, 0.00527709716935116, 0.000395627498345897)

ExpDD <- c(0.420249653259362, 0.243639882194748,

0.141250306182253, 0.0818899139863827, 0.0474757060281664, 0.0275240570315860, 0.0159570816077711, 0.00925112359507395, 0.00536334211198462, 0.00310939944911175, 0.00104510169329968, 0.00060589806906972, 6.84484529305126e-05)

ObjDD <- c(0.468646864686469, 0.198019801980198,

0.151815181518152, 0.0759075907590759, 0.0396039603960396, 0.0198019801980198, 0.0165016501650165, 0.0099009900990099, 0.0033003300330033, 0.0033003300330033, 0.0033003300330033, 0.0066006600660066, 0.0033003300330033)

ObjWW <- c(0.373770491803279, 0.150819672131148,

0.127868852459016, 0.0721311475409836, 0.0885245901639344, 0.0622950819672131, 0.039344262295082, 0.0327868852459016, 0.0360655737704918, 0.00327868852459016, 0.00655737704918033, 0.00327868852459016, 0.00327868852459016)par(mfrow=c(2,2))

------------------------------------------------

plot(k,ObjWW, type="l") # Plot 1 plot(k,ExpWW, type="l") # Plot 2 plot(m,ObjDD, type="l") # Plot 3 plot(m,ExpDD, type="l") # Plot 4# I need to see plot 1 and 2 in same axis, and plot 3 and 4 in another

------------------------------------------------

# (i.e., 3, 4 both in same axis too, but not with 1 and 2's).

# How can i use different types of legends in the same graph??

sum(((ObjWW-ExpWW)^2)/ExpWW) # Chi-Squared Goodness of Fit Test

sum(((ObjDD-ExpDD)^2)/ExpDD) # Chi-Squared Goodness of Fit Test

# Also, is there any other convenient way of doing chi-squared goodness of fit test (any function or package may be, to do this directly)?

# And how can i find the P-values of the respective chi-squared tests in R?

Any suggestion, direction, references, help, replies will be highly appreciated.

Thank you for your time.

Mohammad Ehsanul Karim

Web: http://snipurl.com/ehsan

Institute of Statistical Reseach and Training
University of Dhaka, Dhaka - 1000, Bangladesh

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 Received on Mon Mar 21 02:52:39 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:30:51 EST
*