From Wikipedia, the free encyclopedia

This user is a PhD student in the field of operations research at Berkeley. He usually contributes to the following general topics:

  • Stochastic Processes
  • Optimization Algorithms
  • Python Programming
  • Micro Electro Mechanical Systems

Kaveh Zamani's Funcrasing




Contributions

At this moment, He is contributing to the following articles:

Social Network Analysis and Text Mining


Production and Logistics Sciences:

User Interfaces:

Entrepreneurship:

Other contributions:

People:

User boxes

To Do

To Learn

Stochastic Analysis

Short Term TODO

Poisson Regression in SPSS

  1. Sorting in SPSS
  2. Poisson regression in SPSS
  3. Annotated SPSS Output

2D Spatial Statistical Analysis

Generalized Linear Models: logistic regression, Poisson regression, etc.

Friends

  • [User:Vantelimus]
  • [User:Michael_Hardy]
  • [User:Melcombe]
  • [User:Mpdelbuono]

Useful Stuff

Use # for auto numbering, * for bullets use <code></code> for Code Texts. When you want the text and the link to be different use this [[Optimal_control_theory|control]] control

{{Reflist|3}} Multicol {{colbegin|3}} {{lorem}} {{lorem}} {{colend}}

{{colbegin|3}}
{{lorem}}
{{lorem}}
{{colend}}
<syntaxhighlight lang="python">
Time	Visits	
0.00	158
0.50	177
1.00	207
1.50	133
2.00	134
2.50	119
3.00	103
</syntaxhighlight>

For codes

Time	Visits	
0.00	158
0.50	177
1.00	207
1.50	133
2.00	134
2.50	119
3.00	103

This is the table I usually use:

α β γ δ ε ζ
η θ ι κ λ μ ν
ξ ο π ρ σ ς
τ υ φ χ ψ ω
Γ Δ Θ Λ Ξ Π
Σ Φ Ψ Ω
∫ ∑ ∏ √ − ± ∞
≈ ∝ = ≡ ≠ ≤ ≥
× · ÷ ∂ ′ ″
∇ ‰ ° ∴ Ø ø
∈ ∉ ∩ ∪ ⊂ ⊃ ⊆ ⊇
¬ ∧ ∨ ∃ ∀
⇒ ⇔ → ↔ ↑
ℵ - – —

Poisson regression in R

The R function for fitting a generalized linear model is glm(). A Poisson regression is done when a counting process is being observed.

Syntax

glm( numData˜roadType+weekDay, family=poisson(link=log), data=roadData) fits a model → Poisson(), where log() = . setting family=poisson.

The following code does the Poisson regression in R

X<-read.table("C:/poissonvisits.txt", header = TRUE)
names(X)
attach(X)
hourofday <- Time
foo <- split(Visits, hourofday)
foo <- sapply(foo, sum)
barplot(foo, space = 0, xlab = "hour of the day", ylab = "total count")

#Starting from here we do the GLM
w <- Time/24 * 2 * pi
out1 <- glm(Visits ~ I(sin(w)) + I(cos(w)), family = poisson)
summary(out1)

out2 <- update(out1, . ~ . + I(sin(2 * w)) + I(cos(2 * w)))
summary(out2)

out3 <- update(out2, . ~ . + I(sin(3 * w)) + I(cos(3 * w)))
summary(out3)

anova(out1, out2, out3, test = "Chisq")
plot(hourofday, Visits, xlab = "hour of the day")

curve(predict(out2, data.frame(w = x/24 * 2 * pi), type = "response"),add = TRUE)

where the file poissonvisits.txt is defined as

Time	Visits	
0.00	158
0.50	177
1.00	207
1.50	133
2.00	134
2.50	119
3.00	103

For more information about glm() in R type ?glm

See Also

ANOVA

References

  • Generalized linear models in R [1]
  • Generalized Linear Models in R, GillWard [2]
  • Dobson, A. J. (1990) An Introduction to Generalized Linear Models. London: Chapman and Hall.
  • Hastie, T. J. and Pregibon, D. (1992) Generalized linear models. Chapter 6 of Statistical Models in S eds J. M. Chambers and T. J. Hastie, Wadsworth & Brooks/Cole.
  • McCullagh P. and Nelder, J. A. (1989) Generalized Linear Models. London: Chapman and Hall.


  • Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. New York: Springer.