R: Multiple Linear Regression error -
i having hard times running lm()
function , understanding error.
so, script this:
#! /usr/bin/env/ rscript meteodata <- read.table("/path/to/dataset.txt", header=t) meteodata summary(meteodata) plot(meteodata) lmodel <- lm(temperature~altitude+sea.distance, data=meteodata)
and console output this:
temperature station.id latitude longtitude sea.distance altitude 1 20,1 s1 0,5 0,5 0,5 0 2 20,5 s1 0,5 0,5 0,5 0 3 19,3 s1 0,5 0,5 0,5 0 4 18,6 s1 0,5 0,5 0,5 0 5 21,5 s1 0,5 0,5 0,5 0 6 17,1 s2 3,5 2,5 1,5 200 7 18,3 s2 3,5 2,5 1,5 200 8 16,8 s2 3,5 2,5 1,5 200 9 17,5 s2 3,5 2,5 1,5 200 10 16,4 s2 3,5 2,5 1,5 200 11 18,4 s3 2,5 3,5 0,5 100 12 19,1 s3 2,5 3,5 0,5 100 13 18,9 s3 2,5 3,5 0,5 100 14 17,8 s3 2,5 3,5 0,5 100 15 17,6 s3 2,5 3,5 0,5 100 16 15,1 s4 4 0 4 400 17 15,5 s4 4 0 4 400 18 15,0 s4 4 0 4 400 19 14,9 s4 4 0 4 400 20 15,8 s4 4 0 4 400 temperature station.id latitude longtitude sea.distance altitude 14,9 : 1 s1:5 0,5:5 0 :5 0,5:10 min. : 0 15,0 : 1 s2:5 2,5:5 0,5:5 1,5: 5 1st qu.: 75 15,1 : 1 s3:5 3,5:5 2,5:5 4 : 5 median :150 15,5 : 1 s4:5 4 :5 3,5:5 mean :175 15,8 : 1 3rd qu.:250 16,4 : 1 max. :400 (other):14 warning messages: 1: in model.response(mf, "numeric") : using type = "numeric" factor response ignored 2: in ops.factor(y, z$residuals) : - not meaningful factors
i ve read similar questions here , there still can't figure out doing wrong. need temperature
response y variable calculated independent x1,x2 altitude
, sea.distance
variables.
any appreciated, try specific. in advance
r uses .
decimal separator. data uses ,
, r interprets data characters, made factor variables default. use dec=","
tell read.table
data numeric ,
decimal separator.
Comments
Post a Comment