I am trying to confirm that the sample is not different from the population
with respect to geographical respresentation for the following data:

                 region population sample n_total s_total
1                 north       1244    232    9077    1032
2                 south       4333    100    9077    1032
3                  east       1500    200    9077    1032
4                  west       2000    500    9077    1032


For example the first line of this data shows that our sample consisted of
232 individuals from the north that had a population of 1244. The table also
shows that in total, we chose 1032 individuals (s_total) from a population
size of 9077 (n_total).

I thought that one way of doing that would be to run a logistic regression
of sample / population  proportion on region (north, south, east, west) and
source (sample, population) and show that the source factor is
insignificant.

I am not exactly satisfied with the results with a huge residual deviance
and a sample factor p value of 1.00.

Therefore, I was wondering if there was a better approach of making such
comparison.
I would appreciate any suggestions.

Raghu

The data / logistic regression code is as below :

____________________________________________________

library(sqldf)

mystring <- ("region, population, sample
                north, 1244, 232
                south, 4333, 100
                east,  1500, 200
                west,  2000, 500")

one <- read.table(textConnection(mystring),header=TRUE,sep=",")



n_total <- sum(one$population)
s_total <- sum(one$sample)

one <- cbind(one,n_total,s_total) ; one


two <- sqldf(" select population as count, n_total as total , 'population'
as source, region
                from one union select sample as count, s_total as total,
'sample' as source, region
                            from one " )



attach(two)



prop <- count/total



model1 <- glm(prop ~ source + region, weights=total, quasibinomial)

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

Reply via email to