I have the following data (prop
is like empirical CDF):
td <- data.frame(a = 3:14, prop=c(0, 0, 0.026, 0.143, 0.21, 0.361, 0.535,
0.719, 0.814, 0.874, 0.950, 0.964))
I want to fit a normal CDF using an appropriate mean and standard deviation. How can I find such a mean and a standard deviation value that fits the data above?
mean <- 8.8 # <-- How can I find a best fitting number?
sd <- 2.3 # <-- How can I find a best fitting number?
x <- seq(from = 2, to = 15, by = .1)
cdf <- data.frame(x = x, y = pnorm(q = x, mean = mean, sd = sd))
library(ggplot2)
ggplot(data = td, aes(x = a, y = prop)) + geom_point() +
geom_line(data = cdf, aes(x = x, y = y))
EDIT:
The motivation behind this question is to replicate a graph I saw on a book. The book used the same proportions and fitted the normal ogive to the data. It looks like normal ogive fitted so well and I couldn't replicate it. There is no way the author used the raw data because the data is from a 100 years old book and the author's book published about 17 years ago. Here is the graph with its caption:
Caption: "Proportions correct on item 46, plotted against age, with a fitted normal ogive."
td
data frame? $\endgroup$a
represents the age of a child andprop
represents the percentage of children who correctly answered a question in that age group. I believe the total sample size is about 3,000. $\endgroup$n
in each group you can fit a binomial regression model by doingglm(prop ~ a, binomial(link="probit"), weight=n)
. Using the default logit link function instead of the probit would probably make the results easier to interpret (in terms of oddsratios). $\endgroup$